bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: awk -v BINMODE=rw # \r is getting removed


From: Andrew J. Schorr
Subject: Re: awk -v BINMODE=rw # \r is getting removed
Date: Sat, 23 Aug 2008 12:32:18 -0400
User-agent: Mutt/1.4.2.2i

On Fri, Aug 22, 2008 at 02:13:52PM -0500, Tom Rodman wrote:
> awk is removing the \r below:
> 
>   ~ $ date;uname -sr
>   Thu Aug 21 18:26:08 CDT 2008
>   CYGWIN_NT-5.0 1.5.25(0.156/4/2)
>   ~ $ printf "HI\r\n"| awk -v BINMODE=rw '{print}'|/bin/od -Ad -c -toC
>   0000000   H   I  \n
>           110 111 012
>   0000003
>   ~ $ cygcheck -f /bin/gawk
>   gawk-3.1.6-1

FYI, the problem seems to be with parsing the BINMODE string
value.  If I use a numeric value, it works fine:

   $ date; uname -sr
   Sat Aug 23 12:26:26 EDT 2008
   CYGWIN_NT-5.1 1.5.25(0.156/4/2)
   $ printf "HI\r\n"| awk -v BINMODE=rw 1 | od -c
   0000000   H   I  \n
   0000003
   $ printf "HI\r\n"| awk -v BINMODE=3 1 | od -c
   0000000   H   I  \r  \n
   0000004
   $ cygcheck -f /bin/gawk
   gawk-3.1.6-1

So I guess there's a bug in eval.c:set_BINMODE.  Note that an
invalid value of BINMODE does not result in a warning message:

   $ printf "HI\r\n"| awk -v BINMODE=fubar 1 | od -c
   0000000   H   I  \n
   0000003

So it seems that the tests on BINMODE_node->var_value->flags
are causing the string parsing code to be skipped.  I'm not
exactly sure why...

Regards,
Andy




reply via email to

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