Re: [PATCH] mk: don't escape '#' for `grep`

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

 



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@xxxxxxxxx>
> 
> 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




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux