🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs
Article #465

Re: YAAB (Yet another awk bug)

#465
From: Mark Plotnick
Date: Thu, 12 Sep 1985 23:35
23 lines
1495 bytes
As long as we're telling our favorite awk bugs, here's mine.

(Karl Heuer, whuxlb!kwh, discovered this bug)

In run.c, routine program(), there's a call to tempfree(x) at a point where
x may still be uninitialized if the awk script doesn't have any
BEGIN actions and doesn't have any input.  

	awk 'END { print NR }' </dev/null

will run into the problem.

On 4.2bsd, x is an automatic variable (a struct), and the garbage it
contains will usually cause nothing bad to happen.
But, on SVR2, x is a register ptr.  On a vax it's register 10, and
its value is inherited from whatever was in register 10 at the time awk
was exec'ed (e.g. the variable p in the execs() routine in the shell).
When run under ksh, the above awk program gets a memory fault.  When
run under sh or sdb, it works OK.  Do you know what a pain it is to have
a program fail under the shell and work fine when run under a debugger?

	Mark Plotnick
	allegra!mp
Technical Details
Message-ID: <5098@allegra.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!mp
References: <224@ur-cvsvax.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site allegra.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!mp
From: mp@allegra.UUCP (Mark Plotnick)
Newsgroups: net.bugs
Subject: Re: YAAB (Yet another awk bug)
Message-ID: <5098@allegra.UUCP>
Date: Thu, 12-Sep-85 19:35:58 EDT
Article-I.D.: allegra.5098
Posted: Thu Sep 12 19:35:58 1985
Date-Received: Fri, 13-Sep-85 05:01:55 EDT
References: <224@ur-cvsvax.UUCP>
Organization: AT&T Bell Laboratories, Murray Hill
Lines: 23