[v2,4/7] fortran: use grep instead of fgrep

Message ID 1e2be9a04a91bd061892353b578261666a1c9b75.camel@xry111.site
State Committed
Commit 0440b774ea3311d65027aa7b1d26b62b7d8538ea
Headers
Series Avoid using obsoleted egrep/fgrep |

Commit Message

Xi Ruoyao June 27, 2022, 6:10 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.
Stop using fgrep so we won't see the warning.

We can't hard code grep -F here or it may break build on hosts w/o GNU
grep.  autoconf documentation contains a warning about this issue and
suggest to use AC_PROG_FGREP and $FGREP, but these are too overkill in
the specific case: there is no way "debian" could be interpreted as an
non-trivial regex, so we can use a plain grep here.

gcc/fortran/ChangeLog:

	* Make-lang.in: Use grep instead of fgrep.
---
 gcc/fortran/Make-lang.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Bernhard Reutner-Fischer May 10, 2023, 7:29 p.m. UTC | #1
On Mon, 27 Jun 2022 14:10:36 +0800
Xi Ruoyao <xry111@xry111.site> 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.
> Stop using fgrep so we won't see the warning.
> 
> We can't hard code grep -F here or it may break build on hosts w/o GNU
> grep.  autoconf documentation contains a warning about this issue and
> suggest to use AC_PROG_FGREP and $FGREP, but these are too overkill in
> the specific case: there is no way "debian" could be interpreted as an
> non-trivial regex, so we can use a plain grep here.

LGTM but i cannot approve it. I'd say this one is trivial and obvious
so you could sneak it in under the "obvious" rule..
Thanks for the patch!

> 
> gcc/fortran/ChangeLog:
> 
> 	* Make-lang.in: Use grep instead of fgrep.
> ---
>  gcc/fortran/Make-lang.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
> index 1cb47cb1a52..6eb597d0ca0 100644
> --- a/gcc/fortran/Make-lang.in
> +++ b/gcc/fortran/Make-lang.in
> @@ -278,7 +278,7 @@ $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext): doc/gfortran.1 \
>  	-chmod a-x $@
>  
>  fortran.uninstall:
> -	if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
> +	if $(SHELL) -c 'install-info --version | sed 1q | grep -s -v -i debian' >/dev/null 2>&1; then \
>  	  echo " install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info"; \
>  	  install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info || : ; \
>  	else : ; fi; \
  
Thomas Koenig May 10, 2023, 8:02 p.m. UTC | #2
On 10.05.23 21:29, Bernhard Reutner-Fischer via Fortran wrote:
> On Mon, 27 Jun 2022 14:10:36 +0800
> Xi Ruoyao <xry111@xry111.site> 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.
>> Stop using fgrep so we won't see the warning.
>>
>> We can't hard code grep -F here or it may break build on hosts w/o GNU
>> grep.  autoconf documentation contains a warning about this issue and
>> suggest to use AC_PROG_FGREP and $FGREP, but these are too overkill in
>> the specific case: there is no way "debian" could be interpreted as an
>> non-trivial regex, so we can use a plain grep here.
> 
> LGTM but i cannot approve it. I'd say this one is trivial and obvious
> so you could sneak it in under the "obvious" rule..

I concur, this could also have been obvious.

Anyway, OK for trunk, and

> Thanks for the patch!
  
Xi Ruoyao May 11, 2023, 9:01 a.m. UTC | #3
On Wed, 2023-05-10 at 22:02 +0200, Thomas Koenig wrote:
> On 10.05.23 21:29, Bernhard Reutner-Fischer via Fortran wrote:
> > On Mon, 27 Jun 2022 14:10:36 +0800
> > Xi Ruoyao <xry111@xry111.site> 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.
> > > Stop using fgrep so we won't see the warning.
> > > 
> > > We can't hard code grep -F here or it may break build on hosts w/o GNU
> > > grep.  autoconf documentation contains a warning about this issue and
> > > suggest to use AC_PROG_FGREP and $FGREP, but these are too overkill in
> > > the specific case: there is no way "debian" could be interpreted as an
> > > non-trivial regex, so we can use a plain grep here.
> > 
> > LGTM but i cannot approve it. I'd say this one is trivial and obvious
> > so you could sneak it in under the "obvious" rule..
> 
> I concur, this could also have been obvious.
> 
> Anyway, OK for trunk, and
> 
> > Thanks for the patch!

Pushed r14-698, with a commit msg change for the status of grep release.
  

Patch

diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
index 1cb47cb1a52..6eb597d0ca0 100644
--- a/gcc/fortran/Make-lang.in
+++ b/gcc/fortran/Make-lang.in
@@ -278,7 +278,7 @@  $(DESTDIR)$(man1dir)/$(GFORTRAN_INSTALL_NAME)$(man1ext): doc/gfortran.1 \
 	-chmod a-x $@
 
 fortran.uninstall:
-	if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
+	if $(SHELL) -c 'install-info --version | sed 1q | grep -s -v -i debian' >/dev/null 2>&1; then \
 	  echo " install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info"; \
 	  install-info --delete --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/gfortran.info || : ; \
 	else : ; fi; \