autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] avoid new warning about undefined $ARGV[0]


From: Jim Meyering
Subject: Re: [PATCH] avoid new warning about undefined $ARGV[0]
Date: Sun, 15 Jan 2012 17:58:46 +0100

Stefano Lattarini wrote:

> On 01/15/2012 05:33 PM, Jim Meyering wrote:
>> Stefano Lattarini wrote:
>>
>>> Hi Jim.
>>>
>>> On 01/15/2012 05:22 PM, Jim Meyering wrote:
>>>> Without this change, numerous tests would fail.
>>>> E.g., on a Fedora 16 system, running autoreconf would print this warning:
>>>>
>>>>     Use of uninitialized value $ARGV[0] in pattern match (m//) at \
>>>>       /p/share/autoconf/Autom4te/General.pm line 273.
>>>>
>>> Ouch, apparently you have missed my earlier patch that fixed this same bug:
>>> <http://lists.gnu.org/archive/html/autoconf-patches/2012-01/msg00010.html>
>>
>> Hi Stefano,
>>
>> I did indeed miss that.  Sorry.
>>
>> It didn't even occur to me that a known bug like that would
>> be left (awaiting review?)
>>
> Yes, awaiting review.  For projects where I only contribute minimally, I want 
> to
> wait for an explicit ACK before *any* commit, whether bug-fix or not.  That's
> why I'm also waiting for a review before pushing this patch:
>
>   <http://lists.gnu.org/archive/html/autoconf-patches/2012-01/msg00011.html>
>
> which fix a bug more difficult to spot but which, when hit, can have much more
> heinous consequences (details in the commit log).

I've just reviewed that.

>> in master.
>>
>> I see you would have fixed it like this:
>>
>>   if (@ARGV > 0 && $ARGV[0] =~ /^-./)
>>
>> I prefer that to what I did (defined $ARGV[0]),
>> but prefer this even more:
>>
>>   if (@ARGV && $ARGV[0] =~ /^-./)
>>
>> It's concise (less syntax), and no use of ">".
>>
> I like this more as well.  I assume you'll go ahead and make the change 
> yourself,
> right?

Sure:

>From 08a7320746ee8c7fb9d0855a09a85ffd21228a8c Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 15 Jan 2012 17:57:54 +0100
Subject: [PATCH] refine syntax of previous change

* lib/Autom4te/General.pm (getopt): Use a more concise test.
---
 ChangeLog               |    3 +++
 lib/Autom4te/General.pm |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2ab830e..5bde291 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2012-01-15  Jim Meyering  <address@hidden>

+       refine syntax of previous change
+       * lib/Autom4te/General.pm (getopt): Use a more concise test.
+
        avoid new warning about undefined $ARGV[0]
        * lib/Autom4te/General.pm (getopt): Avoid warning induced by
        yesterday's change: $ARGV[0] may not be defined, e.g., when
diff --git a/lib/Autom4te/General.pm b/lib/Autom4te/General.pm
index 2379ce3..f9393be 100644
--- a/lib/Autom4te/General.pm
+++ b/lib/Autom4te/General.pm
@@ -270,7 +270,7 @@ sub getopt (%)
   # FIXME: Lot of code duplication with automake here.  It would probably
   # be best to generalize our getopt() func and rip it out in a new module
   # from which automake can sync.
-  if (defined $ARGV[0] && $ARGV[0] =~ /^-./)
+  if (@ARGV && $ARGV[0] =~ /^-./)
     {
       my %argopts;
       for my $k (keys %option)
--
1.7.9.rc1.2.gccfe4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]