Date: Sat, 30 Jan 2010 09:17:10 GMT From: Mikolaj Golub <to.my.trociny@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/143363: [patch] incorrect handling of \ at the end of line in awk(1) Message-ID: <201001300917.o0U9HAlP093870@www.freebsd.org> Resent-Message-ID: <201001300920.o0U9K0qN070332@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001300917.o0U9HAlP093870>