[v2,3/7] libbacktrace: use grep instead of fgrep

Message ID 664e8a9fa34de7dd51c18c67e5b3786818165ab1.camel@xry111.site
State New
Headers
Series Avoid using obsoleted egrep/fgrep |

Commit Message

Xi Ruoyao June 27, 2022, 6:09 a.m. UTC
  fgrep has been deprecated in favor of grep -F for a long time, and the
next grep release (3.8 or 4.0) will print a warning of fgrep is used.
But, we can't simply replace fgrep to grep -F, or the build will break
with some non-GNU grep implementations (lacking -F support).

As "add-gnu-debuglink" is definitely not a non-trivial regex, simply
replace fgrep with grep.

libbacktrace/ChangeLog:

	* configure.ac (AC_PROG_FGREP): Use grep instead of fgrep.
	* configure: Regenerate.
---
 libbacktrace/configure    | 2 +-
 libbacktrace/configure.ac | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

Jonathan Wakely June 27, 2022, 9:07 a.m. UTC | #1
On Mon, 27 Jun 2022 at 07:09, Xi Ruoyao wrote:
>
> fgrep has been deprecated in favor of grep -F for a long time, and the
> next grep release (3.8 or 4.0) will print a warning of fgrep is used.
> But, we can't simply replace fgrep to grep -F, or the build will break
> with some non-GNU grep implementations (lacking -F support).
>
> As "add-gnu-debuglink" is definitely not a non-trivial regex, simply
> replace fgrep with grep.

FWIW, GNU grep will be just as fast when using grep as fgrep in this
case, because it detects that the pattern is a fixed string that
contains no special characters and automatically uses the same
matching engine as fgrep. So for GNU grep, there's no downside to this
change.
  
Ian Lance Taylor June 27, 2022, 8 p.m. UTC | #2
On Sun, Jun 26, 2022 at 11:10 PM Xi Ruoyao via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> libbacktrace/ChangeLog:
>
>         * configure.ac (AC_PROG_FGREP): Use grep instead of fgrep.
>         * configure: Regenerate.

Thanks.  Committed to mainline.

Ian
  

Patch

diff --git a/libbacktrace/configure b/libbacktrace/configure
index 17f470a4bec..537486d34f2 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -13831,7 +13831,7 @@  else
   libbacktrace_cv_objcopy_debuglink=no
 elif ! test -n "${OBJCOPY}"; then
   libbacktrace_cv_objcopy_debuglink=no
-elif ${OBJCOPY} --help | fgrep add-gnu-debuglink >/dev/null 2>&1; then
+elif ${OBJCOPY} --help | grep add-gnu-debuglink >/dev/null 2>&1; then
   libbacktrace_cv_objcopy_debuglink=yes
 else
   libbacktrace_cv_objcopy_debuglink=no
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 597c9705db8..857987a2859 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -500,7 +500,7 @@  AC_CACHE_CHECK([whether objcopy supports debuglink],
   libbacktrace_cv_objcopy_debuglink=no
 elif ! test -n "${OBJCOPY}"; then
   libbacktrace_cv_objcopy_debuglink=no
-elif ${OBJCOPY} --help | fgrep add-gnu-debuglink >/dev/null 2>&1; then
+elif ${OBJCOPY} --help | grep add-gnu-debuglink >/dev/null 2>&1; then
   libbacktrace_cv_objcopy_debuglink=yes
 else
   libbacktrace_cv_objcopy_debuglink=no