Xref: utzoo comp.unix.i386:604 comp.bugs.sys5:1153
Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!ginosko!uunet!mcsun!ukc!warwick!bsrdp
From: bsrdp@warwick.ac.uk (H Boothroyd)
Newsgroups: comp.unix.i386,comp.bugs.sys5
Subject: Re: 386/ix V2.0.2 breaks awk
Summary: The parsing problem is more widespread
Message-ID: <264@orchid.warwick.ac.uk>
Date: 28 Sep 89 16:17:44 GMT
References: <1456@redsox.bsw.com>
Organization: Warwick Business School, Warwick University, UK
Lines: 48

In article <1456@redsox.bsw.com> campbell@redsox.bsw.com (Larry
Campbell) writes:
> A few weeks ago, I upgraded my 386/ix system from 2.0.1 to 2.0.2, and one of
> my nightly news administration scripts broke.  The problem is caused by a
> bug in nawk, which in 2.0.2 seems to have become the standard awk.
[Example deleted]

A version of gawk gave me exactly the same problem here when I switched
a news script to it last week:
        Gnu Awk (gawk) 2.10 beta 07 Apr 1989
running on a Sun 4.

However, an earlier MSDOS version has no problems with parsing the compound
pattern:
        Gnu Awk (gawk) 2.02 beta (PC) 23 Dec 1988 .

From the evidence of the experience of Larry and me, in such widely
different
contexts, my provisional conclusions are:
     * the parsing bug is a 1989 creation of awk/gawk programmers,
     * the defective code is being copied around the awk/gawk world.

Experiments show that the nearest to full generality that the 2.10
parser can manage with plain patterns of the form /regularexpression/
is:
        /re/ && .... && $0~/re/ && ...
in which
        all plain /re/ forms must come first and
        no parentheses can be used round plain /re/ forms.

Which is a far cry from the specification in the awk book!

There is a workaround. Turn all the patterns into the $0~/re/ form.
This seems to restore generality in the use of parentheses.

But it was an odd oversight to let this creep in. What sort of test
suites are used that don't check parsing?

And as end users are we, and our system administrators, unaware of upgrades
that correct this rather glaring fault?

-----------------------
Hylton Boothroyd        Janet: h.boothroyd@uk.ac.warwick.cu
Warwick Business School Darpa: h.boothroyd%cu.warwick.ac.uk@relay-nsfnet.ac.uk
University of Warwick   Uucp:  h.boothroyd%sol@warwick.uucp
COVENTRY                Earn/Bitnet: h.boothroyd%uk.ac.warwick.cu@UKACRL
England  CV4 7AL        Phone: +44 203 523523  Extension 2428
-----------------------