Hello again.
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 don't have the POSIX standard and didn't find any references to
POSIX variables in GNU make's manual, so I assume the quotation in the
defect report is correct.
The patch doesn't do anything to check if the variables are
supported by the end-user's 'make', because it's not the end-user's
'make' which decides what is portable or not. The message is not
changed either.
I don't know if "$(<:.foo=.bar)" should be allowed, but that seems
to be taken care of in
lib/Automake/Variable.pm:scan_variable_expansions anyway (resulting in
just "<" in this example).
Fixes bug#9587.
--
Regards - Bogdan ('bogdro') D. (GNU/Linux & FreeDOS)
X86 assembly (DOS, GNU/Linux): http://bogdro.evai.pl/index-en.php
Soft(EN): http://bogdro.evai.pl/soft http://bogdro.evai.pl/soft4asm
www.Xiph.org www.TorProject.org www.LibreOffice.org www.GnuPG.orgFrom f759c741296d505a5a5ca8c7ed9fc201a7ac4a0c Mon Sep 17 00:00:00 2001
From: Bogdan Drozdowski <>
Date: Thu, 23 Mar 2023 20:39:05 +0100
Subject: [PATCH] Add POSIX-allowed variables
---
lib/Automake/Variable.pm | 3 ++-
t/vars3.sh | 21 ++++++++++++++++++++-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm
index cc6b12fe0..ba6cf9e8f 100644
--- a/lib/Automake/Variable.pm
+++ b/lib/Automake/Variable.pm
@@ -132,7 +132,8 @@ 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
--
2.35.1