Bruno Haible <br...@clisp.org> writes: > Hi Simon, > >> + @if ! indent --version 2> /dev/null | grep -q 'GNU indent'; then\ > > As mentioned in the Autoconf manual [1], the grep option '-q' is not portable. > E.g. on Solaris 10: > > $ echo | grep -q x > grep: illegal option -- q > Usage: grep -hblcnsviw pattern file . . . > > The portable alternative is > grep 'GNU indent' > /dev/null
Thank you! I installed these two fixes, which caught the unportable usages in scripts for some packages. /Simon
From 4555e788613f1f5d1e8519427591bef3274d3124 Mon Sep 17 00:00:00 2001 From: Simon Josefsson <si...@josefsson.org> Date: Tue, 1 Nov 2022 09:06:56 +0100 Subject: [PATCH 1/2] maintainer-makefile: Add syntax-check rule for unportable 'grep -q'. * top/maint.mk (sc_unportable_grep_q): Add. --- top/maint.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/top/maint.mk b/top/maint.mk index 045609c285..85b15fb2d2 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -1373,6 +1373,10 @@ sc_vulnerable_makefile_CVE-2012-3386: ' see https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2012-3386 for details') \ $(_sc_search_regexp) +sc_unportable_grep_q: + @prohibit='grep -q' halt="unportable 'grep -q', use >/dev/null instead" \ + $(_sc_search_regexp) + vc-diff-check: $(AM_V_GEN)(unset CDPATH; cd $(srcdir) && $(VC) diff) > vc-diffs || : $(AM_V_at)if test -s vc-diffs; then \ -- 2.30.2
From 757160ccb0fb5d86d09e415eb52ffa9a3a85be5b Mon Sep 17 00:00:00 2001 From: Simon Josefsson <si...@josefsson.org> Date: Tue, 1 Nov 2022 09:09:02 +0100 Subject: [PATCH 2/2] maintainer-makefile: Fix last sc_indent commit. * top/maint.mk (sc_indent): Don't use grep -q. Suggested by Bruno Haible. --- top/maint.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/top/maint.mk b/top/maint.mk index 85b15fb2d2..0b42438b2c 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -1663,7 +1663,7 @@ indent: # Running indent once is not idempotent, but running it twice is. indent $(indent_args) $(INDENT_SOURCES) sc_indent: - @if ! indent --version 2> /dev/null | grep -q 'GNU indent'; then\ + @if ! indent --version 2> /dev/null | grep 'GNU indent' > /dev/null; then \ echo 1>&2 '$(ME): sc_indent: GNU indent is missing'; \ else \ fail=0; files="$(INDENT_SOURCES)"; \ -- 2.30.2
signature.asc
Description: PGP signature