Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wNBRs-000dIx-1Z for pgsql-hackers@arkaria.postgresql.org; Wed, 13 May 2026 15:24:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wNBRq-009YT6-39 for pgsql-hackers@arkaria.postgresql.org; Wed, 13 May 2026 15:24:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wNBRq-009YSy-2G for pgsql-hackers@lists.postgresql.org; Wed, 13 May 2026 15:24:34 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wNBRn-00000000O3D-2qLV for pgsql-hackers@lists.postgresql.org; Wed, 13 May 2026 15:24:34 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 64DFOUaq473273 for ; Wed, 13 May 2026 11:24:30 -0400 From: Tom Lane To: pgsql-hackers@lists.postgresql.org Subject: egrep is obsolescent MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <473132.1778685822.0@sss.pgh.pa.us> Date: Wed, 13 May 2026 11:24:30 -0400 Message-ID: <473272.1778685870@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <473132.1778685822.1@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 ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="use-grep-E-not-egrep.patch"; charset="us-ascii" Content-ID: <473132.1778685822.2@sss.pgh.pa.us> Content-Description: use-grep-E-not-egrep.patch Content-Transfer-Encoding: quoted-printable diff --git a/doc/src/sgml/func/func-matching.sgml b/doc/src/sgml/func/func= -matching.sgml index af60e9898de..ae1dff66722 100644 --- a/doc/src/sgml/func/func-matching.sgml +++ b/doc/src/sgml/func/func-matching.sgml @@ -505,7 +505,7 @@ substring('foobar' SIMILAR '#"o_b#"%' ESCAPE '#') <= lineannotation>NULLPOSIX regular expressions provide a more powerful means for pattern matching than the LIKE and SIMILAR TO operators. - Many Unix tools such as egrep, + Many Unix tools such as grep -E, sed, or awk use a pattern matching language that is similar to the one described here. @@ -1065,7 +1065,7 @@ regexp_substr('ABCDEFGHI', '(c..)(...)', 1, 1, 'i', = 2) Regular expressions (REs), as defined in POSIX 1003.2, come in two forms: extended REs or ER= Es - (roughly those of egrep), and + (roughly those of grep -E), and basic REs or BREs (roughly those of ed). PostgreSQL supports both forms, and diff --git a/src/tools/find_typedef b/src/tools/find_typedef index 24e9b76651d..fec0520c32e 100755 --- a/src/tools/find_typedef +++ b/src/tools/find_typedef @@ -36,12 +36,12 @@ do # if objdump -W is recognized, only one line of err= or should appear if [ `objdump -W 2>&1 | wc -l` -eq 1 ] then # Linux objdump -W "$DIR"/* | - egrep -A3 '\(DW_TAG_typedef\)' | + grep -E -A3 '\(DW_TAG_typedef\)' | awk ' $2 =3D=3D "DW_AT_name" {print $NF}' elif [ `readelf -w 2>&1 | wc -l` -gt 1 ] then # FreeBSD, similar output to Linux readelf -w "$DIR"/* | - egrep -A3 '\(DW_TAG_typedef\)' | + grep -E -A3 '\(DW_TAG_typedef\)' | awk ' $1 =3D=3D "DW_AT_name" {print $NF}' fi done | @@ -50,4 +50,4 @@ sort | uniq | # these are used both for typedefs and variable names # so do not include them -egrep -v '^(date|interval|timestamp|ANY)$' +grep -E -v '^(date|interval|timestamp|ANY)$' diff --git a/src/tools/perlcheck/find_perl_files b/src/tools/perlcheck/fin= d_perl_files index 20dceb800d0..406ec7f3a08 100644 --- a/src/tools/perlcheck/find_perl_files +++ b/src/tools/perlcheck/find_perl_files @@ -12,7 +12,7 @@ find_perl_files () { find "$@" -type f -name '*.p[lm]' -print # take executable files that file(1) thinks are perl files find "$@" -type f -perm -100 -exec file {} \; -print | - egrep -i ':.*perl[0-9]*\>' | + grep -E -i ':.*perl[0-9]*\>' | cut -d: -f1 } | sort -u | grep -v '^\./\.git/' } ------- =_aaaaaaaaaa0--