bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] maintainer-makefile: Fix Apple Xcode 'make syntax-check'.


From: Bruno Haible
Subject: Re: [PATCH] maintainer-makefile: Fix Apple Xcode 'make syntax-check'.
Date: Tue, 15 Nov 2022 15:44:48 +0100

Pádraig Brady wrote:
>  > +sc_unportable_grep_q:
>  > +  @prohibit='grep -q' halt="unportable 'grep -q', use >/dev/null instead" 
> \
>  > +    $(_sc_search_regexp)
>  > +
> 
> Note the above isn't equivalent as -q will exit early upon first match
> (as defined by POSIX)

In most of the cases, the difference won't matter. Namely, most often 'grep'
consumes stdin and no other options than the pattern are given.

The Autoconf manual says the same thing:
  "Don’t use ‘grep -q’ to suppress output, because traditional grep
   implementations (e.g., Solaris) do not support -q. ... Instead,
   redirect the standard output and standard error (in case the file
   doesn’t exist) of grep to /dev/null."

Neither the wording in GNUmakefile nor the one in the Autoconf manual
claim that the two are *equivalent* in the strict sense; they only tell to
use instead of the other (... and leave it to the user to think through
the consequences and test the change).

Bruno

[1] 
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.71/html_node/Limitations-of-Usual-Tools.html






reply via email to

[Prev in Thread] Current Thread [Next in Thread]