bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Possible gawk Bug--Handling of --source Option


From: arnold
Subject: Re: [bug-gawk] Possible gawk Bug--Handling of --source Option
Date: Fri, 14 Apr 2017 05:43:08 -0600
User-agent: Heirloom mailx 12.4 7/29/08

Hi.

Thanks for the note.  Gawk internals changed along the way and the
manual wasn't updated. Igawk dates from ~ 20 years ago, so it's
not a good guide.

I will see if the old behavior can be restored, but I happen to
want the new behavior for some new features being planned.

In short, I need to review the code and think about this a bit.

Thanks!

Arnold

"Neil R. Ormos" <address@hidden> wrote:

> I have a question about a behavior of gawk 4.1.1 which differs from that in 
> 3.1.7.  I'm not sure if it's a bug.
>
> The possible bug relates how gawk handles program text provided on the 
> command line in an argument to a --source= option.
>
> Older gawk (e.g. 3.1.7) appears to allow the statements of a single action to 
> be distributed among several --source= arguments that appear on the command 
> line invoking gawk.
>
> The gawk in Debian Stable (e.g. 4.1.1) appears to require that any action 
> opened in a --source= argument be closed in the same argument, so that an 
> action cannot span multple --source= arguments.
>
> As far as I can tell, the the GNU Awk User's Guide does not directly specify 
> either the new or the old behavior.  However, the manual's section directed 
> to the igawk shell-wrapper script [*], that provides a mechanism for 
> including files but otherwise appears to be intended to simulate invoking 
> gawk the ordinary way, characterizes the wrapper script's handling of a 
> --source argument as, "The source text is appended to program".  
>
> [*] http://www.gnu.org/software/gawk/manual/gawk.html#Igawk-Program
>
> ############################################################
> ### OLD ###
>
> > lsb_release -d
> Description:    Debian GNU/Linux 6.0.10 (squeeze)
>
> > gawk --version
> GNU Awk 3.1.7
> [...]
>
> > gawk --source='BEGIN{a=5};' --source='BEGIN{print a}'
> 5
>
> > gawk --source='BEGIN{a=5; ' --source='print a}'
> 5
>
> ############################################################
> ### NEW ###
>
> > lsb_release -d
> Description:  Debian GNU/Linux 8.7 (jessie)
>
> > gawk --version
> GNU Awk 4.1.1, API: 1.1 (GNU MPFR 3.1.2-p3, GNU MP 6.0.0)
> [...]
>
> > gawk --source='BEGIN{a=5};' --source='BEGIN{print a}'
> 5
>
> > gawk --source='BEGIN{a=5; ' --source='print a}'
> gawk: cmd. line:1: BEGIN{a=5;
> gawk: cmd. line:1:            ^ unexpected newline or end of string
>
> ############################################################
>
> This seems like a bug to me, but I don't know if the completeness of a 
> --source argument is specified more definitively somewhere other than in the 
> User's Guide.
>
> Thanks for your help.
>
> Best regards,
>
> --Neil Ormos



reply via email to

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