bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* maintainer-makefile: catch uses of $< in non-implicit rules
@ 2019-05-18  7:44 Akim Demaille
  2019-05-18  7:52 ` Paul Eggert
  0 siblings, 1 reply; 24+ messages in thread
From: Akim Demaille @ 2019-05-18  7:44 UTC (permalink / raw)
  To: Gnulib bugs

Bruno made a bug report some time ago: make check failed for Bison on Solaris. The problem was the use of $< in some non-implicit rules.  This syntax-check caught them.

See
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00009.html
and
https://lists.gnu.org/archive/html/bison-patches/2019-05/msg00017.html

Ok to install?

commit e8a5869f2936459762cc48ab370c35b69f86d5e0
Author: Akim Demaille <akim.demaille@gmail.com>
Date:   Sat May 18 08:46:00 2019 +0200

    maintainer-makefile: catch uses of $< in non-implicit rules
    
    * top/maint.mk (sc_prohibit_magic_number_exit): New.

diff --git a/ChangeLog b/ChangeLog
index 1918041f0..8d5a4ca6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-05-18  Akim Demaille  <akim@lrde.epita.fr>
+
+	maintainer-makefile: catch uses of $< in non-implicit rules
+	* top/maint.mk (sc_prohibit_magic_number_exit): New.
+
 2019-05-14  Paul Eggert  <eggert@cs.ucla.edu>
 
 	close-stream, closein, closeout: simplify
diff --git a/top/maint.mk b/top/maint.mk
index e9d5ee7d4..05ee7661c 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -408,6 +408,41 @@ sc_prohibit_magic_number_exit:
 	halt='use EXIT_* values rather than magic number'		\
 	  $(_sc_search_regexp)
 
+# Check that we don't use $< in non-implicit Makefile rules.
+#
+# To find the Makefiles, trace AC_CONFIG_FILES.  Using VC_LIST would
+# miss the Makefiles that are not under VC control (e.g., symlinks
+# installed for gettext).  "Parsing" (recursive) uses of SUBDIRS seems
+# too delicate.
+#
+# Use GNU Make's --print-data-base to normalize the rules into some
+# easy to parse format: they are separated by two \n.  Look for the
+# "section" about non-pattern rules (marked with "# Files") inside
+# which there are still the POSIX Make like implicit rules (".c.o").
+sc_prohibit_gnu_make_extensions_awk_ =					\
+  BEGIN {								\
+      RS = "\n\n";							\
+      in_rules = 0;							\
+  };									\
+  /^\# Files/ {								\
+      in_rules = 1;							\
+  };									\
+  /\$$</ && in_rules && $$0 !~ /^(.*\n)*\.\w+(\.\w+)?:/ {		\
+      print "Error: " file ": $$< in a non implicit rule\n" $$0;	\
+      status = 1;							\
+  }									\
+  END {									\
+     exit status							\
+  }
+sc_prohibit_gnu_make_extensions:
+	(cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') |	\
+	  tr ' ' '\n' |							\
+	  $(SED) -ne '/Makefile/{s/\.in$$//;p;}' |			\
+	  while read m; do						\
+	    $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null |		\
+	      awk -v file=$$m -e '$($@_awk_)' || exit 1;		\
+	  done
+
 # Using EXIT_SUCCESS as the first argument to error is misleading,
 # since when that parameter is 0, error does not exit.  Use '0' instead.
 sc_error_exit_success:



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-05-18  7:44 maintainer-makefile: catch uses of $< in non-implicit rules Akim Demaille
@ 2019-05-18  7:52 ` Paul Eggert
  2019-05-18  9:51   ` Akim Demaille
  0 siblings, 1 reply; 24+ messages in thread
From: Paul Eggert @ 2019-05-18  7:52 UTC (permalink / raw)
  To: Akim Demaille, Gnulib bugs

Akim Demaille wrote:
> +  };									\

Thanks, that looks good except I don't see why some of the lines like the above 
have semicolons while others don't.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-05-18  7:52 ` Paul Eggert
@ 2019-05-18  9:51   ` Akim Demaille
  2019-05-18 18:21     ` Paul Eggert
  2019-07-19  7:30     ` Bernhard Voelker
  0 siblings, 2 replies; 24+ messages in thread
From: Akim Demaille @ 2019-05-18  9:51 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Gnulib bugs

Hi Paul!

> Le 18 mai 2019 à 09:52, Paul Eggert <eggert@cs.ucla.edu> a écrit :
> 
> Akim Demaille wrote:
>> +  };									\
> 
> Thanks, that looks good except I don't see why some of the lines like the above have semicolons while others don't.

You're right, more consistency wouldn't hurt.  Because everything ends in a single line, some of them are needed (separators of statements of compound statements), others aren't.

How about this?

commit 2e801e81bb362429d0e252d076233bfdac20e367
Author: Akim Demaille <akim.demaille@gmail.com>
Date:   Sat May 18 08:46:00 2019 +0200

    maintainer-makefile: catch uses of $< in non-implicit rules
    
    * top/maint.mk (sc_prohibit_magic_number_exit): New.

diff --git a/ChangeLog b/ChangeLog
index 1918041f0..8d5a4ca6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-05-18  Akim Demaille  <akim@lrde.epita.fr>
+
+	maintainer-makefile: catch uses of $< in non-implicit rules
+	* top/maint.mk (sc_prohibit_magic_number_exit): New.
+
 2019-05-14  Paul Eggert  <eggert@cs.ucla.edu>
 
 	close-stream, closein, closeout: simplify
diff --git a/top/maint.mk b/top/maint.mk
index e9d5ee7d4..3dbe9c378 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -408,6 +408,41 @@ sc_prohibit_magic_number_exit:
 	halt='use EXIT_* values rather than magic number'		\
 	  $(_sc_search_regexp)
 
+# Check that we don't use $< in non-implicit Makefile rules.
+#
+# To find the Makefiles, trace AC_CONFIG_FILES.  Using VC_LIST would
+# miss the Makefiles that are not under VC control (e.g., symlinks
+# installed for gettext).  "Parsing" (recursive) uses of SUBDIRS seems
+# too delicate.
+#
+# Use GNU Make's --print-data-base to normalize the rules into some
+# easy to parse format: they are separated by two \n.  Look for the
+# "section" about non-pattern rules (marked with "# Files") inside
+# which there are still the POSIX Make like implicit rules (".c.o").
+sc_prohibit_gnu_make_extensions_awk_ =					\
+  BEGIN {								\
+      RS = "\n\n";							\
+      in_rules = 0;							\
+  }									\
+  /^\# Files/ {								\
+      in_rules = 1;							\
+  }									\
+  /\$$</ && in_rules && $$0 !~ /^(.*\n)*\.\w+(\.\w+)?:/ {		\
+      print "Error: " file ": $$< in a non implicit rule\n" $$0;	\
+      status = 1;							\
+  }									\
+  END {									\
+     exit status;							\
+  }
+sc_prohibit_gnu_make_extensions:
+	(cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') |	\
+	  tr ' ' '\n' |							\
+	  $(SED) -ne '/Makefile/{s/\.in$$//;p;}' |			\
+	  while read m; do						\
+	    $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null |		\
+	      awk -v file=$$m -e '$($@_awk_)' || exit 1;		\
+	  done
+
 # Using EXIT_SUCCESS as the first argument to error is misleading,
 # since when that parameter is 0, error does not exit.  Use '0' instead.
 sc_error_exit_success:



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-05-18  9:51   ` Akim Demaille
@ 2019-05-18 18:21     ` Paul Eggert
  2019-05-19  5:42       ` Akim Demaille
  2019-07-19  7:30     ` Bernhard Voelker
  1 sibling, 1 reply; 24+ messages in thread
From: Paul Eggert @ 2019-05-18 18:21 UTC (permalink / raw)
  To: Akim Demaille; +Cc: Gnulib bugs

Akim Demaille wrote:

> How about this?

Looks OK to me; thanks.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-05-18 18:21     ` Paul Eggert
@ 2019-05-19  5:42       ` Akim Demaille
  2019-06-17  9:57         ` Tim Rühsen
  0 siblings, 1 reply; 24+ messages in thread
