From owner-freebsd-bugs@FreeBSD.ORG Sat Jan 30 09:20:01 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FDD3106566B for ; Sat, 30 Jan 2010 09:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 33A718FC34 for ; Sat, 30 Jan 2010 09:20:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id o0U9K0La070333 for ; Sat, 30 Jan 2010 09:20:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id o0U9K0qN070332; Sat, 30 Jan 2010 09:20:00 GMT (envelope-from gnats) Resent-Date: Sat, 30 Jan 2010 09:20:00 GMT Resent-Message-Id: <201001300920.o0U9K0qN070332@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Mikolaj Golub Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B328106568D for ; Sat, 30 Jan 2010 09:17:10 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 6AF248FC1B for ; Sat, 30 Jan 2010 09:17:10 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o0U9HAu0093871 for ; Sat, 30 Jan 2010 09:17:10 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o0U9HAlP093870; Sat, 30 Jan 2010 09:17:10 GMT (envelope-from nobody) Message-Id: <201001300917.o0U9HAlP093870@www.freebsd.org> Date: Sat, 30 Jan 2010 09:17:10 GMT From: Mikolaj Golub To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/143363: [patch] incorrect handling of \ at the end of line in awk(1) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jan 2010 09:20:01 -0000 >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: