Skip to contentSkip to conversation

common/rc: replace obsolescent egrep and fgrep

PATCH In review Zorro Lang 3 participants 5 messages Sep 13, 2022 – Sep 15, 2022

lore
Share & tools
lore

Zorro Lang

author
#0 lore raw

PATCH 1/1 common/rc: replace obsolescent egrep and fgrep

Due to the change in grep project:
a95156247098 ("egrep, fgrep: now obsolete")

some tests start to fail on latest Fedora system with grep-3.8-1.fc38 or newer version, as:

generic/447 70s ... egrep: warning: egrep is obsolescent; using grep -E
...
@@ -1,4 +1,5 @@
QA output created by 447
+egrep: warning: egrep is obsolescent; using grep -E
...

So use grep -E and -F to instead of egrep and fgrep commands.

---
 common/rc | 11 +++++++++++
 1 file changed, 11 insertions(+)
common/rc +11 -0
index a25cbcd0..dee3965e 100644
@@ -30,6 +30,17 @@ dd()
 	fi
 }
 
+# The egrep and fgrep are obsolescent
+egrep()
+{
+	grep -E "$@"
+}
+
+fgrep()
+{
+	grep -F "$@"
+}
+
 # Prints the md5 checksum of a given file
 _md5_checksum()
 {
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 32 lines · Zorro Lang

Due to the change in grep project:
a95156247098 ("egrep, fgrep: now obsolete")

some tests start to fail on latest Fedora system with grep-3.8-1.fc38 or newer version, as:

generic/447 70s ... egrep: warning: egrep is obsolescent; using grep -E
...
@@ -1,4 +1,5 @@
QA output created by 447
+egrep: warning: egrep is obsolescent; using grep -E
...

So use grep -E and -F to instead of egrep and fgrep commands.

---
 common/rc | 11 +++++++++++
 1 file changed, 11 insertions(+)
common/rc +4 -0
index a25cbcd0..dee3965e 100644
@@ -30,6 +30,17 @@ dd()
 	fi
 }
 
+# The egrep and fgrep are obsolescent
+egrep()
+{
+	grep -E "$@"

common/rc dd() · line 46

Quoted 10 lines
common/rc +7 -0
+}
+
+fgrep()
+{
+	grep -F "$@"
+}
+
 # Prints the md5 checksum of a given file
 _md5_checksum()
 {

Nit: AFAICT there's only one fgrep caller, so just change that single case. With that fixed:

author
#2 lore raw
Quoted 39 lines · David Disseldorp
Quoted 37 lines · Zorro Lang

Due to the change in grep project:
a95156247098 ("egrep, fgrep: now obsolete")

some tests start to fail on latest Fedora system with grep-3.8-1.fc38 or newer version, as:

generic/447 70s ... egrep: warning: egrep is obsolescent; using grep -E
...
@@ -1,4 +1,5 @@
QA output created by 447
+egrep: warning: egrep is obsolescent; using grep -E
...

So use grep -E and -F to instead of egrep and fgrep commands.

---
 common/rc | 11 +++++++++++
 1 file changed, 11 insertions(+)
common/rc +9 -0
index a25cbcd0..dee3965e 100644
@@ -30,6 +30,17 @@ dd()
 	fi
 }
 
+# The egrep and fgrep are obsolescent
+egrep()
+{
+	grep -E "$@"
+}
+
+fgrep()
+{
+	grep -F "$@"
Quoted 8 lines

common/rc dd() · line 46

Quoted 5 lines
common/rc +2 -0
+}
+
 # Prints the md5 checksum of a given file
 _md5_checksum()
 {

Nit: AFAICT there's only one fgrep caller, so just change that single case. With that fixed:

Thanks for reviewing!

Yeah, I thought about that too. But then I thought a fgrep() might help later patches to avoid using fgrep command directly, so ...

Thanks,
Zorro

Quoted 3 lines
#3 lore raw
In reply to Zorro Lang
Quoted 28 lines · Zorro Lang

Due to the change in grep project:
a95156247098 ("egrep, fgrep: now obsolete")

some tests start to fail on latest Fedora system with grep-3.8-1.fc38 or newer version, as:

generic/447 70s ... egrep: warning: egrep is obsolescent; using grep -E
...
@@ -1,4 +1,5 @@
QA output created by 447
+egrep: warning: egrep is obsolescent; using grep -E
...

So use grep -E and -F to instead of egrep and fgrep commands.

---
 common/rc | 11 +++++++++++
 1 file changed, 11 insertions(+)
common/rc +0 -0
index a25cbcd0..dee3965e 100644
@@ -30,6 +30,17 @@ dd()
 	fi
 }
 

common/rc dd() · line 42

Quoted 10 lines
common/rc +10 -0
+# The egrep and fgrep are obsolescent
+egrep()
+{
+	grep -E "$@"
+}
+
+fgrep()
+{
+	grep -F "$@"
+}

Why not conditionally define these *only* if the system doesn't already have an egrep/fgrep binary?

(Alternately I guess you could take Murphy's patch, since that's the proper fix according to the gnu grep maintainers...)

--D

Quoted 7 lines
common/rc +1 -0
+
 # Prints the md5 checksum of a given file
 _md5_checksum()
 {
Signature · 1 line
2.31.1
author
#4 lore raw
Quoted 43 lines · Darrick J. Wong
Quoted 28 lines · Zorro Lang

Due to the change in grep project:
a95156247098 ("egrep, fgrep: now obsolete")

some tests start to fail on latest Fedora system with grep-3.8-1.fc38 or newer version, as:

generic/447 70s ... egrep: warning: egrep is obsolescent; using grep -E
...
@@ -1,4 +1,5 @@
QA output created by 447
+egrep: warning: egrep is obsolescent; using grep -E
...

So use grep -E and -F to instead of egrep and fgrep commands.

---
 common/rc | 11 +++++++++++
 1 file changed, 11 insertions(+)
common/rc +0 -0
index a25cbcd0..dee3965e 100644
@@ -30,6 +30,17 @@ dd()
 	fi
 }
 

common/rc dd() · line 42

Quoted 10 lines
common/rc +10 -0
+# The egrep and fgrep are obsolescent
+egrep()
+{
+	grep -E "$@"
+}
+
+fgrep()
+{
+	grep -F "$@"
+}

Why not conditionally define these *only* if the system doesn't already have an egrep/fgrep binary?

Quoted 2 lines

(Alternately I guess you could take Murphy's patch, since that's the proper fix according to the gnu grep maintainers...)

OK, let's drop this patch, turn to review Murphy's. I just hope to avoid later patches using egrep and fgrep commands.

Thanks,
Zorro

Quoted 11 lines

--D

Quoted 7 lines
common/rc +1 -0
+
 # Prints the md5 checksum of a given file
 _md5_checksum()
 {
Signature · 1 line
2.31.1