Subject: Awk change in 1.3.2
To: None <tech-userlevel@NetBSD.ORG>
From: Terry Moore <tmm@mcci.com>
List: tech-userlevel
Date: 07/02/1998 19:33:51
[Jonathon Stone pointed out that this was posted to the wrong place
(port-i386) orginally.  I'm moving it to tech-userlevel, because
I reckon I'm about to get an education.]

We've upgraded from (i386) 1.0, and I am putting the first machine 
into production use.

We have a number of awk scripts with the construct

	' { blah blah } END {print}'

in them.  The intent is to get an extra newline at the end of the
output file.  (For example, '{ printf("%s\\\n", $1) } END {print}' 
extracts the first field, puts backslashes at the end of each line,
and prints an extra newline.  Good for building makefiles, which is
what I'm doing.

This works great in SunOS 4.1.3 (awk/nawk) and in 1.0 (which has
gawk 2.15 pl 5).

For example,
	echo foo | awk 'END {print}'
prints nothing.
	echo foo | awk '{print} END {print}'
prints one line of 'foo', followed by a blank line.

1.3.2 has upgraded to 2.15 pl 6.  This version has a different behavior,
which may or may not be intended:

	echo foo | awk 'END {print}'

prints 'foo'.

More annoying
	echo foo | awk '{print} END {print}'
prints
	foo
	foo

I think this is a bug; it's certainly an annoying compatibility problem.
It looks like it was on purpose:  

In usr.gnu/gawk/NEWS, toward the end of the list of enhancements for 2.15.6:

	Major enhancement: $0 and NF for last record read are now preserved
	into the END rule (io.c).

This, of course, is what I'm seeing.  Unfortunately, it breaks a lot of our 
scripts.

What is the policy on the gnu utilities?  Do I send-pr to NetBSD?
I've tried following the man page's "send email to 
bug-gnu-utils@prep.ai.mit.edu, with  a  carbon  copy  
to arnold@gnu.ai.mit.edu", and the 'bug-gnu-utils' bounced.

I can work around by reverting to the old version of awk, but....
should I send-pr this? 

--Terry