Re: man-page-6.10 make share/mk/src/sh.mk:16: *** unterminated call to function 'shell': missing ')'

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

 



Hi Boris,

On Mon, Feb 10, 2025 at 09:56:40AM +0100, Boris Pigin wrote:
> Hi Alex,
> 
> as my email was rejected by the mailing list due to containing HTML part
> here is the second try.

[...]

>  ╭─ 🐺 borisp@blacksun  bash 5.2.37  🕑09:50:38  🖿 ~/test/man-pages-6.10 🧬
> 📦 🐾14
>  ╰ $ make -version
> GNU Make 4.2.1
> Built for x86_64-pc-linux-gnu
> Copyright (C) 1988-2016 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.

This seems to be the problem.  I hadn't used such an old version of
make(1) in a long time.  I've been able to reproduce the problem in a
Docker container with Debian Buster.

	root@b3cfb66d7016:/# wget https://kernel.org/pub/linux/docs/man-pages/man-pages-6.10.tar.gz >/dev/null 2>&1
	root@b3cfb66d7016:/# ls
	bin   dev  home  lib64			media  opt   root  sbin  sys  usr
	boot  etc  lib	 man-pages-6.10.tar.gz	mnt    proc  run   srv	 tmp  var
	root@b3cfb66d7016:/# tar xf man-pages-6.10.tar.gz 
	root@b3cfb66d7016:/# rm man-pages-6.10.tar.gz 
	root@b3cfb66d7016:/# ls
	bin   dev  home  lib64		 media	opt   root  sbin  sys  usr
	boot  etc  lib	 man-pages-6.10  mnt	proc  run   srv   tmp  var
	root@b3cfb66d7016:/# cd man-pages-6.10/
	root@b3cfb66d7016:/man-pages-6.10# make | wc -l; echo $?
	/man-pages-6.10/share/mk/src/sh.mk:16: *** unterminated call to function 'shell': missing ')'.  Stop.
	0
	0
	root@b3cfb66d7016:/man-pages-6.10# cat /etc/os-release 
	PRETTY_NAME="Debian GNU/Linux 10 (buster)"
	NAME="Debian GNU/Linux"
	VERSION_ID="10"
	VERSION="10 (buster)"
	VERSION_CODENAME=buster
	ID=debian
	HOME_URL="https://www.debian.org/";
	SUPPORT_URL="https://www.debian.org/support";
	BUG_REPORT_URL="https://bugs.debian.org/";
	root@b3cfb66d7016:/man-pages-6.10# make -v
	GNU Make 4.2.1
	Built for x86_64-pc-linux-gnu
	Copyright (C) 1988-2016 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.

It seems to be a make(1) bug?  (Or maybe a simpler, older
specification.)  It is caused by the '#' in the string.  make(1)
probably interprets it as the start of a comment.

The problem also triggers in another place:

	CPP_HAS_ALREADY_D_FORTIFY_SOURCE := \
		$(shell \
			$(CPP) -dM - -Wno-error </dev/null \
			| $(GREP) '#define _FORTIFY_SOURCE ' >/dev/null \
			&& $(ECHO) yes \
			|| $(ECHO) no; \
		)

It's surprising that I haven't triggered issues with old make(1) before.
I have now tried 6.9.1 there, and it works (I see some pages reporting
issues, but the makefile does work).

I've pushed a fix to the contrib branch, and will try to make a new
release in a few days.
<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=a0d5f1961dfd8eb3af2b0ece845448a42c492ae0>

	commit a0d5f1961dfd8eb3af2b0ece845448a42c492ae0 (HEAD -> contrib, alx/contrib)
	Author: Alejandro Colomar <alx@xxxxxxxxxx>
	Date:   Mon Feb 10 11:56:01 2025 +0100

	    share/mk/: Escape '#' in regexes
	    
	    GNU make(1) 4.2 seems to be interpreting those characters as the start
	    of a comment, so we need to escape them.  That seems to calm those old
	    versions of make(1), and doesn't affect negatively the newer ones, and
	    doesn't negatively affect grep(1) either.
	    
	    Fixes: 35a780a99bd8 (2024-07-20; "share/mk/: CPPFLAGS: Only define _FORTIFY_SOURCE if it's not already defined")
	    Fixes: 2130162900ab (2024-11-03; "share/mk/, etc/shellcheck/: lint-sh: Add target to lint shell scripts")
	    Reported-by: Boris Pigin <boris.pigin@xxxxxxxxx>
	    Cc: Sam James <sam@xxxxxxxxxx>
	    Signed-off-by: Alejandro Colomar <alx@xxxxxxxxxx>

	diff --git a/share/mk/configure/build-depends/cpp/cpp.mk b/share/mk/configure/build-depends/cpp/cpp.mk
	index 594215892..65da77f84 100644
	--- a/share/mk/configure/build-depends/cpp/cpp.mk
	+++ b/share/mk/configure/build-depends/cpp/cpp.mk
	@@ -19,7 +19,7 @@ CPP ?= $(CC) $(CFLAGS_) -E
	 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 487eaf14d..05c9e0449 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))
	 

Thanks for the report!


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature


[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