Debian bug report logs - #737
gawk references to `$0' in END rule give previous record
Package: gawk; Reported by: iwj10@cus.cam.ac.uk (Ian Jackson); 210 days old.
Message received at debian-bugs:
From cus.cam.ac.uk!iwj10 Tue Apr 4 09:26:03 1995
Return-Path: <iwj10@cus.cam.ac.uk>
Received: from pixar.com by mongo.pixar.com with smtp
(Smail3.1.28.1 #15) id m0rwBQY-0006VUC; Tue, 4 Apr 95 09:26 PDT
Received: from bootes.cus.cam.ac.uk by pixar.com with SMTP id AA19494
(5.65c/IDA-1.4.4 for <debian-bugs@pixar.com>); Tue, 4 Apr 1995 09:25:41 -0700
Received: by bootes.cus.cam.ac.uk
(Smail-3.1.29.0 #30) id m0rw971-000C0yC; Tue, 4 Apr 95 14:57 BST
Received: by chiark
id m0rw7I5-0000YSZ
(Debian /\oo/\ Smail3.1.29.1 #29.27); Tue, 4 Apr 95 13:01 BST
Message-Id: <m0rw7I5-0000YSZ.ijackson@nyx.cs.du.edu>
Date: Tue, 4 Apr 95 13:01 BST
From: iwj10@cus.cam.ac.uk (Ian Jackson)
To: Debian bugs submission address <debian-bugs@pixar.com>
Subject: gawk references to `$0' in END rule give previous record
Package: gawk
Version: 2.15.6-1
chiark:~/junk> cat t
BEGIN { print "begin rule here >", $0, "<"; }
/./ { print ". rule here >", $0, "<"; }
END { print;
print "end rule just done >", $0, "<"; }
chiark:~/junk> /usr/bin/awk -f t </etc/host.conf
begin rule here > <
. rule here > order hosts,bind <
. rule here > multi on <
multi on
end rule just done > multi on <
chiark:~/junk> cat /etc/host.conf
order hosts,bind
multi on
chiark:~/junk>
As you can see, the `print' and `print "end rule ..."' statements are
using the value of $0 for the last record.
However, according to the gawk info file (node BEGIN/END, at the very
bottom):
`BEGIN' and `END' rules must have actions; there is no default
action for these rules since there is no current record when they run.
This implies that $0 should be empty.
I discovered this bug when trying to build the latest version of the
smail package. It contains an awk script that does a bare `print' in
the END rule, expecting a blank line, but instead gets the final line
of the input file. This causes the build to fail.
Ian.
Acknowledgement sent to iwj10@cus.cam.ac.uk (Ian Jackson)
:
New bug report received and forwarded.
Full text available.
Report forwarded to debian-devel@pixar.com
:
Bug#737
; Package gawk
.
Full text available.
Ian Jackson /
iwj10@thor.cam.ac.uk,
with the debian-bugs tracking mechanism