From 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 .
# 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) $( $@
+ 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 '