From owner-freebsd-bugs@freebsd.org Tue Apr 5 22:19:04 2016 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6D1AB030BC for ; Tue, 5 Apr 2016 22:19:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBD9B1D3E for ; Tue, 5 Apr 2016 22:19:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u35MJ4ST009991 for ; Tue, 5 Apr 2016 22:19:04 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 208554] usr.bin/sed :sed functions 'i' and 'a' discard leading white space Date: Tue, 05 Apr 2016 22:19:04 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 11.0-CURRENT X-Bugzilla-Keywords: patch X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: bdrewery@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 22:19:04 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D208554 Bryan Drewery changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bdrewery@FreeBSD.org --- Comment #1 from Bryan Drewery --- I think this makes sense as otherwise you cannot control whitespace in the line you are adding. Reading opengroup there's no mention of eating whitespace on these commands either. *However*, we've had this particular behavior forever, since at least r1591. The removal in NetBSD follows it accidentally being added back in 2014. The real removal came in 2004: > commit 39dd7ae9eebb61b8b83c15e441faa17593a5ec8d > Author: matt > Date: Wed Nov 17 22:17:54 2004 +0000 > > When adding text due to an a, c, or i command, don't eat the space(s)= at > the beginning of the lines since the addition is supposed to be "verb= atim". > Fix a comment for compile_text indicating it's also used for the 'c' = command. > > diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c > index 4ae0e53..4a185de 100644 > --- a/usr.bin/sed/compile.c > +++ b/usr.bin/sed/compile.c > @@ -1,4 +1,4 @@ > -/* $NetBSD: compile.c,v 1.30 2004/07/09 23:43:07 enami Exp $ */ > +/* $NetBSD: compile.c,v 1.31 2004/11/17 22:17:54 matt Exp $ */ >=20=20 > /*- > * Copyright (c) 1992, 1993 > @@ -72,7 +72,7 @@ > #if 0 > static char sccsid[] =3D "@(#)compile.c 8.2 (Berkeley) 4/28/95"; > #else > -__RCSID("$NetBSD: compile.c,v 1.30 2004/07/09 23:43:07 enami Exp $"); > +__RCSID("$NetBSD: compile.c,v 1.31 2004/11/17 22:17:54 matt Exp $"); > #endif > #endif /* not lint */ >=20=20 > @@ -666,7 +666,7 @@ compile_tr(char *p, char **transtab) > } >=20=20 > /* > - * Compile the text following an a or i command. > + * Compile the text following an a, c, or i command. > */ > static char * > compile_text(void) > @@ -681,7 +681,6 @@ compile_text(void) > while (cu_fgets(lbuf, sizeof(lbuf))) { > op =3D s =3D text + size; > p =3D lbuf; > - EATSPACE(); > for (; *p; p++) { > if (*p =3D=3D '\\') > p++; I support removing it, especially since GNU and NetBSD do so as well and it gives more control to the user. --=20 You are receiving this mail because: You are the assignee for the bug.=