NetBSD Problem Report #49872
From www@NetBSD.org Sun May 3 09:26:54 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 7494BA6562
for <gnats-bugs@gnats.NetBSD.org>; Sun, 3 May 2015 09:26:54 +0000 (UTC)
Message-Id: <20150503092653.78729A6567@mollari.NetBSD.org>
Date: Sun, 3 May 2015 09:26:53 +0000 (UTC)
From: yorickhardy@gmail.com
Reply-To: yorickhardy@gmail.com
To: gnats-bugs@NetBSD.org
Subject: sed functions 'i' and 'a' discard leading white space
X-Send-Pr-Version: www-1.0
>Number: 49872
>Category: bin
>Synopsis: sed functions 'i' and 'a' discard leading white space
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun May 03 09:30:00 +0000 2015
>Closed-Date: Tue Apr 05 06:08:07 +0000 2016
>Last-Modified: Tue Apr 05 06:08:07 +0000 2016
>Originator: Yorick Hardy
>Release: NetBSD 7.0_BETA
>Organization:
>Environment:
NetBSD HOME 7.0_BETA NetBSD 7.0_BETA (YORICK.amd64) #0: Fri Apr 24 06:20:00 SAST 2015 root@HOME:/root/build.amd64.local7/obj/sys/arch/amd64/compile/YORICK.amd64 amd64
>Description:
sed functions 'a' and 'i' discard leading white space of the inserted/appended line(s) of text.
If I recall correctly, this was not true in previous releases of NetBSD.
>How-To-Repeat:
Script started on Sun May 3 11:19:58 2015
$ cat << "EOF" > test.sed
> a\
> test 1
> i\
> test 2
> EOF
$ vis -l < test.sed
a\134\$
test 1 \$
i\134\$
test 2 \$
$ echo | sed -f test.sed | vis -l
test 2 \$
\$
test 1 \$
$ D ^D
Script done on Sun May 3 11:20:33 2015
>Fix:
>Release-Note:
>Audit-Trail:
From: Yorick Hardy <yorickhardy@gmail.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/49872: sed functions 'i' and 'a' discard leading white space
Date: Mon, 4 Apr 2016 23:21:11 +0200
This seems to restore the previous behaviour, but I am not 100% sure
that it does not break anything else.
--
Kind regards,
Yorick Hardy
Index: usr.bin/sed/compile.c
===================================================================
RCS file: /cvsroot/src/usr.bin/sed/compile.c,v
retrieving revision 1.43
diff -u -r1.43 compile.c
--- usr.bin/sed/compile.c 26 Jun 2014 02:14:32 -0000 1.43
+++ usr.bin/sed/compile.c 4 Apr 2016 21:19:05 -0000
@@ -747,7 +747,6 @@
while (cu_fgets(lbuf, sizeof(lbuf), NULL)) {
op = s = text + size;
p = lbuf;
- EATSPACE();
for (esc_nl = 0; *p != '\0'; p++) {
if (*p == '\\' && p[1] != '\0' && *++p == '\n')
esc_nl = 1;
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/49872 CVS commit: src/tests/usr.bin/sed
Date: Mon, 4 Apr 2016 20:48:53 -0400
Module Name: src
Committed By: christos
Date: Tue Apr 5 00:48:53 UTC 2016
Modified Files:
src/tests/usr.bin/sed: t_sed.sh
Log Message:
Add test for PR/49872
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/sed/t_sed.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Tue, 05 Apr 2016 06:08:07 +0000
State-Changed-Why:
Christos fixed it, thanks!
>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-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.