bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] BEGINFILE/ENDFILE bug?


From: Ed Morton
Subject: Re: [bug-gawk] BEGINFILE/ENDFILE bug?
Date: Thu, 22 May 2014 07:38:03 -0500
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

Thanks Arnold & Andy  for the quick turnaround and excellent support, as always.

    Ed.

On 5/21/2014 10:22 PM, Aharon Robbins wrote:
Hi Andy and Ed.

I finally found some time to review this. Andy's patch is correct. I've
applied it and pushed the changes out.

Andy - thanks for the patch.  In the future, can you include ChangeLog
entries in your proposed patches?  Usually your patches are correct
(that's a complement :-), and it makes it easier to apply them if the
ChangeLog entries are already there.

Thanks for the report (Ed) and for the fix (Andy). I really appreciate it.

Andy's answers to the other questions are on target too. Non-redirected
getline in BEGINFILE/ENDFILE is invalid --> not allowed, gawk quits.
Inside END it's undefined meaning no guarantees about what's going to
happen.  In general if you do

        END { n = getline; print n }

you'll get 0 for end of file:

        $ for i in nawk mawk mksawk 'busybox awk' gawk
        > do echo ========= $i
        > $i 'END { n = getline; print n }' /dev/null
        > done
        ========= nawk
        0
        ========= mawk
        0
        ========= mksawk
        0
        ========= busybox awk
        Segmentation fault (core dumped)
        ========= gawk
        0

Ooops. Looks like Busybox awk forgot a corner case. :-)


Arnold





reply via email to

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