[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[automake-commit] branch master updated: automake: avoid Perl-level warn
From: |
Karl Berry |
Subject: |
[automake-commit] branch master updated: automake: avoid Perl-level warning on empty variable $(). |
Date: |
Sun, 30 Jun 2024 16:27:58 -0400 |
This is an automated email from the git hooks/post-receive script.
karl pushed a commit to branch master
in repository automake.
View the commit online:
https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=b020a9ca888a3af2e18ecd77fa66c6ca6811329f
The following commit(s) were added to refs/heads/master by this push:
new b020a9ca8 automake: avoid Perl-level warning on empty variable $().
b020a9ca8 is described below
commit b020a9ca888a3af2e18ecd77fa66c6ca6811329f
Author: Karl Berry <karl@freefriends.org>
AuthorDate: Sun Jun 30 13:26:51 2024 -0700
automake: avoid Perl-level warning on empty variable $().
https://lists.gnu.org/archive/html/automake/2024-06/msg00085.html
* lib/Automake/Variable.pm (scan_variable_expansions): recognize
and do nothing if the variable name is empty: $().
* t/varempty.sh: new test.
* t/list-of-tests.mk (handwritten_TESTS): add it.
---
lib/Automake/Variable.pm | 6 +++++-
t/list-of-tests.mk | 1 +
t/varempty.sh | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm
index db1f6378d..f97aab59f 100644
--- a/lib/Automake/Variable.pm
+++ b/lib/Automake/Variable.pm
@@ -751,7 +751,11 @@ sub scan_variable_expansions ($)
while ($text =~ m{\$(?:\{([^\}]*)\}|\(([^\)]*)\)|(\$))}g)
{
my $var = $1 || $2 || $3;
- next if $var eq '$';
+ next if (! defined $var) || ($var eq '$');
+ # we check for $var being defined because NetworkManager and other
+ # packages use the strange construct $().
+ # https://lists.gnu.org/archive/html/automake/2024-06/msg00085.html
+
# The occurrence may look like $(string1[:subst1=[subst2]]) but
# we want only 'string1'.
$var =~ s/:[^:=]*=[^=]*$//;
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 1e0f364ba..e80ace470 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -1282,6 +1282,7 @@ t/vala-per-target-flags.sh \
t/vala-recursive-setup.sh \
t/vala-vapi.sh \
t/vala-vpath.sh \
+t/varempty.sh \
t/vars.sh \
t/vars3.sh \
t/var-recurs.sh \
diff --git a/t/varempty.sh b/t/varempty.sh
new file mode 100644
index 000000000..9eb45c421
--- /dev/null
+++ b/t/varempty.sh
@@ -0,0 +1,36 @@
+#! /bin/sh
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+# An empty variable name $() should not cause a Perl warning, namely:
+# Use of uninitialized value $var in string eq at
+# .../lib/Automake/Variable.pm line 754, <GEN2> line 3.
+# (in scan_variable_expansions)
+#
+# This showed up with the NetworkManager and other packages in Fedora:
+# https://lists.gnu.org/archive/html/automake/2024-06/msg00085.html
+# (The actual purpose of the "$()" is unclear.)
+
+. test-init.sh
+
+cat > Makefile.am << 'END'
+x:
+ $()
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [automake-commit] branch master updated: automake: avoid Perl-level warning on empty variable $().,
Karl Berry <=