YAAB (Yet another awk bug)
    Mark Plotnick 
    mp at allegra.UUCP
       
    Fri Sep 13 09:35:58 AEST 1985
    
    
  
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
    
    
More information about the Net.bugs
mailing list