[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#9587: [PATCH] Automake claims $(*F), $(<D), etc. are non-POSIX.
From: |
Karl Berry |
Subject: |
bug#9587: [PATCH] Automake claims $(*F), $(<D), etc. are non-POSIX. |
Date: |
Sat, 1 Jul 2023 09:35:16 -0600 |
Back on this bug report from Nick in 2011 (thanks/sorry):
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=9587
bd> The attached patch allows the following symbols not to cause
Automake errors about non-POSIX variables (and updates the test):
$(@F) $(%F) $(?F) $(<F) $(*F) $(@D) $(%D) $(?D) $(<D) $(*D) $(%)
$(?) $(<) $(*) $% $? $< $*
I installed the patch. Thanks Bogdan.
I don't have the POSIX standard
It's online nowadays.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html
As far as I could see, Nick's report was correct (as expected :).
because it's not the end-user's 'make' which decides what is
portable or not.
Testing a given make implementation can prove that a variable is
unportable (when it fails). There's never any way to prove that
something is perfectly portable.
Nevertheless, in this case, it seemed to me that it was better to fix
the incorrect warning about non-POSIX variables now than to require
testing for and giving perfect diagnostics for the implementations that
don't correctly support all the POSIX variables. If people use those
implementations, they most likely are not relying on Automake
diagnostics about those variables. Nevertheless, I'm leaving the bug
open for this reason. I also mentioned this suboptimality in the NEWS
item. --thanks, karl.
-----------------------------------------------------------------------------
2023-07-01 Bogdan <bogdro_rep@gmx.us>
automake: do not warn that POSIX variables are non-POSIX.
This change fixes https://bugs.gnu.org/9587.
* lib/Automake/Variable.pm (_VARIABLE_PATTERN_EXTRA_POSIX):
new variable for $(*D) and the like.
(_VARIABLE_PATTERN): use it.
* t/vars3.sh: update test.
* NEWS: mention this.
POSIX spec (currently):
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html
diff --git a/NEWS b/NEWS
index b73c92569..61d631ba0 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,12 @@ New in 1.17:
- Emacs Lisp compilations respects silent make output.
+ - Automake no longer incorrectly warns that the POSIX make variables
+ $(*D) and the like are non-POSIX. Unfortunately, the make
+ implementations which do not correctly implement all the POSIX
+ variables are not detected, but this seems to have little impact
+ in practice. (bug#9587)
+
- distcleancheck ignores "silly rename" files (.nfs* .smb* .__afs*)
that can show up on network file systems.
diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm
index 2c118314e..8bafc8e3a 100644
--- a/lib/Automake/Variable.pm
+++ b/lib/Automake/Variable.pm
@@ -132,7 +132,9 @@ non-object).
=cut
my $_VARIABLE_CHARACTERS = '[.A-Za-z0-9_@]+';
-my $_VARIABLE_PATTERN = '^' . $_VARIABLE_CHARACTERS . "\$";
+my $_VARIABLE_PATTERN_EXTRA_POSIX = '[*?<%][DF]?';
+my $_VARIABLE_PATTERN = '^(' . $_VARIABLE_CHARACTERS
+ . '|' . $_VARIABLE_PATTERN_EXTRA_POSIX . ")\$";
my $_VARIABLE_RECURSIVE_PATTERN =
'^([.A-Za-z0-9_@]|\$[({]' . $_VARIABLE_CHARACTERS . '[})]?)+' . "\$";
diff --git a/t/vars3.sh b/t/vars3.sh
index ae89a6869..cbba47e68 100644
--- a/t/vars3.sh
+++ b/t/vars3.sh
@@ -15,7 +15,8 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Check that Automake warns about variables containing spaces
-# and other non-POSIX characters.
+# and other non-POSIX characters, but not about real POSIX
+# variables (see bug#9587).
. test-init.sh
@@ -32,6 +33,10 @@ L08$(o u c h): $(wildcard *.c)
echo $${ok-this is}
L11: $(thisis) $(ok)
${here}
+just_a_test:
+ echo "$(@F) $(%F) $(?F) $(<F) $(*F) $(@D) $(%D) $(?D) $(<D) $(*D)" > $@
+ echo "$(%) $(?) $(<) $(*)" > $@
+ echo "$% $? $< $*" > $@
EOF
$ACLOCAL
@@ -59,6 +64,20 @@ grep ':8:.*wildcard' stderr
grep ':9:.*another Error' stderr
$EGREP 'ok|thisis|here' stderr && exit 1
+grep '@F' stderr && exit 1
+grep '%F' stderr && exit 1
+grep '?F' stderr && exit 1
+grep '<F' stderr && exit 1
+grep '*F' stderr && exit 1
+grep '@D' stderr && exit 1
+grep '%D' stderr && exit 1
+grep '?D' stderr && exit 1
+grep '<D' stderr && exit 1
+grep '*D' stderr && exit 1
+grep ': %: ' stderr && exit 1
+grep ': ?: ' stderr && exit 1
+grep ': <: ' stderr && exit 1
+grep ': *: ' stderr && exit 1
# None of these errors be diagnosed with '-Wno-portability'.
$AUTOMAKE -Wno-portability
compile finished at Sat Jul 1 08:32:40 2023
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#9587: [PATCH] Automake claims $(*F), $(<D), etc. are non-POSIX.,
Karl Berry <=