Message ID | 3fe5664607c4e530fbb91048c2e363ddee917250.camel@xry111.site |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 649C9384D155 for <patchwork@sourceware.org>; Fri, 24 Jun 2022 07:07:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 649C9384D155 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1656054427; bh=vX1v4ZOXxZoQRS95yl+pfzRvXXtRGan4QWzcLj5+18A=; h=Subject:To:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=gRfgL+cUJpNKmtrQc03r7OnATAD3QggrLo2TbFla7lnchUemjjf2OhmCuyzHnVyo8 c5vZV5xJWy4tARxEu5cgrejNcRmtUnhft3A7w8+pk/lHNYkiNM4UoXRQwf67OcAMYV NHH1bmz4sIRSNAfsDqdjdZxWMOLUq58D/RuTtk/A= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id 58B3E384D15A for <gcc-patches@gcc.gnu.org>; Fri, 24 Jun 2022 07:06:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 58B3E384D15A Received: from localhost.localdomain (xry111.site [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 450EF66928 for <gcc-patches@gcc.gnu.org>; Fri, 24 Jun 2022 03:06:35 -0400 (EDT) Message-ID: <3fe5664607c4e530fbb91048c2e363ddee917250.camel@xry111.site> Subject: [PATCH 6/8] fortran: use grep -F instead of fgrep To: gcc-patches@gcc.gnu.org Date: Fri, 24 Jun 2022 15:06:32 +0800 In-Reply-To: <74ea0c62ebe19db186263053e4051f81d46e9da4.camel@xry111.site> References: <74ea0c62ebe19db186263053e4051f81d46e9da4.camel@xry111.site> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.2 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FROM_SUSPICIOUS_NTLD, GIT_PATCH_0, LIKELY_SPAM_FROM, PDS_OTHER_BAD_TLD, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Xi Ruoyao via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Xi Ruoyao <xry111@xry111.site> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
Stop using obsoleted egrep/fgrep
|
|
Commit Message
Xi Ruoyao
June 24, 2022, 7:06 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. gcc/ChangeLog: * fortran/Make-lang.in: Use grep -F instead of fgrep. --- gcc/fortran/Make-lang.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Fri, 24 Jun 2022 15:06:32 +0800 Xi Ruoyao via Gcc-patches <gcc-patches@gcc.gnu.org> 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. > > gcc/ChangeLog: > > * fortran/Make-lang.in: Use grep -F 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..51279b03aad 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 -F -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; \ I'd replace -s >/dev/null 2>&1 with -q while at it. But why is -F used here in the first place? I do not see much in debian that can be interpreted as a regex? thanks,
On Fri, 2022-06-24 at 13:13 +0200, Bernhard Reutner-Fischer wrote: > > - 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 -F -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; \ > > I'd replace -s >/dev/null 2>&1 with -q while at it. > > But why is -F used here in the first place? > I do not see much in debian that can be interpreted as a regex? I'm not sure. It was there since 2004. Perhaps the author thinks fgrep may save several CPU cycles :). I'll just use a plain grep in PATCH v2. Rainer: do you have some idea about the availability of "-q" on different hosts? If you agree I'll use it instead of -s > /dev/null too.
Hi Xi, > On Fri, 2022-06-24 at 13:13 +0200, Bernhard Reutner-Fischer wrote: > >> > - 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 -F -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; \ >> >> I'd replace -s >/dev/null 2>&1 with -q while at it. >> >> But why is -F used here in the first place? >> I do not see much in debian that can be interpreted as a regex? > > I'm not sure. It was there since 2004. Perhaps the author thinks fgrep > may save several CPU cycles :). I'll just use a plain grep in PATCH v2. > > Rainer: do you have some idea about the availability of "-q" on > different hosts? If you agree I'll use it instead of -s > /dev/null > too. again, the autoconf manual warns agains it, even more so against -s. That's the first reference for portability issues and shouldn't be ignored without good reason. In the GCC and Solaris context, /bin/grep supports both -q and -s in Solaris 11.3 and 11.4. It doesn't support -q on Solaris 10, though (again, no longer relevant for GCC). Rainer
Hi, > On Fri, 2022-06-24 at 13:13 +0200, Bernhard Reutner-Fischer wrote: > >>> - 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 -F -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; \ >> >> I'd replace -s >/dev/null 2>&1 with -q while at it. >> >> But why is -F used here in the first place? >> I do not see much in debian that can be interpreted as a regex? > > I'm not sure. It was there since 2004. Perhaps the author thinks fgrep > may save several CPU cycles :). I'll just use a plain grep in PATCH v2. > > Rainer: do you have some idea about the availability of "-q" on > different hosts? If you agree I'll use it instead of -s > /dev/null > too. Is there any particular reason why we should not use the result of AC_PROG_FGREP ? AC_PROG_GREP should also work.
On 24 June 2022 14:35:20 CEST, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote: >Hi Xi, > >> On Fri, 2022-06-24 at 13:13 +0200, Bernhard Reutner-Fischer wrote: >> >>> > - 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 -F -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; \ >>> >>> I'd replace -s >/dev/null 2>&1 with -q while at it. >>> >>> But why is -F used here in the first place? >>> I do not see much in debian that can be interpreted as a regex? >> >> I'm not sure. It was there since 2004. Perhaps the author thinks fgrep >> may save several CPU cycles :). I'll just use a plain grep in PATCH v2. >> >> Rainer: do you have some idea about the availability of "-q" on >> different hosts? If you agree I'll use it instead of -s > /dev/null >> too. > >again, the autoconf manual warns agains it, even more so against -s. >That's the first reference for portability issues and shouldn't be >ignored without good reason. > >In the GCC and Solaris context, /bin/grep supports both -q and -s in >Solaris 11.3 and 11.4. It doesn't support -q on Solaris 10, though >(again, no longer relevant for GCC). The good reason I would bring forward is that the systems mentioned in the autoconf docs are all not supported anymore (IRIX, ancient or old Solaris etc). Furthermore, grep(1) is required by POSIX to support -q since at least 1997; see https://pubs.opengroup.org/onlinepubs/007908799/xcu/grep.html That's about 25 years now, so everybody had plenty of time to implement this specific part, which is even trivial to implement for this particular case of grep -q. All in all i think that we should not be held hostage by such systems any longer, at least for such cases that are trivial to fix to conformance. Of course that may be just /me. Iff fixing egrep or fgrep occurrences though, we should use plain grep where applicable, like in this case, IMO. thanks,
diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in index 1cb47cb1a52..51279b03aad 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 -F -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; \