[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] gawk bug: IGNORECASE=0 does not work
From: |
Andrew J. Schorr |
Subject: |
Re: [bug-gawk] gawk bug: IGNORECASE=0 does not work |
Date: |
Mon, 2 Feb 2015 08:35:01 -0500 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Mon, Feb 02, 2015 at 08:18:04AM -0500, Andrew J. Schorr wrote:
> Hi,
>
> On Fri, Jan 30, 2015 at 03:00:23AM -0500, Jeff B wrote:
> > # We explicitly set IGNORECASE to *ZERO* and, huh? This should not match.
> > qbarry $?=0> gawk -v IGNORECASE=0 '
> > BEGIN { if ( "a" == "A" ) print "match"; else print "no match" }'
> > match
...
>
> Note that this version works properly:
>
> bash-4.2$ gawk 'BEGIN { IGNORECASE = 0; if ( "a" == "A" ) print "match"; else
> print "no match" }'
> no match
>
> As does this:
>
> bash-4.2$ echo 0 | gawk '{ IGNORECASE = $1; if ( "a" == "A" ) print "match";
> else print "no match" }'
> no match
>
> But this one also fails:
>
> bash-4.2$ gawk 'BEGIN { IGNORECASE = "0"; if ( "a" == "A" ) print "match";
> else print "no match" }'
> match
The attached patch seems to fix the original problem. Note that
main.c:arg_assign calls force_number, which removes the MAYBE_NUM flag and
instead sets NUMBER|NUMCUR.
Arnold -- does this look right to you?
However, this result still seems odd to me:
bash-4.2$ ./gawk 'BEGIN { IGNORECASE = "0"; if ( "a" == "A" ) print "match";
else print "no match" }'
match
Is this truly the desired behavior? Or should we be more lenient in
recognizing that the string value may actually contain a number?
Regards,
Andy
ignorecase.patch
Description: Text document