From: Sergei Trofimovich <slyich@gmail.com>
To: Alejandro Colomar <alx@kernel.org>
Cc: linux-man@vger.kernel.org, Boris Pigin <boris.pigin@gmail.com>
Subject: Re: [PATCH] mk: don't escape '#' for `grep`
Date: Thu, 27 Feb 2025 11:23:54 +0000 [thread overview]
Message-ID: <Z8BLSuhHpNxGgg0y@nz.home> (raw)
In-Reply-To: <5s43rvskakybdll44oj5d5x7xmxjhlindgdokxyjqzqtgkipxl@hbfuwiyish4r>
On Thu, Feb 27, 2025 at 11:23:46AM +0100, Alejandro Colomar wrote:
> Hi Sergei,
>
> I'm CCing Boris, since he had the opposite problem, which triggered
> adding the stray '\'.
>
> On Thu, Feb 27, 2025 at 09:21:42AM +0000, Sergei Trofimovich wrote:
> > Without the change build process complains
> >
> > $ LANG=C make -R help
> > grep: warning: stray \ before #
> > grep: warning: stray \ before #
>
> I can't reproduce. What's your version of grep(1) and your version of
> make(1)?
>
> alx@debian:~/src/linux/man-pages/man-pages/contrib$ make -R help
> make: warning: undefined variable 'GNUMAKEFLAGS'
> To see a list of targets, run:
> $ make -R -p nothing \
> | grep '^\.PHONY:' \
> | tr ' ' '\n' \
> | grep -v '^\.PHONY:' \
> | sort;
>
> To see a list of variables, run:
> $ find GNUmakefile share/mk/configure -type f \
> | sort \
> | xargs grep '^[^[:space:]].*?=' \
> | sed 's/=.*/=/';
>
> To see a list of dependencies (package/program), run:
> $ find share/mk/configure/build-depends -type f \
> | sed 's,share/mk/configure/build-depends/,,' \
> | sed 's,\.mk,,' \
> | sort;
>
> alx@debian:~/src/linux/man-pages/man-pages/contrib$ LANG=C make -R help
> make: warning: undefined variable 'GNUMAKEFLAGS'
> To see a list of targets, run:
> $ make -R -p nothing \
> | grep '^\.PHONY:' \
> | tr ' ' '\n' \
> | grep -v '^\.PHONY:' \
> | sort;
>
> To see a list of variables, run:
> $ find GNUmakefile share/mk/configure -type f \
> | sort \
> | xargs grep '^[^[:space:]].*?=' \
> | sed 's/=.*/=/';
>
> To see a list of dependencies (package/program), run:
> $ find share/mk/configure/build-depends -type f \
> | sed 's,share/mk/configure/build-depends/,,' \
> | sed 's,\.mk,,' \
> | sort;
>
> alx@debian:~/src/linux/man-pages/man-pages/contrib$ make --version
> GNU Make 4.4.1
> Built for x86_64-pc-linux-gnu
> Copyright (C) 1988-2023 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> alx@debian:~/src/linux/man-pages/man-pages/contrib$ grep --version
> grep (GNU grep) 3.11
> Copyright (C) 2023 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
>
> Written by Mike Haertel and others; see
> <https://git.savannah.gnu.org/cgit/grep.git/tree/AUTHORS>.
>
> grep -P uses PCRE2 10.45 2025-02-05
>
Aha, I wonder if it's also related to the escaping behaviour of `sh` and `bash.
Here are my tool versions:
$ make --version
GNU Make 4.4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ grep --version
grep (GNU grep) 3.11
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and others; see
<https://git.savannah.gnu.org/cgit/grep.git/tree/AUTHORS>.
grep -P uses PCRE2 10.44 2024-06-07
$ sh --version
GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ bash --version
GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
> > Signed-off-by: Sergei Trofimovich <slyich@gmail.com>
>
> Please add a tag mentioning that it reverts a certain commit:
>
> Fixes: 76f12e3fd3ea (2025-02-10; "share/mk/: Escape '#' in regexes")
>
>
> Have a lovely day!
> Alex
>
> > ---
> > share/mk/configure/build-depends/cpp/cpp.mk | 2 +-
> > share/mk/src/sh.mk | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/share/mk/configure/build-depends/cpp/cpp.mk b/share/mk/configure/build-depends/cpp/cpp.mk
> > index ef12a848a..8a4ccc442 100644
> > --- a/share/mk/configure/build-depends/cpp/cpp.mk
> > +++ b/share/mk/configure/build-depends/cpp/cpp.mk
> > @@ -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; \
> > )
> > diff --git a/share/mk/src/sh.mk b/share/mk/src/sh.mk
> > index 05c9e0449..487eaf14d 100644
> > --- a/share/mk/src/sh.mk
> > +++ b/share/mk/src/sh.mk
> > @@ -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))
> >
> >
> > --
> > 2.48.1
> >
>
> --
> <https://www.alejandro-colomar.es/>
--
Sergei
next prev parent reply other threads:[~2025-02-27 11:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 9:21 [PATCH] mk: don't escape '#' for `grep` Sergei Trofimovich
2025-02-27 10:23 ` Alejandro Colomar
2025-02-27 11:23 ` Sergei Trofimovich [this message]
2025-02-27 12:28 ` Alejandro Colomar
2025-02-27 14:43 ` Florian Weimer
2025-02-27 15:20 ` Alejandro Colomar
2025-02-27 16:28 ` Jakub Wilk
2025-02-27 19:00 ` Alejandro Colomar
2025-02-27 19:30 ` Alejandro Colomar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z8BLSuhHpNxGgg0y@nz.home \
--to=slyich@gmail.com \
--cc=alx@kernel.org \
--cc=boris.pigin@gmail.com \
--cc=linux-man@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox