[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] [bug report] gawk doesn???t work correctly when assign sp
From: |
Andrew J. Schorr |
Subject: |
Re: [bug-gawk] [bug report] gawk doesn???t work correctly when assign special value to variable |
Date: |
Sun, 9 Aug 2015 19:40:19 -0400 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Fri, Aug 07, 2015 at 06:26:12PM +0200, Hermann Peifer wrote:
> $ gawk -v var="00e1" '$2==var{print $0, typeof(var), typeof($2)}' 1.txt
> 00e1 00e1 string strnum
> 00e2 00e4 string strnum
>
> Above, I just gave it a try using gawk/master which says that typeof(var) is
> string, which in return should result into a string comparison according to
> the manual. So I would also expect the comparison to fail in the 2nd line:
>
> $2 = 00e4/strnum is not string-equal with var = 00e1/string
I noticed the same issue. I'm guessing it's a bug in typeof, but I'm not
certain
what's going on. I guess this needs to be debugged. The builtin.c:do_typeof
function
tests for the MAYBE_NUM flag to decide whether it's a string or a strnum.
And in main.c:arg_assign, it appears that MAYBE_NUM is set for command-line
variable assignments. But something strange is clearly happening...
Regards,
Andy
Re: [bug-gawk] [bug report] gawk doesn’t work correctly when assign special value to variable, Jarno Suni, 2015/08/10