]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Use "grep -E" not "egrep".
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 13 May 2026 16:07:19 +0000 (12:07 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 13 May 2026 16:07:19 +0000 (12:07 -0400)
"egrep" has never been in POSIX; the standard way to access this
functionality is "grep -E".  Recent versions of GNU grep have
started to warn about this, so stop using "egrep".

This could be back-patched, but I see little need to do so
because the affected places are not code that runs during
normal builds.  (Perhaps src/backend/port/aix/mkldexport.sh
is an exception, but let's wait to see if any AIX users
complain before touching that.)

Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/473272.1778685870@sss.pgh.pa.us

doc/src/sgml/func/func-matching.sgml
src/backend/port/aix/mkldexport.sh
src/tools/find_typedef
src/tools/perlcheck/find_perl_files

index af60e9898defaeb244d34162fda3f391682419d0..ae1dff667220c7e81ca46a663bb84b4928949285 100644 (file)
@@ -505,7 +505,7 @@ substring('foobar' SIMILAR '#"o_b#"%' ESCAPE '#')    <lineannotation>NULL</linea
      <acronym>POSIX</acronym> regular expressions provide a more
      powerful means for pattern matching than the <function>LIKE</function> and
      <function>SIMILAR TO</function> operators.
-     Many Unix tools such as <command>egrep</command>,
+     Many Unix tools such as <command>grep -E</command>,
      <command>sed</command>, or <command>awk</command> use a pattern
      matching language that is similar to the one described here.
     </para>
@@ -1065,7 +1065,7 @@ regexp_substr('ABCDEFGHI', '(c..)(...)', 1, 1, 'i', 2)
     Regular expressions (<acronym>RE</acronym>s), as defined in
     <acronym>POSIX</acronym> 1003.2, come in two forms:
     <firstterm>extended</firstterm> <acronym>RE</acronym>s or <acronym>ERE</acronym>s
-    (roughly those of <command>egrep</command>), and
+    (roughly those of <command>grep -E</command>), and
     <firstterm>basic</firstterm> <acronym>RE</acronym>s or <acronym>BRE</acronym>s
     (roughly those of <command>ed</command>).
     <productname>PostgreSQL</productname> supports both forms, and
index 9d016e7afd55517c007df1a6bc1fc36f669d36d3..366391bf01d809edf8e14677a4d4ec47d63ea9ca 100755 (executable)
@@ -63,9 +63,9 @@ else
        fi
 fi
 $NM -BCg $1 | \
-       egrep ' [TDB] ' | \
+       grep ' [TDB] ' | \
        sed -e 's/.* //' | \
-       egrep -v '\$' | \
+       grep -v '\$' | \
        sed -e 's/^[.]//' | \
        sort | \
        uniq
index 24e9b76651d13153d759c289c3de7b23f816446c..fec0520c32e168cb57568a6d26335cc71559b4aa 100755 (executable)
@@ -36,12 +36,12 @@ do  # if objdump -W is recognized, only one line of error 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 == "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 == "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)$'
index 20dceb800d0ab034888b352f1606c11bdd52c179..406ec7f3a0836b05423b9be7c6fae202a75ac2fd 100644 (file)
@@ -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/'
 }