campbell@redsox.bsw.com (Larry Campbell) (09/28/89)
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. The following examples demonstrate the bug: oawk is OK: % echo 'foo > bar > zot' | > oawk ' > ! ( /foo/ || /bar/ ) { printf "%s: no foo or bar here\n", $0 } > ' zot: no foo or bar here % but nawk barfs: % echo 'foo > bar > zot' | > nawk ' > ! ( /foo/ || /bar/ ) { printf "%s: no foo or bar here\n", $0 } > ' awk: syntax error at source line 2 context is ! ( >>> / <<< foo/ || /bar/ ) { printf "%s: no foo or bar here\n", $0 } awk: bailing out at source line 2 I wonder if this is AT&T's fault or ISC's? (I reported the bug to ISC two weeks ago and have not received an acknowledgement...) -- Larry Campbell The Boston Software Works, Inc. campbell@bsw.com 120 Fulton Street wjh12!redsox!campbell Boston, MA 02146
pb@idca.tds.PHILIPS.nl (Peter Brouwer) (09/28/89)
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 ................ >oawk is OK: > >% echo 'foo >> bar >> zot' | >> oawk ' >> ! ( /foo/ || /bar/ ) { printf "%s: no foo or bar here\n", $0 } >> ' I don't have nawk yet but I have a suggestion: $0 !~/foo|bar/ { print $0 ": no foo or bar here"} This works in the old version of awk. Note that its not necessary to use the printf statement in this case (Its performance expensive statement). See also Unix SYSTEM V/386 Release 3.2 Programmers guide Vol1 page 4-18 -- Peter Brouwer, # Philips Telecommunications and Data Systems, NET : pb@idca.tds.philips.nl # Department SSP-P9000 Building V2, UUCP : ....!mcvax!philapd!pb # P.O.Box 245, 7300AE Apeldoorn, The Netherlands. PHONE:ext [+31] [0]55 432523, # Never underestimate the power of human stupidity
bsrdp@warwick.ac.uk (H Boothroyd) (09/28/89)
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 -----------------------
sar0@cbnewsl.ATT.COM (stephen.a.rago) (09/30/89)
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. The > following examples demonstrate the bug: > > oawk is OK: > > % echo 'foo > > bar > > zot' | > > oawk ' > > ! ( /foo/ || /bar/ ) { printf "%s: no foo or bar here\n", $0 } > > ' > zot: no foo or bar here > % > > but nawk barfs: > awk: syntax error at source line 2 > > I wonder if this is AT&T's fault or ISC's? I experienced the same phenomenon on a 3B2 running vanilla SVR3.2. The problem seems to be fixed in SVR4.0, though. Steve Rago sar@attunix.att.com
arnold@mathcs.emory.edu (Arnold D. Robbins {EUCC}) (10/04/89)
}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. In article <264@orchid.warwick.ac.uk> bsrdp@warwick.ac.uk (H Boothroyd) writes: >A version of gawk gave me exactly the same problem here when I switched >a news script to it last week: [version deleted] > >However, an earlier MSDOS version has no problems with parsing the compound >pattern: [version deleted] > >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. The code is NOT being copied! That would totally destroy the GNU code, since it must be written without recourse to Unix source code. The truth is that both versions have the bug. It is also fixed in the latest versions of both nawk and gawk. Gawk 2.11 isn't released yet but should be out "shortly". A recent nawk can be gotten from the toolchest and a version that will be as up-to-date as possible will be in S5R4. It is not as easy as it looks to come up with a correct grammar for the AWK language. AWK is often a joy to use but a bear to implement. There are lots of dark corners and bizarre combinations of features just waiting to bite you. We (the gnu awk implementors) have been in constant communication with Brian Kernighan for almost two years; as a result both nawk and gawk have improved, and many small points have been clarified. -- Arnold Robbins -- Emory Information Technology Division | Laundry increases DOMAIN: arnold@emoryu1.cc.emory.edu | exponentially in the UUCP: gatech!emoryu1!arnold PHONE: +1 404 727-7636 | number of children. BITNET: arnold@emoryu1 FAX: +1 404 727-2599 | -- Miriam Hartholz