Subject: Re: bug#8532: FAIL: cp/sparse-fiemap

From: "Alan Curry" <[email-masked]>
Date: Fri, 22 Apr 2011 04:43:33 -0500 (GMT+5)

Jim Meyering writes:
> 
> Alan Curry wrote:
> >
> > Parenthesizing the ternary expression makes it happy again.
> >
> >> BTW, that syntax works for me using the latest gawk with or without -W c=
> ompat,
> >> and with the mawk and nawk programs from debian unstable.
> >
> > apt-get install original-awk
> 
> Thanks.
> This patch fixes it, and I've closed the ticket.
> 
> Alan, I'll wait for you to "ack" before pushing it,
> since I've listed you as the author.

Yeah, it looks right.

I looked over the POSIX grammar for awk and I believe it requires some
parentheses here, either around the whole ternary expression or around the
comparison part of it. The key is the difference between non_unary_expr and
non_unary_print_expr. The "print" version is in effect wherever a
redirection operator might appear, and it doesn't have any of the 6
comparison operators < = > <= >= !=

The ability to do a comparison (other than '>') without parentheses in
an argument to print is an extension. From a quick peek at the gawk
ChangeLog I'd guess that it happened here:

Sun Feb  2 15:32:42 2003  Stepan Kasal  <[email-masked]>
[...]
        The redirection of print statements reworked.  The idea comes from
        mawk-1.3.3; much thanks to Michael Brennan!

which puts it between gawk 3.1.1 and 3.1.2.

I noticed that Dennis Clarke reports he's using gawk 3.0.1 out of
/usr/local/bin on a Debian squeeze system, which should have gawk 3.1.7
in /usr/bin. Seems like an odd thing to do. Installed the local version
a long time ago and forgot to remove it when the version in /usr/bin
surpassed it? Something like that has happened to me at least once
before.

-- 
Alan Curry