Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!oliveb!sun!gorodish!guy From: guy%gorodish@Sun.COM (Guy Harris) Newsgroups: news.misc,comp.mail.misc Subject: Re: Two perhaps-useful awk scripts for news and mail Message-ID: <11223@sun.uucp> Date: Sat, 10-Jan-87 00:42:40 EST Article-I.D.: sun.11223 Posted: Sat Jan 10 00:42:40 1987 Date-Received: Sat, 10-Jan-87 06:19:24 EST References: <2731@j.cc.purdue.edu> <314@rlgvax.UUCP> Sender: news@sun.uucp Lines: 24 Keywords: news, mail, logs, summary Summary: It's a pretty-universal "awk" bug; check comp.bugs.4bsd or comp.bugs.sys5 for the fix. Xref: mnetor news.misc:146 comp.mail.misc:27 > I tried running the news awkfile and it dropped a core. > Below is what happened (output from script(1)). > I am not an awk expert. Does anybody have any ideas, or > can anybody else reproduce the errors on a different > machine? We are running SVr2/4.2 hybrid, and I > am guessing that its the SVr2 awk we are running. Yes, and yes. It's a bug in "awk"; I reproduced it on several different machines. It's in every version of "awk" I could find; the fix is in comp.bugs.4bsd (for the 4.[123]BSD "awk", or the one distributed with the update tape that came out for V7) or comp.bugs.sys5 (a fix for S5R2 and later, and one for the original V7 one and the S3 and S5R1 one). The problem is that the "awk" program in question has a number of nasty syntax errors. The bug is triggered by syntax errors in certain circumstances. From the syntax errors in the program, it looks like the "awk" program was passed as an argument to "awk" inside double quotes. Unfortunately, the "awk" program probably contains references to fields; these are of the form "$1", "$2", ..., and since the shell expands those constructs inside arguments enclosed in double quotes, and those shell variables didn't have values, those references to fields were replaced with null strings. If it's enclosed in single quotes, no expansion is done, so single quotes should be used for this.