From: Akim Demaille @ 2019-05-19  5:42 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Gnulib bugs


> Le 18 mai 2019 à 20:21, Paul Eggert <eggert@cs.ucla.edu> a écrit :
> 
> Akim Demaille wrote:
> 
>> How about this?
> 
> Looks OK to me; thanks.

Installed.  Thanks!

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-05-19  5:42       ` Akim Demaille
@ 2019-06-17  9:57         ` Tim Rühsen
  2019-06-17  9:59           ` Akim Demaille
  0 siblings, 1 reply; 24+ messages in thread
From: Tim Rühsen @ 2019-06-17  9:57 UTC (permalink / raw)
  To: Akim Demaille, Paul Eggert; +Cc: Gnulib bugs


[-- Attachment #1.1: Type: text/plain, Size: 727 bytes --]

Hi Akim,

On 5/19/19 7:42 AM, Akim Demaille wrote:
> 
>> Le 18 mai 2019 à 20:21, Paul Eggert <eggert@cs.ucla.edu> a écrit :
>>
>> Akim Demaille wrote:
>>
>>> How about this?
>>
>> Looks OK to me; thanks.
> 
> Installed.  Thanks!
> 

The patch uses awk -e which is understood only by GNU awk. This breaks
all Debian CI tests here since Debian installs 'mawk' by default (I
wasn't aware of that before).

It's not a big deal to install package 'gawk' everywhere, but I just
wanted to mention it. I can see no warning/hint in any of the patch's
comments.
Hmmm, this also implies documenting a new dependency in all projects
that use gnulib or disabling sc_prohibit_gnu_make_extensions.

Regards, Tim


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-06-17  9:57         ` Tim Rühsen
@ 2019-06-17  9:59           ` Akim Demaille
  2019-06-17 10:04             ` Tim Rühsen
  0 siblings, 1 reply; 24+ messages in thread
From: Akim Demaille @ 2019-06-17  9:59 UTC (permalink / raw)
  To: Tim Rühsen; +Cc: Paul Eggert, Gnulib bugs

Hi Tim,

