NetBSD Problem Report #41159
From dholland@eecs.harvard.edu Mon Apr 6 14:04:42 2009
Return-Path: <dholland@eecs.harvard.edu>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 24AF363B8A5
for <gnats-bugs@gnats.NetBSD.org>; Mon, 6 Apr 2009 14:04:42 +0000 (UTC)
Message-Id: <20090406140251.76179F981@tanaqui.eecs.harvard.edu>
Date: Mon, 6 Apr 2009 10:02:51 -0400 (EDT)
From: dholland@eecs.harvard.edu
Reply-To: dholland@eecs.harvard.edu
To: gnats-bugs@gnats.NetBSD.org
Subject: paste(1) delimiter bug
X-Send-Pr-Version: 3.95
>Number: 41159
>Category: bin
>Synopsis: paste(1) delimiter bug
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Apr 06 14:05:00 +0000 2009
>Closed-Date: Mon May 18 20:33:35 +0000 2009
>Last-Modified: Mon May 18 20:33:35 +0000 2009
>Originator: David A. Holland
>Release: NetBSD 5.99.7 (20090222)
>Organization:
>Environment:
System: NetBSD tanaqui 5.99.7 NetBSD 5.99.7 (TANAQUI) #24: Mon Feb 9 11:19:51 EST 2009 root@tanaqui:/usr/src/sys/arch/i386/compile/TANAQUI i386
Architecture: i386
Machine: i386
>Description:
When given the -d '\0' option to use no delimiters, paste
inserts a spurious '0' character at the beginning of each
line.
>How-To-Repeat:
paste -d '\0' file1.txt file2.txt
>Fix:
It turns out to depend on the null-termination of the
delimiter list string, but doesn't ensure the string remains
null-terminated after evaluating escape sequences.
I will commit this in due course; this PR is mostly to make
sure I don't forget about it.
Index: paste.c
===================================================================
RCS file: /cvsroot/src/usr.bin/paste/paste.c,v
retrieving revision 1.14
diff -u -p -r1.14 paste.c
--- paste.c 21 Jul 2008 14:19:24 -0000 1.14
+++ paste.c 6 Apr 2009 13:58:53 -0000
@@ -221,6 +221,7 @@ tr(char *arg)
if (!cnt)
errx(1, "no delimiters specified.");
+ *arg = '\0';
return(cnt);
}
>Release-Note:
>Audit-Trail:
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/41159 CVS commit: src/usr.bin/paste
Date: Tue, 7 Apr 2009 01:52:27 +0000
Module Name: src
Committed By: dholland
Date: Tue Apr 7 01:52:26 UTC 2009
Modified Files:
src/usr.bin/paste: paste.c
Log Message:
Null-terminate the delimiter list string after processing escapes
(which can shorten it) because the code that issues delimiters depends
on it being null-terminated. This caused e.g. paste -d '\0' a b to
print a '0' at the beginning of each line. Closes PR 41159.
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/paste/paste.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->pending-pullups
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 18 May 2009 06:47:03 +0000
State-Changed-Why:
pullup-5 #766, pullup-4 #1319
From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/41159 CVS commit: [netbsd-4] src/usr.bin/paste
Date: Mon, 18 May 2009 18:30:02 +0000
Module Name: src
Committed By: bouyer
Date: Mon May 18 18:30:02 UTC 2009
Modified Files:
src/usr.bin/paste [netbsd-4]: paste.c
Log Message:
Pull up following revision(s) (requested by dholland in ticket #1319):
usr.bin/paste/paste.c: revision 1.15
Null-terminate the delimiter list string after processing escapes
(which can shorten it) because the code that issues delimiters depends
on it being null-terminated. This caused e.g. paste -d '\0' a b to
print a '0' at the beginning of each line. Closes PR 41159.
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.6.1 src/usr.bin/paste/paste.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/41159 CVS commit: [netbsd-5] src/usr.bin/paste
Date: Mon, 18 May 2009 20:00:49 +0000
Module Name: src
Committed By: bouyer
Date: Mon May 18 20:00:49 UTC 2009
Modified Files:
src/usr.bin/paste [netbsd-5]: paste.c
Log Message:
Pull up following revision(s) (requested by dholland in ticket #766):
usr.bin/paste/paste.c: revision 1.15
Null-terminate the delimiter list string after processing escapes
(which can shorten it) because the code that issues delimiters depends
on it being null-terminated. This caused e.g. paste -d '\0' a b to
print a '0' at the beginning of each line. Closes PR 41159.
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.4.1 src/usr.bin/paste/paste.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: pending-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 18 May 2009 20:33:35 +0000
State-Changed-Why:
all done
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.