[Top][All Lists]

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

Re: Possible bug in Gawk 3.1.3-7 under Fedora Core 2

From: Stepan Kasal
Subject: Re: Possible bug in Gawk 3.1.3-7 under Fedora Core 2
Date: Sat, 10 Jul 2004 08:30:48 +0200
User-agent: Mutt/1.4.1i


On Fri, Jul 09, 2004 at 01:42:56PM -0600, Richard Nolde wrote:
>    That does in fact make it work, but why the change and when was it
> documented?  The sample on page 230 of "Sed and Awk" 2nd edition by
> Doughtery and Robbins (who ought to know) uses the quoted external
> command but without any  variable interpolation. eg "date", so it
> is unclear that the parens now need to be added to scripts that
> worked before.

it was already explained that book is right, the problem is when
there is an operation to the left of the pipe, eg:

        "da" "te" | getline

This command is ambiguous, as it can be interpreted like:

        ("da" "te") | getline
        "da" ("te" | getline)

Older versions of gawk took the former, while 3.1.2 and newer take
the later.  (Search gawk's ChangeLog file for "getline".)
POSIX documentation mentions this specific situation: it says that
the behaviour is undefined, and that you have to parenthesize.

When I changed the behaviour, there were various reasons.
The change meant that the awkgram.y is now cleaner, and I recall
(though I'm not sure) that it fixed the buggy
        cmd | getline x + 1
which was not understood previously and should be interpreted as
        (cmd | getline x) + 1
This was a real bug, as it was a problem with correct awk program.

Anyway, I remember that Arnold and I were considering this and
I managed to convince him that the cleanup is worth sacrifying
some backward compatibility for broken awk scripts.

I hope this explains it.  I apologize for any inconvenience this
may have caused.

        Stepan Kasal

reply via email to

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