bin/143363: [patch] incorrect handling of \ at the end of line in
awk(1)
Mikolaj Golub
to.my.trociny at gmail.com
Sat Jan 30 09:20:01 UTC 2010
>Number: 143363
>Category: bin
>Synopsis: [patch] incorrect handling of \ at the end of line in awk(1)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Jan 30 09:20:00 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Mikolaj Golub
>Release: FreeBSD zhuzha.ua1 8.0-STABLE FreeBSD 8.0-STABLE #6: Sun Jan 24 21:36:17 EET 2010 root at zhuzha.ua1:/usr/obj/usr/src/sys/GENERIC i386
>Organization:
>Environment:
>Description:
awk(1) handles incorrectly \ at the end of line (inserts additional empty line).
This problem with awk(1) was reported to NetBSD by Aleksey Cheusov and it was fixed there.
http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=37212
FreeBSD version still has this bug.
>How-To-Repeat:
Run the following script. awk(1) inserts an empty line after each useful line.
#!/usr/bin/awk -f
function usage (){
print "usage: program_name [OPTION] [files...]\n\
OPTIONS:\n\
-h|--help display this screen\n\
-V|--version version\n\
"
exit 0
}
BEGIN {
usage()
}
>Fix:
See the attached patch adopted from NetBSD.
Patch attached with submission follows:
--- contrib/one-true-awk.orig/lex.c 2007-06-05 18:33:51.000000000 +0300
+++ contrib/one-true-awk/lex.c 2010-01-30 10:58:42.000000000 +0200
@@ -378,6 +378,7 @@
case '\\':
c = input();
switch (c) {
+ case '\n': break;
case '"': *bp++ = '"'; break;
case 'n': *bp++ = '\n'; break;
case 't': *bp++ = '\t'; break;
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list