]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
share/mk/: Don't pass an escaped # to grep(1)
authorAlejandro Colomar <alx@kernel.org>
Thu, 27 Feb 2025 19:13:34 +0000 (20:13 +0100)
committerAlejandro Colomar <alx@kernel.org>
Thu, 27 Feb 2025 19:13:59 +0000 (20:13 +0100)
We need to escape the # for old versions of make(1).  However, new
versions of grep(1) diagnose if it receives an escaped #.  To keep both
make(1) and grep(1) happy in both their old and new versions, we need to
take advantage of # not being a comment in bash(1) when not preceeded by
a space, and also of \# being translated into # by bash(1).

        alx@debian:~$ echo ''\#
        #
        alx@debian:~$ echo ''#
        #

Fixes: 76f12e3fd3ea (2025-02-10; "share/mk/: Escape '#' in regexes")
Reported-by: Sergei Trofimovich <slyich@gmail.com>
Cc: Florian Weimer <fw@deneb.enyo.de>
Cc: Boris Pigin <boris.pigin@gmail.com>
Suggested-by: Jakub Wilk <jwilk@jwilk.net>
References: <20250227162800.36exbwmqky6d7z4t@jwilk.net>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
share/mk/configure/build-depends/cpp/cpp.mk
share/mk/src/sh.mk

index ef12a848a8c91edc882fac32be484f1f534b3feb..4b2b20baa41aec4249a643f1f7cf62f6c4c3b1f6 100644 (file)
@@ -21,7 +21,7 @@ endif
 CPP_HAS_ALREADY_D_FORTIFY_SOURCE := \
        $(shell \
                $(CPP) -dM - -Wno-error </dev/null \
-               | $(GREP) '\#define _FORTIFY_SOURCE ' >/dev/null \
+               | $(GREP) ''\#'define _FORTIFY_SOURCE ' >/dev/null \
                && $(ECHO) yes \
                || $(ECHO) no; \
        )
index 05c9e0449d8fec1d62e81a0a84f5e9fcafcac8c9..019d5c03b65146329086df335aaabb4c9686fcf9 100644 (file)
@@ -14,7 +14,7 @@ include $(MAKEFILEDIR)/configure/directory_variables/src.mk
 
 
 BIN_sh := $(shell $(FIND) $(SRCBINDIR) -type f \
-               | $(XARGS) $(GREP) -l '^\#!/bin/\(sh\|bash\)\>' \
+               | $(XARGS) $(GREP) -l '^'\#'!/bin/\(sh\|bash\)\>' \
                | $(SORT))