Igor Todorovski <itodo...@ca.ibm.com> writes:

> This is the relevant code:
>
>   return (!!$val == $neg) ? '##%' : '';

I've attached a patch that fixes this by quoting $val and the '!'
operators.

Maybe Automake shouldn't use:

    use warnings FATAL => 'all';

As was mentioned in the GitHub thread you linked and Perl's
documentation [1].

For cases like this, where the interpreter warns about code it finds
"problematic", but works as the programmer expected.

Collin

[1] https://perldoc.perl.org/warnings#Fatal-Warnings

>From 5396a5709b3e676cd9576389dc0c76dfce57ec98 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Wed, 29 Jan 2025 19:05:29 -0800
Subject: [PATCH] automake: fix error when using Perl 5.41+

Reported by Igor Todorovski <itodo...@ca.ibm.com> in
<https://lists.gnu.org/archive/html/automake/2025-01/msg00000.html>.

* bin/automake.in (transform): Quote the '!' operators so Perl doesn't warn
about precedence.
---
 bin/automake.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/automake.in b/bin/automake.in
index 5d3e7c766..a3b74f485 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -6871,7 +6871,7 @@ sub transform ($\%)
     {
       my $neg = ($1 eq '!') ? 1 : 0;
       my $val = transform_token ($token, %$transform, $2);
-      return (!!$val == $neg) ? '##%' : '';
+      return ((!!$val) == $neg) ? '##%' : '';
     }
   else
     {
-- 
2.48.1

Reply via email to