egrep is obsolescent

Started by Tom Lane11 days ago3 messageshackers
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

While running pgperltidy just now on my recently-updated
Linux workstation, I got

$ src/tools/pgindent/pgperltidy .
egrep: warning: egrep is obsolescent; using grep -E

OK, that's a bit in-your-face, but it's not inaccurate.
AFAICT, "egrep" has never been in POSIX, while "grep -E"
has been there at least since POSIX 2008.

So I propose the attached patch, which is just s/egrep/grep -E/g.

I did not touch the two usages in port/aix/mkldexport.sh, though.
I'm not sure what the standardization situation is in AIX, and
this warning doesn't seem like something they'd do anyway.

There is also a reference in configure, which is not a problem
because it tries "grep -E" first.

regards, tom lane

Attachments:

use-grep-E-not-egrep.patchtext/x-diff; charset=us-ascii; name=use-grep-E-not-egrep.patchDownload+6-6
#2Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#1)
Re: egrep is obsolescent

On 13.05.26 17:24, Tom Lane wrote:

While running pgperltidy just now on my recently-updated
Linux workstation, I got

$ src/tools/pgindent/pgperltidy .
egrep: warning: egrep is obsolescent; using grep -E

OK, that's a bit in-your-face, but it's not inaccurate.
AFAICT, "egrep" has never been in POSIX, while "grep -E"
has been there at least since POSIX 2008.

So I propose the attached patch, which is just s/egrep/grep -E/g.

Looks good to me.

I did not touch the two usages in port/aix/mkldexport.sh, though.
I'm not sure what the standardization situation is in AIX, and
this warning doesn't seem like something they'd do anyway.

It appears that those invocations don't actually need the "e" part of
egrep, so they could just be grep?

There is also a reference in configure, which is not a problem
because it tries "grep -E" first.

Yeah, Autoconf addressed this some decades ago, so it should be fine.

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#2)
Re: egrep is obsolescent

Peter Eisentraut <peter@eisentraut.org> writes:

On 13.05.26 17:24, Tom Lane wrote:

I did not touch the two usages in port/aix/mkldexport.sh, though.
I'm not sure what the standardization situation is in AIX, and
this warning doesn't seem like something they'd do anyway.

It appears that those invocations don't actually need the "e" part of
egrep, so they could just be grep?

Oh, good point. I'll make it so, just for cleanliness.

regards, tom lane