> Le 17 juin 2019 à 11:57, Tim Rühsen <tim.ruehsen@gmx.de> a écrit :
> 
> Hi Akim,
> 
> The patch uses awk -e which is understood only by GNU awk. This breaks
> all Debian CI tests here since Debian installs 'mawk' by default (I
> wasn't aware of that before).
> 
> It's not a big deal to install package 'gawk' everywhere, but I just
> wanted to mention it. I can see no warning/hint in any of the patch's
> comments.

That was not my intention.

I expect that maintainers have gawk installed, so I think this check
should be skipped if awk is not gawk.  WDYT?



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-06-17  9:59           ` Akim Demaille
@ 2019-06-17 10:04             ` Tim Rühsen
  2019-06-22 15:53               ` Akim Demaille
  0 siblings, 1 reply; 24+ messages in thread
From: Tim Rühsen @ 2019-06-17 10:04 UTC (permalink / raw)
  To: Akim Demaille; +Cc: Paul Eggert, Gnulib bugs


[-- Attachment #1.1: Type: text/plain, Size: 723 bytes --]

Hi Akim,

On 6/17/19 11:59 AM, Akim Demaille wrote:
> Hi Tim,
> 
>> Le 17 juin 2019 à 11:57, Tim Rühsen <tim.ruehsen@gmx.de> a écrit :
>>
>> Hi Akim,
>>
>> The patch uses awk -e which is understood only by GNU awk. This breaks
>> all Debian CI tests here since Debian installs 'mawk' by default (I
>> wasn't aware of that before).
>>
>> It's not a big deal to install package 'gawk' everywhere, but I just
>> wanted to mention it. I can see no warning/hint in any of the patch's
>> comments.
> 
> That was not my intention.
> 
> I expect that maintainers have gawk installed, so I think this check
> should be skipped if awk is not gawk.  WDYT?

Thanks, sounds reasonable to me.

Regards, Tim


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-06-17 10:04             ` Tim Rühsen
@ 2019-06-22 15:53               ` Akim Demaille
  2019-06-24  9:42                 ` Tim Rühsen
  0 siblings, 1 reply; 24+ messages in thread
From: Akim Demaille @ 2019-06-22 15:53 UTC (permalink / raw)
  To: Tim Rühsen; +Cc: Paul Eggert, Gnulib bugs

Hi Tim,

> Le 17 juin 2019 à 12:04, Tim Rühsen <tim.ruehsen@gmx.de> a écrit :
> 
> Hi Akim,
> 
> On 6/17/19 11:59 AM, Akim Demaille wrote:
>> Hi Tim,
>> 
>>> Le 17 juin 2019 à 11:57, Tim Rühsen <tim.ruehsen@gmx.de> a écrit :
>>> 
>>> Hi Akim,
>>> 
>>> The patch uses awk -e which is understood only by GNU awk. This breaks
>>> all Debian CI tests here since Debian installs 'mawk' by default (I
>>> wasn't aware of that before).
>>> 
>>> It's not a big deal to install package 'gawk' everywhere, but I just
>>> wanted to mention it. I can see no warning/hint in any of the patch's
>>> comments.
>> 
>> That was not my intention.
>> 
>> I expect that maintainers have gawk installed, so I think this check
>> should be skipped if awk is not gawk.  WDYT?
> 
> Thanks, sounds reasonable to me.

Here is my proposal.  Worked properly with the non GNU awk sitting on my machine.

commit b70c97f3ecf45a5c98b7f32189c1a4ae72a60788
Author: Akim Demaille <akim.demaille@gmail.com>
Date:   Sat Jun 22 17:52:16 2019 +0200

    maintainer-makefile: restore portability to non-GNU awks
    
    Reported by Tim Rühsen.
    * top/maint.mk (AWK): New variable.  Use it.
    (sc_prohibit_gnu_make_extensions): Skip if $(AWK) is not gawk.

diff --git a/ChangeLog b/ChangeLog
index cdc2b3d7a..dc7e52c0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2019-06-22  Akim Demaille  <akim@lrde.epita.fr>
+
+	maintainer-makefile: restore portability to non-GNU awks
+	Reported by Tim Rühsen.
+	* top/maint.mk (AWK): New variable.  Use it.
+	(sc_prohibit_gnu_make_extensions): Skip if $(AWK) is not gawk.
+
 2019-06-22  Akim Demaille  <akim@lrde.epita.fr>
 
 	argmatch: put all the docs member last.
diff --git a/top/maint.mk b/top/maint.mk
index 3dbe9c378..16e936022 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -24,6 +24,7 @@ ME := maint.mk
 # These variables ought to be defined through the configure.ac section
 # of the module description. But some packages import this file directly,
 # ignoring the module description.
+AWK ?= awk
 GREP ?= grep
 SED ?= sed
 
@@ -190,7 +191,7 @@ $(sc_z_rules_): %.z: %
 	@end=$$(date +%s.%N);						\
 	start=$$(cat .sc-start-$*);					\
 	rm -f .sc-start-$*;						\
-	awk -v s=$$start -v e=$$end					\
+	$(AWK) -v s=$$start -v e=$$end					\
 	  'END {printf "%.2f $(patsubst sc_%,%,$*)\n", e - s}' < /dev/null
 
 # The patsubst here is to replace each sc_% rule with its sc_%.z wrapper
@@ -435,13 +436,15 @@ sc_prohibit_gnu_make_extensions_awk_ =					\
      exit status;							\
   }
 sc_prohibit_gnu_make_extensions:
-	(cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') |	\
-	  tr ' ' '\n' |							\
-	  $(SED) -ne '/Makefile/{s/\.in$$//;p;}' |			\
-	  while read m; do						\
-	    $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null |		\
-	      awk -v file=$$m -e '$($@_awk_)' || exit 1;		\
-	  done
+	@if $(AWK) --version | grep GNU >/dev/null 2>&1; then		\
+	  (cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') |	\
+	    tr ' ' '\n' |						\
+	    $(SED) -ne '/Makefile/{s/\.in$$//;p;}' |			\
+	    while read m; do						\
+	      $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null |		\
+	        $(AWK) -v file=$$m -e '$($@_awk_)' || exit 1;		\
+	    done;							\
+	fi
 
 # Using EXIT_SUCCESS as the first argument to error is misleading,
 # since when that parameter is 0, error does not exit.  Use '0' instead.
@@ -1383,7 +1386,7 @@ gpg_key_ID ?=								\
   $$(cd $(srcdir)							\
      && git cat-file tag v$(VERSION)					\
         | $(gpgv) --status-fd 1 --keyring /dev/null - - 2>/dev/null	\
-        | awk '/^\[GNUPG:\] ERRSIG / {print $$3; exit}')
+        | $(AWK) '/^\[GNUPG:\] ERRSIG / {print $$3; exit}')
 
 translation_project_ ?= coordinator@translationproject.org
 



^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-06-22 15:53               ` Akim Demaille
@ 2019-06-24  9:42                 ` Tim Rühsen
  2019-06-24 15:56                   ` Akim Demaille
  0 siblings, 1 reply; 24+ messages in thread
From: Tim Rühsen @ 2019-06-24  9:42 UTC (permalink / raw)
  To: Akim Demaille; +Cc: Paul Eggert, Gnulib bugs


[-- Attachment #1.1: Type: text/plain, Size: 4431 bytes --]

Hi Akim,

On 6/22/19 5:53 PM, Akim Demaille wrote:
> Hi Tim,
> 
>> Le 17 juin 2019 à 12:04, Tim Rühsen <tim.ruehsen@gmx.de> a écrit :
>>
>> Hi Akim,
>>
>> On 6/17/19 11:59 AM, Akim Demaille wrote:
>>> Hi Tim,
>>>
>>>> Le 17 juin 2019 à 11:57, Tim Rühsen <tim.ruehsen@gmx.de> a écrit :
>>>>
>>>> Hi Akim,
>>>>
>>>> The patch uses awk -e which is understood only by GNU awk. This breaks
>>>> all Debian CI tests here since Debian installs 'mawk' by default (I
>>>> wasn't aware of that before).
>>>>
>>>> It's not a big deal to install package 'gawk' everywhere, but I just
>>>> wanted to mention it. I can see no warning/hint in any of the patch's
>>>> comments.
>>>
>>> That was not my intention.
>>>
>>> I expect that maintainers have gawk installed, so I think this check
>>> should be skipped if awk is not gawk.  WDYT?
>>
>> Thanks, sounds reasonable to me.
> 
> Here is my proposal.  Worked properly with the non GNU awk sitting on my machine.

Your proposal works here on Debian after I switched to mawk via
'update-alternatives --config awk', selecting mawk. It detects two
occurrences of $< in our (project) Makefiles correctly.

Switching back to the old maint.mk, brings back the error message about
'-e'. I just did this to make sure.

Thanks for working on it !

Regards, Tim

> 
> commit b70c97f3ecf45a5c98b7f32189c1a4ae72a60788
> Author: Akim Demaille <akim.demaille@gmail.com>
> Date:   Sat Jun 22 17:52:16 2019 +0200
> 
>     maintainer-makefile: restore portability to non-GNU awks
>     
>     Reported by Tim Rühsen.
>     * top/maint.mk (AWK): New variable.  Use it.
>     (sc_prohibit_gnu_make_extensions): Skip if $(AWK) is not gawk.
> 
> diff --git a/ChangeLog b/ChangeLog
> index cdc2b3d7a..dc7e52c0a 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,10 @@
> +2019-06-22  Akim Demaille  <akim@lrde.epita.fr>
> +
> +	maintainer-makefile: restore portability to non-GNU awks
> +	Reported by Tim Rühsen.
> +	* top/maint.mk (AWK): New variable.  Use it.
> +	(sc_prohibit_gnu_make_extensions): Skip if $(AWK) is not gawk.
> +
>  2019-06-22  Akim Demaille  <akim@lrde.epita.fr>
>  
>  	argmatch: put all the docs member last.
> diff --git a/top/maint.mk b/top/maint.mk
> index 3dbe9c378..16e936022 100644
> --- a/top/maint.mk
> +++ b/top/maint.mk
> @@ -24,6 +24,7 @@ ME := maint.mk
>  # These variables ought to be defined through the configure.ac section
>  # of the module description. But some packages import this file directly,
>  # ignoring the module description.
> +AWK ?= awk
>  GREP ?= grep
>  SED ?= sed
>  
> @@ -190,7 +191,7 @@ $(sc_z_rules_): %.z: %
>  	@end=$$(date +%s.%N);						\
>  	start=$$(cat .sc-start-$*);					\
>  	rm -f .sc-start-$*;						\
> -	awk -v s=$$start -v e=$$end					\
> +	$(AWK) -v s=$$start -v e=$$end					\
>  	  'END {printf "%.2f $(patsubst sc_%,%,$*)\n", e - s}' < /dev/null
>  
>  # The patsubst here is to replace each sc_% rule with its sc_%.z wrapper
> @@ -435,13 +436,15 @@ sc_prohibit_gnu_make_extensions_awk_ =					\
>       exit status;							\
>    }
>  sc_prohibit_gnu_make_extensions:
> -	(cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') |	\
> -	  tr ' ' '\n' |							\
> -	  $(SED) -ne '/Makefile/{s/\.in$$//;p;}' |			\
> -	  while read m; do						\
> -	    $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null |		\
> -	      awk -v file=$$m -e '$($@_awk_)' || exit 1;		\
> -	  done
> +	@if $(AWK) --version | grep GNU >/dev/null 2>&1; then		\
> +	  (cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') |	\
> +	    tr ' ' '\n' |						\
> +	    $(SED) -ne '/Makefile/{s/\.in$$//;p;}' |			\
> +	    while read m; do						\
> +	      $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null |		\
> +	        $(AWK) -v file=$$m -e '$($@_awk_)' || exit 1;		\
> +	    done;							\
> +	fi
>  
>  # Using EXIT_SUCCESS as the first argument to error is misleading,
>  # since when that parameter is 0, error does not exit.  Use '0' instead.
> @@ -1383,7 +1386,7 @@ gpg_key_ID ?=								\
>    $$(cd $(srcdir)							\
>       && git cat-file tag v$(VERSION)					\
>          | $(gpgv) --status-fd 1 --keyring /dev/null - - 2>/dev/null	\
> -        | awk '/^\[GNUPG:\] ERRSIG / {print $$3; exit}')
> +        | $(AWK) '/^\[GNUPG:\] ERRSIG / {print $$3; exit}')
>  
>  translation_project_ ?= coordinator@translationproject.org
>  
> 
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-06-24  9:42                 ` Tim Rühsen
@ 2019-06-24 15:56                   ` Akim Demaille
  2019-06-25 13:12                     ` Tim Rühsen
  2019-06-25 13:24                     ` Tim Rühsen
  0 siblings, 2 replies; 24+ messages in thread
From: Akim Demaille @ 2019-06-24 15:56 UTC (permalink / raw)
  To: Tim Rühsen; +Cc: Paul Eggert, Gnulib bugs

Hi Tim,

> Le 24 juin 2019 à 11:42, Tim Rühsen <tim.ruehsen@gmx.de> a écrit :
> 
> Hi Akim,
> 
> Your proposal works here on Debian after I switched to mawk via
> 'update-alternatives --config awk', selecting mawk. It detects two
> occurrences of $< in our (project) Makefiles correctly.
> 
> Switching back to the old maint.mk, brings back the error message about
> '-e'. I just did this to make sure.

Perfect, thanks.  Installed.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-06-24 15:56                   ` Akim Demaille
@ 2019-06-25 13:12                     ` Tim Rühsen
  2019-06-25 13:24                     ` Tim Rühsen
  1 sibling, 0 replies; 24+ messages in thread
From: Tim Rühsen @ 2019-06-25 13:12 UTC (permalink / raw)
  To: Akim Demaille; +Cc: Paul Eggert, Gnulib bugs


[-- Attachment #1.1: Type: text/plain, Size: 3572 bytes --]

Hi Akim,

On 6/24/19 5:56 PM, Akim Demaille wrote:
> Hi Tim,
> 
>> Le 24 juin 2019 à 11:42, Tim Rühsen <tim.ruehsen@gmx.de> a écrit :
>>
>> Hi Akim,
>>
>> Your proposal works here on Debian after I switched to mawk via
>> 'update-alternatives --config awk', selecting mawk. It detects two
>> occurrences of $< in our (project) Makefiles correctly.
>>
>> Switching back to the old maint.mk, brings back the error message about
>> '-e'. I just did this to make sure.
> 
> Perfect, thanks.  Installed.

I updated gnulib to your commit
(47405621b3066c035b4b98d2db934d550aaed1ad) and - sorry to say - two CI
runners broke. That are Arch Linux and Fedora 30.

Output on Fedora 30 from 'make syntax-check':

prohibit_gnu_make_extensions
Error: lib/Makefile: $< in a non implicit rule
# makefile (from 'lib/Makefile', line 1310)
NEXT_STRING_H = <string.h>
# makefile (from 'lib/Makefile', line 1409)
REPLACE_LOCALECONV = 0
# makefile (from 'lib/Makefile', line 1231)
LTLIBICONV =
# makefile (from 'lib/Makefile', line 476)
ETAGS = etags
# environment
halt =
# makefile (from 'lib/Makefile', line 1450)
REPLACE_PTSNAME = 0
# automatic
?F = $(notdir $?)
# makefile (from 'lib/Makefile', line 784)
GNULIB_STRTOD = 0
# makefile (from 'lib/Makefile', line 1410)
REPLACE_LOCALTIME = 0

... (many more lines like these) ...

MAKE_VERSION := 4.2.1
# makefile (from 'lib/Makefile', line 540)
GNULIB_ATOLL = 0
# variable set hash-table stats:
# Load=1368/2048=67%, Rehash=1, Collisions=6067/4772=127%
Error: lib/Makefile: $< in a non implicit rule
%.lo: %.c
#  recipe to execute (from 'lib/Makefile', line 2150):
        $(AM_V_CC)depbase=`echo $@ | sed
's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
        $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
        $(am__mv) $$depbase.Tpo $$depbase.Plo
Error: lib/Makefile: $< in a non implicit rule
%.o: %.c
#  recipe to execute (from 'lib/Makefile', line 2134):
        $(AM_V_CC)depbase=`echo $@ | sed
's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
        $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
        $(am__mv) $$depbase.Tpo $$depbase.Po
Error: lib/Makefile: $< in a non implicit rule
%.obj: %.c
#  recipe to execute (from 'lib/Makefile', line 2142):
        $(AM_V_CC)depbase=`echo $@ | sed
's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
        $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@
`$(CYGPATH_W) '$<'` &&\
        $(am__mv) $$depbase.Tpo $$depbase.Po
Error: lib/Makefile: $< in a non implicit rule
(%): %
#  recipe to execute (built-in):
        $(AR) $(ARFLAGS) $@ $<
Error: lib/Makefile: $< in a non implicit rule
%.out: %
#  recipe to execute (built-in):
        @rm -f $@
         cp $< $@
Error: lib/Makefile: $< in a non implicit rule
%:: s.%
#  recipe to execute (built-in):
        $(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<
Error: lib/Makefile: $< in a non implicit rule
%:: SCCS/s.%
#  recipe to execute (built-in):
        $(GET) $(GFLAGS) $(SCCS_OUTPUT_OPTION) $<
make: *** [maint.mk:439: sc_prohibit_gnu_make_extensions] Error 1



[root@61f4306ca485 wget2]# cd gnulib
[root@61f4306ca485 gnulib]# git branch
* (HEAD detached at 47405621b)
  master
[root@61f4306ca485 gnulib]# git log
commit 47405621b3066c035b4b98d2db934d550aaed1ad (HEAD, origin/master,
origin/HEAD, master)
Author: Akim Demaille <akim.demaille@gmail.com>
Date:   Tue Jun 25 08:11:34 2019 +0200

[root@61f4306ca485 gnulib]# awk --version
GNU Awk 4.2.1, API: 2.0 (GNU MPFR 3.1.6-p2, GNU MP 6.1.2)


Regards, Tim


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-06-24 15:56                   ` Akim Demaille
  2019-06-25 13:12                     ` Tim Rühsen
@ 2019-06-25 13:24                     ` Tim Rühsen
  2019-06-25 14:37                       ` Bruno Haible
  2019-07-10  9:07                       ` Tim Rühsen
  1 sibling, 2 replies; 24+ messages in thread
From: Tim Rühsen @ 2019-06-25 13:24 UTC (permalink / raw)
  To: Akim Demaille; +Cc: Paul Eggert, Gnulib bugs


[-- Attachment #1.1: Type: text/plain, Size: 1082 bytes --]

Hi Akim,

the command expands to

if gawk --version | grep GNU >/dev/null 2>&1; then              \
  (cd . && autoconf --trace AC_CONFIG_FILES:'$1') |     \
    tr ' ' '\n' |                                               \
    /usr/bin/sed -ne '/Makefile/{s/\.in$//;p;}' |                       \
    while read m; do                                            \
      make -qp -f $m .DUMMY-TARGET 2>/dev/null |                \
        gawk -v file=$m -e 'BEGIN { RS = "\n\n"; in_rules = 0; } /^#
Files/ { in_rules = 1; } /\$</ && in_rules && $0 !~ /^(.*\n)*
\.\w+(\.\w+)?:/ { print "Error: " file ": $< in a non implicit rule\n"
$0; status = 1; } END { exit status; }' || exit 1;        \
    done;                                                       \
fi

# make --version
GNU Make 4.2.1
Built for x86_64-redhat-linux-gnu

# gawk --version
GNU Awk 4.2.1, API: 2.0 (GNU MPFR 3.1.6-p2, GNU MP 6.1.2)

# sed --version
sed (GNU sed) 4.5

# tr --version
tr (GNU coreutils) 8.31

# autoconf --version
autoconf (GNU Autoconf) 2.69


Regards, Tim


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-06-25 13:24                     ` Tim Rühsen
@ 2019-06-25 14:37                       ` Bruno Haible
  2019-06-25 14:39                         ` Tim Rühsen
  2019-06-25 14:46                         ` Tim Rühsen
  2019-07-10  9:07                       ` Tim Rühsen
  1 sibling, 2 replies; 24+ messages in thread
From: Bruno Haible @ 2019-06-25 14:37 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Tim Rühsen, Akim Demaille

[-- Attachment #1: Type: text/plain, Size: 693 bytes --]

Hi Tim,

> the command expands to
> 
> if gawk --version | grep GNU >/dev/null 2>&1; then              \
>   (cd . && autoconf --trace AC_CONFIG_FILES:'$1') |     \
>     tr ' ' '\n' |                                               \
>     /usr/bin/sed -ne '/Makefile/{s/\.in$//;p;}' |                       \
>     while read m; do                                            \
>       make -qp -f $m .DUMMY-TARGET 2>/dev/null |                \
>         gawk -v file=$m -e 'BEGIN { RS = "\n\n"; in_rules = 0; } /^#
> Files/ { in_rules = 1; } /\$</ && in_rules && $0 !~ /^(.*\n)*
> \.\w+(\.\w+)?:/ { print "Error: " file ": $< in a non implicit rule\n"

Does the attached patch fix it?

Bruno

[-- Attachment #2: fix-attempt.diff --]
[-- Type: text/x-patch, Size: 480 bytes --]

diff --git a/top/maint.mk b/top/maint.mk
index 16e9360..cb52631 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -429,7 +429,7 @@ sc_prohibit_gnu_make_extensions_awk_ =					\
       in_rules = 1;							\
   }									\
   /\$$</ && in_rules && $$0 !~ /^(.*\n)*\.\w+(\.\w+)?:/ {		\
-      print "Error: " file ": $$< in a non implicit rule\n" $$0;	\
+      print "Error: " file ": $$" "< in a non implicit rule\n" $$0;	\
       status = 1;							\
   }									\
   END {									\

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-06-25 14:37                       ` Bruno Haible
@ 2019-06-25 14:39                         ` Tim Rühsen
  2019-06-25 14:46                         ` Tim Rühsen
  1 sibling, 0 replies; 24+ messages in thread
From: Tim Rühsen @ 2019-06-25 14:39 UTC (permalink / raw)
  To: Bruno Haible, bug-gnulib; +Cc: Akim Demaille


[-- Attachment #1.1: Type: text/plain, Size: 814 bytes --]

Hi Bruno,

sorry, it doesn't.

On 6/25/19 4:37 PM, Bruno Haible wrote:
> Hi Tim,
> 
>> the command expands to
>>
>> if gawk --version | grep GNU >/dev/null 2>&1; then              \
>>   (cd . && autoconf --trace AC_CONFIG_FILES:'$1') |     \
>>     tr ' ' '\n' |                                               \
>>     /usr/bin/sed -ne '/Makefile/{s/\.in$//;p;}' |                       \
>>     while read m; do                                            \
>>       make -qp -f $m .DUMMY-TARGET 2>/dev/null |                \
>>         gawk -v file=$m -e 'BEGIN { RS = "\n\n"; in_rules = 0; } /^#
>> Files/ { in_rules = 1; } /\$</ && in_rules && $0 !~ /^(.*\n)*
>> \.\w+(\.\w+)?:/ { print "Error: " file ": $< in a non implicit rule\n"
> 
> Does the attached patch fix it?
> 
> Bruno
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-06-25 14:37                       ` Bruno Haible
  2019-06-25 14:39                         ` Tim Rühsen
@ 2019-06-25 14:46                         ` Tim Rühsen
  1 sibling, 0 replies; 24+ messages in thread
From: Tim Rühsen @ 2019-06-25 14:46 UTC (permalink / raw)
  To: Bruno Haible, bug-gnulib; +Cc: Akim Demaille


[-- Attachment #1.1.1: Type: text/plain, Size: 245 bytes --]

Here is a Dockerfile for reproducing the issue on Fedora 30.

docker build ...
docker run ...

git clone https://gitlab.com/gnuwget/wget2.git
cd wget2
git checkout tmp-stuff
./bootstrap
./configure
make syntax-check


Regards, Tim

[-- Attachment #1.1.2: Dockerfile --]
[-- Type: text/plain, Size: 688 bytes --]

FROM fedora:latest

LABEL maintainer "Tim Rühsen <tim.ruehsen@gmx.de>"

WORKDIR /usr/local

RUN dnf update -y
RUN dnf install -y --allowerasing \
	git \
	make \
	gcc \
	coreutils \
	autoconf \
	libtool \
	gettext-devel \
	automake \
	autogen \
	python \
	valgrind \
	libunistring-devel \
	flex \
	gnutls-devel \
	libpsl-devel \
	libnghttp2-devel \
	zlib-devel \
	libidn2-devel \
	bzip2-devel \
	xz-devel \
	libmicrohttpd-devel \
	gperf \
	lzip \
	rsync \
	pandoc \
	texinfo \
	perl-IO-Socket-SSL \
	perl-HTTP-Daemon \
	gpgme-devel \
	ccache \
	which

RUN git clone https://git.savannah.gnu.org/git/gnulib.git
ENV GNULIB_SRCDIR /usr/local/gnulib

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-06-25 13:24                     ` Tim Rühsen
  2019-06-25 14:37                       ` Bruno Haible
@ 2019-07-10  9:07                       ` Tim Rühsen
  2019-07-10  9:38                         ` Tim Rühsen
  1 sibling, 1 reply; 24+ messages in thread
From: Tim Rühsen @ 2019-07-10  9:07 UTC (permalink / raw)
  To: Akim Demaille; +Cc: Paul Eggert, Gnulib bugs


[-- Attachment #1.1: Type: text/plain, Size: 2146 bytes --]

On 6/25/19 3:24 PM, Tim Rühsen wrote:
> Hi Akim,
> 
> the command expands to
> 
> if gawk --version | grep GNU >/dev/null 2>&1; then              \
>   (cd . && autoconf --trace AC_CONFIG_FILES:'$1') |     \
>     tr ' ' '\n' |                                               \
>     /usr/bin/sed -ne '/Makefile/{s/\.in$//;p;}' |                       \
>     while read m; do                                            \
>       make -qp -f $m .DUMMY-TARGET 2>/dev/null |                \
>         gawk -v file=$m -e 'BEGIN { RS = "\n\n"; in_rules = 0; } /^#
> Files/ { in_rules = 1; } /\$</ && in_rules && $0 !~ /^(.*\n)*
> \.\w+(\.\w+)?:/ { print "Error: " file ": $< in a non implicit rule\n"
> $0; status = 1; } END { exit status; }' || exit 1;        \
>     done;                                                       \
> fi
> 
> # make --version
> GNU Make 4.2.1
> Built for x86_64-redhat-linux-gnu
> 
> # gawk --version
> GNU Awk 4.2.1, API: 2.0 (GNU MPFR 3.1.6-p2, GNU MP 6.1.2)
> 
> # sed --version
> sed (GNU sed) 4.5
> 
> # tr --version
> tr (GNU coreutils) 8.31
> 
> # autoconf --version
> autoconf (GNU Autoconf) 2.69

Testing the above directly in bash works.
So after some testing I found a work-around:

LC_ALL=en_US.UTF-8 make syntax-check

The issue is seen on Fedora 30 and Arch Linux.

Arch `locale` output:
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

The difference to a 'working' environment is that LC_ALL isn't set.

So the outcome of 'make syntax-check' (concrete:
sc_prohibit_gnu_make_extensions rule) is locale dependent.

Is that wanted behavior ?

Fun fact: Once you run `LC_ALL=en_US.UTF-8 make syntax-check`, all
following 'make syntax-check' succeed while LC_ALL still is empty. This
is on Arch.

I have no idea how to fix this properly.

Regards, Tim


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-07-10  9:07                       ` Tim Rühsen
@ 2019-07-10  9:38                         ` Tim Rühsen
  2019-07-10 10:21                           ` Tim Rühsen
  0 siblings, 1 reply; 24+ messages in thread
From: Tim Rühsen @ 2019-07-10  9:38 UTC (permalink / raw)
  To: Akim Demaille; +Cc: Paul Eggert, Gnulib bugs


[-- Attachment #1.1: Type: text/plain, Size: 3005 bytes --]



On 7/10/19 11:07 AM, Tim Rühsen wrote:
> On 6/25/19 3:24 PM, Tim Rühsen wrote:
>> Hi Akim,
>>
>> the command expands to
>>
>> if gawk --version | grep GNU >/dev/null 2>&1; then              \
>>   (cd . && autoconf --trace AC_CONFIG_FILES:'$1') |     \
>>     tr ' ' '\n' |                                               \
>>     /usr/bin/sed -ne '/Makefile/{s/\.in$//;p;}' |                       \
>>     while read m; do                                            \
>>       make -qp -f $m .DUMMY-TARGET 2>/dev/null |                \
>>         gawk -v file=$m -e 'BEGIN { RS = "\n\n"; in_rules = 0; } /^#
>> Files/ { in_rules = 1; } /\$</ && in_rules && $0 !~ /^(.*\n)*
>> \.\w+(\.\w+)?:/ { print "Error: " file ": $< in a non implicit rule\n"
>> $0; status = 1; } END { exit status; }' || exit 1;        \
>>     done;                                                       \
>> fi
>>
>> # make --version
>> GNU Make 4.2.1
>> Built for x86_64-redhat-linux-gnu
>>
>> # gawk --version
>> GNU Awk 4.2.1, API: 2.0 (GNU MPFR 3.1.6-p2, GNU MP 6.1.2)
>>
>> # sed --version
>> sed (GNU sed) 4.5
>>
>> # tr --version
>> tr (GNU coreutils) 8.31
>>
>> # autoconf --version
>> autoconf (GNU Autoconf) 2.69
> 
> Testing the above directly in bash works.
> So after some testing I found a work-around:
> 
> LC_ALL=en_US.UTF-8 make syntax-check
> 
> The issue is seen on Fedora 30 and Arch Linux.
> 
> Arch `locale` output:
> LANG=en_US.UTF-8
> LC_CTYPE="en_US.UTF-8"
> LC_NUMERIC="en_US.UTF-8"
> LC_TIME="en_US.UTF-8"
> LC_COLLATE="en_US.UTF-8"
> LC_MONETARY="en_US.UTF-8"
> LC_MESSAGES="en_US.UTF-8"
> LC_PAPER="en_US.UTF-8"
> LC_NAME="en_US.UTF-8"
> LC_ADDRESS="en_US.UTF-8"
> LC_TELEPHONE="en_US.UTF-8"
> LC_MEASUREMENT="en_US.UTF-8"
> LC_IDENTIFICATION="en_US.UTF-8"
> LC_ALL=
> 
> The difference to a 'working' environment is that LC_ALL isn't set.
> 
> So the outcome of 'make syntax-check' (concrete:
> sc_prohibit_gnu_make_extensions rule) is locale dependent.
> 
> Is that wanted behavior ?
> 
> Fun fact: Once you run `LC_ALL=en_US.UTF-8 make syntax-check`, all
> following 'make syntax-check' succeed while LC_ALL still is empty. This
> is on Arch.
> 
> I have no idea how to fix this properly.

Sorry, I have to backpaddle. After more tests with a fresh docker
container it seems not LC_ALL related. Instead after several 'make
syntax-check' those suddenly succeed.

All that changes my project directory is the files in '.deps/'. Removing
that directory, I am back at failing 'make syntax-check' (after several
invocations it then succeeds again).

It looks like the 'make' in the sc_prohibit_gnu_make_extensions rule
creates .Plo and .Po files. One group of files for each SUBDIR/Makefile
per 'make check'. If all files for all SUBDIRs have been created, make
'syntax-check' succeeds.

Knowing this, the issue is reproducible on Debian (unstable) as well.

I report more once tracked down.

Regards, Tim


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-07-10  9:38                         ` Tim Rühsen
@ 2019-07-10 10:21                           ` Tim Rühsen
  2019-07-10 19:32                             ` Akim Demaille
  0 siblings, 1 reply; 24+ messages in thread
From: Tim Rühsen @ 2019-07-10 10:21 UTC (permalink / raw)
  To: Akim Demaille; +Cc: Paul Eggert, Gnulib bugs


[-- Attachment #1.1: Type: text/plain, Size: 3547 bytes --]

On 7/10/19 11:38 AM, Tim Rühsen wrote:
> 
> 
> On 7/10/19 11:07 AM, Tim Rühsen wrote:
>> On 6/25/19 3:24 PM, Tim Rühsen wrote:
>>> Hi Akim,
>>>
>>> the command expands to
>>>
>>> if gawk --version | grep GNU >/dev/null 2>&1; then              \
>>>   (cd . && autoconf --trace AC_CONFIG_FILES:'$1') |     \
>>>     tr ' ' '\n' |                                               \
>>>     /usr/bin/sed -ne '/Makefile/{s/\.in$//;p;}' |                       \
>>>     while read m; do                                            \
>>>       make -qp -f $m .DUMMY-TARGET 2>/dev/null |                \
>>>         gawk -v file=$m -e 'BEGIN { RS = "\n\n"; in_rules = 0; } /^#
>>> Files/ { in_rules = 1; } /\$</ && in_rules && $0 !~ /^(.*\n)*
>>> \.\w+(\.\w+)?:/ { print "Error: " file ": $< in a non implicit rule\n"
>>> $0; status = 1; } END { exit status; }' || exit 1;        \
>>>     done;                                                       \
>>> fi
>>>
>>> # make --version
>>> GNU Make 4.2.1
>>> Built for x86_64-redhat-linux-gnu
>>>
>>> # gawk --version
>>> GNU Awk 4.2.1, API: 2.0 (GNU MPFR 3.1.6-p2, GNU MP 6.1.2)
>>>
>>> # sed --version
>>> sed (GNU sed) 4.5
>>>
>>> # tr --version
>>> tr (GNU coreutils) 8.31
>>>
>>> # autoconf --version
>>> autoconf (GNU Autoconf) 2.69
>>
>> Testing the above directly in bash works.
>> So after some testing I found a work-around:
>>
>> LC_ALL=en_US.UTF-8 make syntax-check
>>
>> The issue is seen on Fedora 30 and Arch Linux.
>>
>> Arch `locale` output:
>> LANG=en_US.UTF-8
>> LC_CTYPE="en_US.UTF-8"
>> LC_NUMERIC="en_US.UTF-8"
>> LC_TIME="en_US.UTF-8"
>> LC_COLLATE="en_US.UTF-8"
>> LC_MONETARY="en_US.UTF-8"
>> LC_MESSAGES="en_US.UTF-8"
>> LC_PAPER="en_US.UTF-8"
>> LC_NAME="en_US.UTF-8"
>> LC_ADDRESS="en_US.UTF-8"
>> LC_TELEPHONE="en_US.UTF-8"
>> LC_MEASUREMENT="en_US.UTF-8"
>> LC_IDENTIFICATION="en_US.UTF-8"
>> LC_ALL=
>>
>> The difference to a 'working' environment is that LC_ALL isn't set.
>>
>> So the outcome of 'make syntax-check' (concrete:
>> sc_prohibit_gnu_make_extensions rule) is locale dependent.
>>
>> Is that wanted behavior ?
>>
>> Fun fact: Once you run `LC_ALL=en_US.UTF-8 make syntax-check`, all
>> following 'make syntax-check' succeed while LC_ALL still is empty. This
>> is on Arch.
>>
>> I have no idea how to fix this properly.
> 
> Sorry, I have to backpaddle. After more tests with a fresh docker
> container it seems not LC_ALL related. Instead after several 'make
> syntax-check' those suddenly succeed.
> 
> All that changes my project directory is the files in '.deps/'. Removing
> that directory, I am back at failing 'make syntax-check' (after several
> invocations it then succeeds again).
> 
> It looks like the 'make' in the sc_prohibit_gnu_make_extensions rule
> creates .Plo and .Po files. One group of files for each SUBDIR/Makefile
> per 'make check'. If all files for all SUBDIRs have been created, make
> 'syntax-check' succeeds.
> 
> Knowing this, the issue is reproducible on Debian (unstable) as well.
> 
> I report more once tracked down.

Reproducible everywhere (needs gawk being installed, else the
sc_prohibit_gnu_make_extensions is a no-op).

Akim, at least with GNU make 4.2.1 the combination of -q and -p doesn't
do what you expect. From the make man page, I would say that both
options contradict. -q: don't print anything; -p: print the database

For now, I have to disable sc_prohibit_gnu_make_extensions in my projects.

Regards, Tim


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-07-10 10:21                           ` Tim Rühsen
@ 2019-07-10 19:32                             ` Akim Demaille
  2019-07-11  8:00                               ` Tim Rühsen
  2019-07-11  8:46                               ` Tim Rühsen
  0 siblings, 2 replies; 24+ messages in thread
From: Akim Demaille @ 2019-07-10 19:32 UTC (permalink / raw)
  To: Tim Rühsen; +Cc: Paul Eggert, Gnulib bugs

Hi Tim,

Sorry I dropped the ball...

> Reproducible everywhere (needs gawk being installed, else the
> sc_prohibit_gnu_make_extensions is a no-op).

Which is what I meant.  So are you saying it work as (I) expected?

> Akim, at least with GNU make 4.2.1 the combination of -q and -p doesn't
> do what you expect. From the make man page, I would say that both
> options contradict. -q: don't print anything; -p: print the database

I'm using 4.2.1, and it does what I meant: -p prints the rules,
and -q (which is --question, not --quiet) avoids that we
fired a rule (i.e., "make -q" does not run "make all").

So I'm just clueless here.  I don't know what to do to address
your issue.

Are you running "make syntax-check" on a configured builddir?



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-07-10 19:32                             ` Akim Demaille
@ 2019-07-11  8:00                               ` Tim Rühsen
  2019-07-11  8:46                               ` Tim Rühsen
  1 sibling, 0 replies; 24+ messages in thread
From: Tim Rühsen @ 2019-07-11  8:00 UTC (permalink / raw)
  To: Akim Demaille; +Cc: Paul Eggert, Gnulib bugs


[-- Attachment #1.1: Type: text/plain, Size: 1716 bytes --]

Hi Akim,

On 7/10/19 9:32 PM, Akim Demaille wrote:
> Hi Tim,
> 
> Sorry I dropped the ball...

NP, I dropped it as well ;-)

>> Reproducible everywhere (needs gawk being installed, else the
>> sc_prohibit_gnu_make_extensions is a no-op).
> 
> Which is what I meant.  So are you saying it work as (I) expected?

It works as expected for mawk which effectively means the test is skipped.

>> Akim, at least with GNU make 4.2.1 the combination of -q and -p doesn't
>> do what you expect. From the make man page, I would say that both
>> options contradict. -q: don't print anything; -p: print the database
> 
> I'm using 4.2.1, and it does what I meant: -p prints the rules,
> and -q (which is --question, not --quiet) avoids that we
> fired a rule (i.e., "make -q" does not run "make all").

I just summed up the man page and picked up the 'Do not ... print anything':
-q, --question
     ``Question mode''.  Do not run any commands, or print anything;
just return an exit status that  is  zero  if  the
     specified targets are already up to date, nonzero otherwise.


> So I'm just clueless here.  I don't know what to do to address
> your issue.

It looks like this is not *my* issue. The issue shows up on different
installations which have gawk and make 4.2.1 in common.

I will check if the issue pops up with older make versions or with other
projects as well.

> Are you running "make syntax-check" on a configured builddir?

No sure what you mean. The command sequence to trigger the issue is
straight forward:
./bootstrap
./configure
make
make check
make syntax-check <- bang

What (C) project + environment are you using successfully ?

Regards, Tim


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-07-10 19:32                             ` Akim Demaille
  2019-07-11  8:00                               ` Tim Rühsen
@ 2019-07-11  8:46                               ` Tim Rühsen
  2019-07-19  7:40                                 ` Bernhard Voelker
  1 sibling, 1 reply; 24+ messages in thread
From: Tim Rühsen @ 2019-07-11  8:46 UTC (permalink / raw)
  To: Akim Demaille; +Cc: Paul Eggert, Gnulib bugs


[-- Attachment #1.1: Type: text/plain, Size: 1174 bytes --]

On 7/10/19 9:32 PM, Akim Demaille wrote:
> I'm using 4.2.1, and it does what I meant: -p prints the rules,
> and -q (which is --question, not --quiet) avoids that we
> fired a rule (i.e., "make -q" does not run "make all").
> 
> So I'm just clueless here.  I don't know what to do to address
> your issue.

I can *NOT* reproduce the issue on Debian stretch (gawk 4.1.4, make 4.1).
Also, here the .deps/ directory is not being generated by make -qp.


Back to Debian unstable / Arch / Fedora 30.

I tested with good old wget and see the same issue.
The command sequence is
  git clone https://gitlab.com/gnuwget/wget.git
  cd wget
  ./bootstrap
  cd gnulib
  git checkout master
  git pull
  cd ..
  git commit -m "update gnulib" gnulib
  ./bootstrap
  ./configure
  make syntax-check

This also creates the .deps/ directory. So maybe make 4.2.1 has a bug as
it creates files though -q is given. But then, why can't you reproduce
with the same version of make ?

Earlier in this thread I attached a Dockerfile that makes it pretty easy
to reproduce. If you don't use docker, I could send you the complete
make -qp output.

Regards, Tim


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-05-18  9:51   ` Akim Demaille
  2019-05-18 18:21     ` Paul Eggert
@ 2019-07-19  7:30     ` Bernhard Voelker
  1 sibling, 0 replies; 24+ messages in thread
From: Bernhard Voelker @ 2019-07-19  7:30 UTC (permalink / raw)
  To: Akim Demaille, Paul Eggert; +Cc: Gnulib bugs

Hi Akim,

On 5/18/19 11:51 AM, Akim Demaille wrote:
> commit 2e801e81bb362429d0e252d076233bfdac20e367
> Author: Akim Demaille <akim.demaille@gmail.com>
> Date:   Sat May 18 08:46:00 2019 +0200
> 
>     maintainer-makefile: catch uses of $< in non-implicit rules
>     
>     * top/maint.mk (sc_prohibit_magic_number_exit): New.

Wrong sc rule - it should have been this:

     * top/maint.mk (sc_prohibit_gnu_make_extensions_awk_): New.
     (sc_prohibit_gnu_make_extensions): New.

Do we fix the ChangeLog in cases like this?

Thanks & have a nice day,
Berny

> 
> diff --git a/ChangeLog b/ChangeLog
> index 1918041f0..8d5a4ca6e 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,8 @@
> +2019-05-18  Akim Demaille  <akim@lrde.epita.fr>
> +
> +	maintainer-makefile: catch uses of $< in non-implicit rules
> +	* top/maint.mk (sc_prohibit_magic_number_exit): New.
> +
>  2019-05-14  Paul Eggert  <eggert@cs.ucla.edu>
>  
>  	close-stream, closein, closeout: simplify
> diff --git a/top/maint.mk b/top/maint.mk
> index e9d5ee7d4..3dbe9c378 100644
> --- a/top/maint.mk
> +++ b/top/maint.mk
> @@ -408,6 +408,41 @@ sc_prohibit_magic_number_exit:
>  	halt='use EXIT_* values rather than magic number'		\
>  	  $(_sc_search_regexp)
>  
> +# Check that we don't use $< in non-implicit Makefile rules.
> +#
> +# To find the Makefiles, trace AC_CONFIG_FILES.  Using VC_LIST would
> +# miss the Makefiles that are not under VC control (e.g., symlinks
> +# installed for gettext).  "Parsing" (recursive) uses of SUBDIRS seems
> +# too delicate.
> +#
> +# Use GNU Make's --print-data-base to normalize the rules into some
> +# easy to parse format: they are separated by two \n.  Look for the
> +# "section" about non-pattern rules (marked with "# Files") inside
> +# which there are still the POSIX Make like implicit rules (".c.o").
> +sc_prohibit_gnu_make_extensions_awk_ =					\
> +  BEGIN {								\
> +      RS = "\n\n";							\
> +      in_rules = 0;							\
> +  }									\
> +  /^\# Files/ {								\
> +      in_rules = 1;							\
> +  }									\
> +  /\$$</ && in_rules && $$0 !~ /^(.*\n)*\.\w+(\.\w+)?:/ {		\
> +      print "Error: " file ": $$< in a non implicit rule\n" $$0;	\
> +      status = 1;							\
> +  }									\
> +  END {									\
> +     exit status;							\
> +  }
> +sc_prohibit_gnu_make_extensions:
> +	(cd $(srcdir) && autoconf --trace AC_CONFIG_FILES:'$$1') |	\
> +	  tr ' ' '\n' |							\
> +	  $(SED) -ne '/Makefile/{s/\.in$$//;p;}' |			\
> +	  while read m; do						\
> +	    $(MAKE) -qp -f $$m .DUMMY-TARGET 2>/dev/null |		\
> +	      awk -v file=$$m -e '$($@_awk_)' || exit 1;		\
> +	  done
> +
>  # Using EXIT_SUCCESS as the first argument to error is misleading,
>  # since when that parameter is 0, error does not exit.  Use '0' instead.
>  sc_error_exit_success:


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: maintainer-makefile: catch uses of $< in non-implicit rules
  2019-07-11  8:46                               ` Tim Rühsen
@ 2019-07-19  7:40                                 ` Bernhard Voelker
  0 siblings, 0 replies; 24+ messages in thread
From: Bernhard Voelker @ 2019-07-19  7:40 UTC (permalink / raw)
  To: Tim Rühsen, Akim Demaille; +Cc: Paul Eggert, Gnulib bugs

On 7/11/19 10:46 AM, Tim Rühsen wrote:
> I can *NOT* reproduce the issue on Debian stretch (gawk 4.1.4, make 4.1).
> Also, here the .deps/ directory is not being generated by make -qp.
> 
> 
> Back to Debian unstable / Arch / Fedora 30.
> > I tested with good old wget and see the same issue.
> The command sequence is
>   git clone https://gitlab.com/gnuwget/wget.git
>   cd wget
>   ./bootstrap
>   cd gnulib
>   git checkout master
>   git pull
>   cd ..
>   git commit -m "update gnulib" gnulib
>   ./bootstrap
>   ./configure
>   make syntax-check

I'm getting the same syntax-check error on openSUSE:Tumbleweed (GNU Awk 4.2.1,
GNU Make 4.2.1) for the GNU coreutils when trying to update gnulib to latest
(similar command sequence as above):

  $ make syntax-check
  ...
  prohibit_gnu_make_extensions
  Error: gnulib-tests/Makefile: $< in a non implicit rule

Have a nice day,
Berny


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2019-07-19  7:40 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-18  7:44 maintainer-makefile: catch uses of $< in non-implicit rules Akim Demaille
2019-05-18  7:52 ` Paul Eggert
2019-05-18  9:51   ` Akim Demaille
2019-05-18 18:21     ` Paul Eggert
2019-05-19  5:42       ` Akim Demaille
2019-06-17  9:57         ` Tim Rühsen
2019-06-17  9:59           ` Akim Demaille
2019-06-17 10:04             ` Tim Rühsen
2019-06-22 15:53               ` Akim Demaille
2019-06-24  9:42                 ` Tim Rühsen
2019-06-24 15:56                   ` Akim Demaille
2019-06-25 13:12                     ` Tim Rühsen
2019-06-25 13:24                     ` Tim Rühsen
2019-06-25 14:37                       ` Bruno Haible
2019-06-25 14:39                         ` Tim Rühsen
2019-06-25 14:46                         ` Tim Rühsen
2019-07-10  9:07                       ` Tim Rühsen
2019-07-10  9:38                         ` Tim Rühsen
2019-07-10 10:21                           ` Tim Rühsen
2019-07-10 19:32                             ` Akim Demaille
2019-07-11  8:00                               ` Tim Rühsen
2019-07-11  8:46                               ` Tim Rühsen
2019-07-19  7:40                                 ` Bernhard Voelker
2019-07-19  7:30     ` Bernhard Voelker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).