X-Loop: help-debbugs@HIDDEN Subject: bug#22427: Odd behaviour of sed with n/N and line ranges Resent-From: Eric Blake <eblake@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-sed@HIDDEN Resent-Date: Thu, 21 Jan 2016 20:03:02 +0000 Resent-Message-ID: <handler.22427.B.145340655130226 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 22427 X-GNU-PR-Package: sed X-GNU-PR-Keywords: To: 22427 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-sed@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.145340655130226 (code B ref -1); Thu, 21 Jan 2016 20:03:02 +0000 Received: (at submit) by debbugs.gnu.org; 21 Jan 2016 20:02:31 +0000 Received: from localhost ([127.0.0.1]:56713 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1aMLR8-0007rS-Kf for submit <at> debbugs.gnu.org; Thu, 21 Jan 2016 15:02:30 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49832) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from <eblake@HIDDEN>) id 1aMLR6-0007rA-An for submit <at> debbugs.gnu.org; Thu, 21 Jan 2016 15:02:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <eblake@HIDDEN>) id 1aMLQw-0000CC-6f for submit <at> debbugs.gnu.org; Thu, 21 Jan 2016 15:02:23 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:49308) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eblake@HIDDEN>) id 1aMLQw-0000C8-3W for submit <at> debbugs.gnu.org; Thu, 21 Jan 2016 15:02:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <eblake@HIDDEN>) id 1aMLQv-0000xi-3K for bug-sed@HIDDEN; Thu, 21 Jan 2016 15:02:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <eblake@HIDDEN>) id 1aMLQr-0000BE-TW for bug-sed@HIDDEN; Thu, 21 Jan 2016 15:02:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eblake@HIDDEN>) id 1aMLQr-0000B8-NO for bug-sed@HIDDEN; Thu, 21 Jan 2016 15:02:13 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 2A11C8F271 for <bug-sed@HIDDEN>; Thu, 21 Jan 2016 20:02:13 +0000 (UTC) Received: from [10.3.113.211] (ovpn-113-211.phx2.redhat.com [10.3.113.211]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0LK2Cti020684 for <bug-sed@HIDDEN>; Thu, 21 Jan 2016 15:02:12 -0500 References: <20160121103800.GA32572@HIDDEN> <CAOS_Y6RY_aREsZ3aOHr5rTA1uS5JVsEUvLHpbLA-Uu+_UdMvvA@HIDDEN> From: Eric Blake <eblake@HIDDEN> Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Organization: Red Hat, Inc. Message-ID: <56A13944.20602@HIDDEN> Date: Thu, 21 Jan 2016 13:02:12 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <CAOS_Y6RY_aREsZ3aOHr5rTA1uS5JVsEUvLHpbLA-Uu+_UdMvvA@HIDDEN> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tiETRK0e0sJ6IEJ9otnTJPVnaUxN7bbTu" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -4.1 (----) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --tiETRK0e0sJ6IEJ9otnTJPVnaUxN7bbTu Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable This message came up on the POSIX list today, claiming GNU sed has a bug:= On 01/21/2016 12:02 PM, Rob Landley wrote: > On Thu, Jan 21, 2016 at 4:38 AM, Geoff Clare <gwc@HIDDEN> wrote:= >> I'm seeing this with versions of sed derived from System V: >> >> $ printf '%s\n' a b | sed -e n -e '2s/b/c/' >> a >> c >> $ printf '%s\n' a b | sed -e n -e '1,2s/b/c/' >> a >> b >=20 > Having recently implemented toybox sed from the posix spec, that's > what my implementation is producing too. >=20 > You have to match the first line of a range in order to activate the > range (numeric works same as /ascii/ that way). Since the above skips > past the first line, you never activate the range, so later lines > don't trigger the range contents either, >=20 > The gnu behavior is wrong. Replace the 1 with /a/ and the logic may be > easier to follow >=20 > (But hey, at least the gnu guys finally fixed "sed p - -" segfaulting > when it freed stdin the second time...) >=20 > Rob >=20 >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --tiETRK0e0sJ6IEJ9otnTJPVnaUxN7bbTu Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWoTlEAAoJEKeha0olJ0NqMtAIAK+PsC69DFesh3DSdyfP9G8c AL6bGUYKstTccD24EN5SBlM2sTWvfOYewSzEuO5+EATUc4BUTRgbUNV73InvguW/ 1e5g8Eu/txZm/cuWi2RWI7ojhQ1O019RYXFQC0UgN86b+Z40oYrkFqojROevVovm EHvBlDANYbJr1pMtjI6jT3Y77wUKm7LIr82aBhhNCkKeGTwCVfRGyLeBWXRQDBjH 31XD8j0Fr+1hucGouZsYfjXOVfX+tgXHYhXLoX+GRYOPzj9UjaBzyf3XHBCUxYRK XZcJu+53Lh0dLdCguskjZGOY4GNubPa4IkO25NZSeTMAr16Gv1MhCtGkWWV8sqQ= =O+37 -----END PGP SIGNATURE----- --tiETRK0e0sJ6IEJ9otnTJPVnaUxN7bbTu--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Eric Blake <eblake@HIDDEN> Subject: bug#22427: Acknowledgement (Odd behaviour of sed with n/N and line ranges) Message-ID: <handler.22427.B.145340655130226.ack <at> debbugs.gnu.org> References: <56A13944.20602@HIDDEN> X-Gnu-PR-Message: ack 22427 X-Gnu-PR-Package: sed Reply-To: 22427 <at> debbugs.gnu.org Date: Thu, 21 Jan 2016 20:03:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-sed@HIDDEN If you wish to submit further information on this problem, please send it to 22427 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 22427: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D22427 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#22427: Odd behaviour of sed with n/N and line ranges Resent-From: Jim Meyering <jim@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-sed@HIDDEN Resent-Date: Fri, 22 Jan 2016 12:47:01 +0000 Resent-Message-ID: <handler.22427.B22427.145346677331538 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 22427 X-GNU-PR-Package: sed X-GNU-PR-Keywords: To: Eric Blake <eblake@HIDDEN> Cc: 22427 <at> debbugs.gnu.org Received: via spool by 22427-submit <at> debbugs.gnu.org id=B22427.145346677331538 (code B ref 22427); Fri, 22 Jan 2016 12:47:01 +0000 Received: (at 22427) by debbugs.gnu.org; 22 Jan 2016 12:46:13 +0000 Received: from localhost ([127.0.0.1]:57098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1aMb6T-0008Cb-4G for submit <at> debbugs.gnu.org; Fri, 22 Jan 2016 07:46:13 -0500 Received: from mail-io0-f174.google.com ([209.85.223.174]:33067) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from <meyering@HIDDEN>) id 1aMb6Q-0008CN-5B for 22427 <at> debbugs.gnu.org; Fri, 22 Jan 2016 07:46:10 -0500 Received: by mail-io0-f174.google.com with SMTP id q21so86937543iod.0 for <22427 <at> debbugs.gnu.org>; Fri, 22 Jan 2016 04:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=cel+ftoHeKvi2/de2HASwvsxt104Vyf7mjFD1gWBJzY=; b=VXemK6RMScgoFbs7fPM1YeWaWrwwh2lfdvgUh8G0KtMGN9+2GOGvLkHXPsFOuwM/Lz dkh5qp+YS4B2B/IpFDX+xJDEk05C1EwvBWRRlCoGbUOl9e8MMTL8NnxXtgZPkDV3LmSd vcdBeYLmjCv1ge5tcTIWgv8YHEC8XnimWBeFMqYYuWEhQqIR06IRtuRhd1YZl5XIZvUi iiSLR3PEONwGt+/aJ+zJDUqxH5Ntm/wB9gMCI9/H+tTBuxEuD/rBfJV8oWLhg6L/PwDB pFGjCw/InEc15IGr+jZNaDV04ZttBf8fkTnxpAbMPfOGd0l19D2MDDrGNEew72QjdUHG E8tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=cel+ftoHeKvi2/de2HASwvsxt104Vyf7mjFD1gWBJzY=; b=jgD54R/5xeiSF6gDmGSR8oPpvusQdirrk/CcG4afmQrDejetVeWfbmcxMae5QxHhAN kGR3TqkP9OvTyEcM+tdR8FU2QUVsM1prQyXEohrPXEvyF98pYU9Iad4kNsiPgWXtdAE/ 3C2WXgrT3qcaZ+ecXJFB0rNrmKm4yxUcRo9Fpfpx1sCszZuWphVaGG7RDa0gMvBDBDYv SlpDakXLNbVbs+qOgzjZEFFl+gdw9v/FO1yfsuFgM0yA8DjRXC8Nwpm3+5D8A6sWKl3j VioTLigrrHkJC6yirF3syTMqikkVoj/KmUPGFBzULnrwJPXIHv+CAsir8MxYjut4nryZ VRsA== X-Gm-Message-State: AG10YOSWvygpQmgf2DAGMTm0xGpRYDBLBdY5rUzLpH2YhanrWpvV6l07rjv3i0k4/0rmsba85AqMZm64HbCNWg== X-Received: by 10.107.138.15 with SMTP id m15mr3551688iod.40.1453466764527; Fri, 22 Jan 2016 04:46:04 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.10.145 with HTTP; Fri, 22 Jan 2016 04:45:44 -0800 (PST) In-Reply-To: <56A13944.20602@HIDDEN> References: <20160121103800.GA32572@HIDDEN> <CAOS_Y6RY_aREsZ3aOHr5rTA1uS5JVsEUvLHpbLA-Uu+_UdMvvA@HIDDEN> <56A13944.20602@HIDDEN> From: Jim Meyering <jim@HIDDEN> Date: Fri, 22 Jan 2016 20:45:44 +0800 X-Google-Sender-Auth: bm6xcUOn9_gsKQ9S4xb8oIt-tKA Message-ID: <CA+8g5KFm+GZkxgUAGEzzHGUx9xW5ZiYz7eQ-S+BoTwaaJ_MYMQ@HIDDEN> Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.4 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.4 (/) On Fri, Jan 22, 2016 at 4:02 AM, Eric Blake <eblake@HIDDEN> wrote: > This message came up on the POSIX list today, claiming GNU sed has a bug: > > On 01/21/2016 12:02 PM, Rob Landley wrote: >> On Thu, Jan 21, 2016 at 4:38 AM, Geoff Clare <gwc@HIDDEN> wrote: >>> I'm seeing this with versions of sed derived from System V: >>> >>> $ printf '%s\n' a b | sed -e n -e '2s/b/c/' >>> a >>> c >>> $ printf '%s\n' a b | sed -e n -e '1,2s/b/c/' >>> a >>> b >> >> Having recently implemented toybox sed from the posix spec, that's >> what my implementation is producing too. >> >> You have to match the first line of a range in order to activate the >> range (numeric works same as /ascii/ that way). Since the above skips >> past the first line, you never activate the range, so later lines >> don't trigger the range contents either, >> >> The gnu behavior is wrong. Replace the 1 with /a/ and the logic may be >> easier to follow >> >> (But hey, at least the gnu guys finally fixed "sed p - -" segfaulting >> when it freed stdin the second time...) Thanks to both of you. I'll certainly take a look before the upcoming release.
X-Loop: help-debbugs@HIDDEN Subject: bug#22427: Odd behaviour of sed with n/N and line ranges Resent-From: Jim Meyering <jim@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-sed@HIDDEN Resent-Date: Sun, 07 Feb 2016 06:24:02 +0000 Resent-Message-ID: <handler.22427.B22427.145482619812056 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 22427 X-GNU-PR-Package: sed X-GNU-PR-Keywords: To: Eric Blake <eblake@HIDDEN> Cc: 22427 <at> debbugs.gnu.org Received: via spool by 22427-submit <at> debbugs.gnu.org id=B22427.145482619812056 (code B ref 22427); Sun, 07 Feb 2016 06:24:02 +0000 Received: (at 22427) by debbugs.gnu.org; 7 Feb 2016 06:23:18 +0000 Received: from localhost ([127.0.0.1]:36362 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1aSIkg-00038N-7I for submit <at> debbugs.gnu.org; Sun, 07 Feb 2016 01:23:18 -0500 Received: from mail-oi0-f47.google.com ([209.85.218.47]:34689) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from <meyering@HIDDEN>) id 1aSIke-000388-BZ for 22427 <at> debbugs.gnu.org; Sun, 07 Feb 2016 01:23:16 -0500 Received: by mail-oi0-f47.google.com with SMTP id w5so64457868oie.1 for <22427 <at> debbugs.gnu.org>; Sat, 06 Feb 2016 22:23:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=05Rt+ljIi1v2/ms37XO6BYZvgZU7VfDFpsron/bAG7o=; b=jtjR/ppFydSkLGk0DEC1c2+iQyGlybZJHvJgp9kWvKYfHUB7kGjvm4CSnH4DL5yfbz /XuUkyZEte3T946OoPbAGk6ejMNtOp3aJtaVJCHtciVEymaqVXrE+qYpq/0mikSUMOov y7xw8bHoP7iLjclRl7fAx87SKoQwqF8nP0vOk4wqtmWwUDgtvF6aWF9RAcu7Fjiimz2d YBhanHYMYa+gJw4tOERUuIDEUatKsCXvU4pUlU86SPEzKH2lcDt33xKjhMiFMcmYYPby oAolRINM4tssprIWAwGYZPZ5tOcuH8lT58q6b5I5hkgNnzbzAlEF3ZaKs+jmwollP12G UbHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=05Rt+ljIi1v2/ms37XO6BYZvgZU7VfDFpsron/bAG7o=; b=XgzHNK0Tx5TJ4mleNs98yyhilbfcszHlIDsXus9n+rvTy8t99ALqokaLO+GaH4Q5mE tsc5JudpnXD/8ITVSNpTR19Bdo8TFuTfEp9m5wY/2AOV3nNYC+QOo9srXPtPKO/RZETw 6oM9PNkHeurv/AfMZCsUDjdJQBCTqrr+EfEJeiyQ4E8uaPG15F8XjU9tyOfOO0/gemSS oNGdWkg1GtvoCQqp9/XK0Gbt8SZddhIhZGl0SKLCzBqwE6cGjh5OaOCUWIhpMfD73j/f kKOD4Wjh0AwDLXamzoeqnZaS2XL7QxiVUSZR9xHAcuYk0JRqTkh2v8tmkC7gr591hYus euTg== X-Gm-Message-State: AG10YOTEuKJX5WY0YJqznym2HFC4IkTtu1c9gwK2b4U0sUZ+mAU+yogROictADVAyudgFJ1inl666Vvxx/pfyA== X-Received: by 10.202.191.7 with SMTP id p7mr14693583oif.64.1454826190875; Sat, 06 Feb 2016 22:23:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.202.64.134 with HTTP; Sat, 6 Feb 2016 22:22:51 -0800 (PST) In-Reply-To: <CA+8g5KFm+GZkxgUAGEzzHGUx9xW5ZiYz7eQ-S+BoTwaaJ_MYMQ@HIDDEN> References: <20160121103800.GA32572@HIDDEN> <CAOS_Y6RY_aREsZ3aOHr5rTA1uS5JVsEUvLHpbLA-Uu+_UdMvvA@HIDDEN> <56A13944.20602@HIDDEN> <CA+8g5KFm+GZkxgUAGEzzHGUx9xW5ZiYz7eQ-S+BoTwaaJ_MYMQ@HIDDEN> From: Jim Meyering <jim@HIDDEN> Date: Sat, 6 Feb 2016 22:22:51 -0800 X-Google-Sender-Auth: lObNp8LPqwx50SAxu3Hvh8RQTz4 Message-ID: <CA+8g5KEiuK03XHPhdPB5hBVQsZ7_FWPXyO+_uh3E16o=qADZ1w@HIDDEN> Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.7 (/) On Fri, Jan 22, 2016 at 4:45 AM, Jim Meyering <jim@HIDDEN> wrote: > On Fri, Jan 22, 2016 at 4:02 AM, Eric Blake <eblake@HIDDEN> wrote: >> This message came up on the POSIX list today, claiming GNU sed has a bug: >> >> On 01/21/2016 12:02 PM, Rob Landley wrote: >>> On Thu, Jan 21, 2016 at 4:38 AM, Geoff Clare <gwc@HIDDEN> wrote: >>>> I'm seeing this with versions of sed derived from System V: >>>> >>>> $ printf '%s\n' a b | sed -e n -e '2s/b/c/' >>>> a >>>> c >>>> $ printf '%s\n' a b | sed -e n -e '1,2s/b/c/' >>>> a >>>> b >>> >>> Having recently implemented toybox sed from the posix spec, that's >>> what my implementation is producing too. >>> >>> You have to match the first line of a range in order to activate the >>> range (numeric works same as /ascii/ that way). Since the above skips >>> past the first line, you never activate the range, so later lines >>> don't trigger the range contents either, >>> >>> The gnu behavior is wrong. Replace the 1 with /a/ and the logic may be >>> easier to follow >>> >>> (But hey, at least the gnu guys finally fixed "sed p - -" segfaulting >>> when it freed stdin the second time...) > > Thanks to both of you. > I'll certainly take a look before the upcoming release. I'm not convinced that this should be changed. First, the vendor sed from Solaris 5.10 works the same way GNU sed does, and so does the one from busybox-1.22.1. Second, and perhaps more importantly, it feels like claiming the 1,2 range fails to match line 2 because the beginning address, "1", never matched a line (that was skipped due to the "n") is failing on a technicality. I think of the M,N (M<N) line number address range as matching any line in [M..N], regardless of whether line M happens to be processed. I feel that an address spec like 1,9 is conceptually different from one that specifies /a/,9. The latter specifies a dynamic condition: testing whether /a/ matches each pattern space, while the former specifies a static condition: a range of line numbers, that is independent of whether line "1" never sees the substitution command, due to thae initial "n" command.
Received: (at control) by debbugs.gnu.org; 9 Oct 2018 13:16:07 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 09 09:16:07 2018 Received: from localhost ([127.0.0.1]:41325 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1g9rrr-0002Ob-L3 for submit <at> debbugs.gnu.org; Tue, 09 Oct 2018 09:16:07 -0400 Received: from mail-io1-f45.google.com ([209.85.166.45]:35766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <assafgordon@HIDDEN>) id 1g9rrq-0002Nv-4f for control <at> debbugs.gnu.org; Tue, 09 Oct 2018 09:16:06 -0400 Received: by mail-io1-f45.google.com with SMTP id w11-v6so1112772iob.2 for <control <at> debbugs.gnu.org>; Tue, 09 Oct 2018 06:16:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:message-id:date:user-agent:mime-version:content-language :content-transfer-encoding; bh=p9rLrptC5W4XsUrLOwv0R6tE79oHqOqhFE0q+FyqMvs=; b=gmSPrX9a+6a2hqsznliJlpmNyYVuIfH0AWbUhdYqf061SGqwQmqtrVzd1CwRdMlKJV GHmhFJ1IAUQZyU3c5ThUCZWZ1ayzrZVfJXlWiwNy3lfgTo+6GMeYlPcazwCL7plVvSs4 KVC73im/fg0a57Opt6fNGUMOGVXP5n1/Mej/WCkIqv8bFHSSwxmS3GaqTffXEQ602v6u 1HIlErf3lQbYDosf2W+wCIX4d80tbx9xhxBccARYmhWoF27yh2eLOUlxy8ZZktdywNvT UIB7D4A9LVDD6PcXCdPYLQSu8XTuijLJNiAgfyohiflYxEhipEDncck0UcO651DhZ6TB yN9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=p9rLrptC5W4XsUrLOwv0R6tE79oHqOqhFE0q+FyqMvs=; b=B8C62aMyUYSXgjTvIqWmJWGfiNc65h0aekGWOVrvJu9iTbjov5UQpcuauJW6lpFtTH JgOIB8ahFiIboG1/53HpFOu2/u8xo/ipe9Kf9wq7AO+hzRLxp4hSBrxGBqLLf5HCvKHZ mrqLZ2PrhyNGwR+UsgVH1dsI3smIbS7aJ8QvB9jzxm9x4xxJZcXY1wPWQP1r2RraJoPQ SVdXSlseYT33Cd2IiQMIcaWOCMYQKmmiT0JYRk7CE6ZESjWGkSgUQLHe4Iu2ytDpHypa n5H9SBAVnkHIyxsJ2ZEuGi97RGYCLIb+GJfDc5TKOSGTs8nFxQxsQjWlPLFbJwW0+vb4 zFpg== X-Gm-Message-State: ABuFfohPpkKE3LYhcJYL6bDIU9nih9YxANRGH/MRs0YahXVtagx6oI64 0O9u/L2zQNzhwxiDZ8QrXuOUW2FJnqk= X-Google-Smtp-Source: ACcGV63SOmpzwwTgi4hWiLK6qAZ7NJKLrt9+qnd1sjdPYL68kIl+xV/0Lm46tsFxssbtFrLdK4DXeg== X-Received: by 2002:a6b:8f93:: with SMTP id r141-v6mr19020561iod.118.1539090960196; Tue, 09 Oct 2018 06:16:00 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id z195-v6sm12441920iof.71.2018.10.09.06.15.58 for <control <at> debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 06:15:59 -0700 (PDT) To: control <at> debbugs.gnu.org From: Assaf Gordon <assafgordon@HIDDEN> Message-ID: <4a989558-22a6-492a-cb5a-babec2aad4b2@HIDDEN> Date: Tue, 9 Oct 2018 07:15:57 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tags 22427 moreinfo severity 22427 wishlist stop [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (assafgordon[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.166.45 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.166.45 listed in list.dnswl.org] 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 1.0 (+) tags 22427 moreinfo severity 22427 wishlist stop
Received: (at control) by debbugs.gnu.org; 9 Oct 2018 13:16:07 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 09 09:16:07 2018 Received: from localhost ([127.0.0.1]:41325 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1g9rrr-0002Ob-L3 for submit <at> debbugs.gnu.org; Tue, 09 Oct 2018 09:16:07 -0400 Received: from mail-io1-f45.google.com ([209.85.166.45]:35766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <assafgordon@HIDDEN>) id 1g9rrq-0002Nv-4f for control <at> debbugs.gnu.org; Tue, 09 Oct 2018 09:16:06 -0400 Received: by mail-io1-f45.google.com with SMTP id w11-v6so1112772iob.2 for <control <at> debbugs.gnu.org>; Tue, 09 Oct 2018 06:16:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:message-id:date:user-agent:mime-version:content-language :content-transfer-encoding; bh=p9rLrptC5W4XsUrLOwv0R6tE79oHqOqhFE0q+FyqMvs=; b=gmSPrX9a+6a2hqsznliJlpmNyYVuIfH0AWbUhdYqf061SGqwQmqtrVzd1CwRdMlKJV GHmhFJ1IAUQZyU3c5ThUCZWZ1ayzrZVfJXlWiwNy3lfgTo+6GMeYlPcazwCL7plVvSs4 KVC73im/fg0a57Opt6fNGUMOGVXP5n1/Mej/WCkIqv8bFHSSwxmS3GaqTffXEQ602v6u 1HIlErf3lQbYDosf2W+wCIX4d80tbx9xhxBccARYmhWoF27yh2eLOUlxy8ZZktdywNvT UIB7D4A9LVDD6PcXCdPYLQSu8XTuijLJNiAgfyohiflYxEhipEDncck0UcO651DhZ6TB yN9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=p9rLrptC5W4XsUrLOwv0R6tE79oHqOqhFE0q+FyqMvs=; b=B8C62aMyUYSXgjTvIqWmJWGfiNc65h0aekGWOVrvJu9iTbjov5UQpcuauJW6lpFtTH JgOIB8ahFiIboG1/53HpFOu2/u8xo/ipe9Kf9wq7AO+hzRLxp4hSBrxGBqLLf5HCvKHZ mrqLZ2PrhyNGwR+UsgVH1dsI3smIbS7aJ8QvB9jzxm9x4xxJZcXY1wPWQP1r2RraJoPQ SVdXSlseYT33Cd2IiQMIcaWOCMYQKmmiT0JYRk7CE6ZESjWGkSgUQLHe4Iu2ytDpHypa n5H9SBAVnkHIyxsJ2ZEuGi97RGYCLIb+GJfDc5TKOSGTs8nFxQxsQjWlPLFbJwW0+vb4 zFpg== X-Gm-Message-State: ABuFfohPpkKE3LYhcJYL6bDIU9nih9YxANRGH/MRs0YahXVtagx6oI64 0O9u/L2zQNzhwxiDZ8QrXuOUW2FJnqk= X-Google-Smtp-Source: ACcGV63SOmpzwwTgi4hWiLK6qAZ7NJKLrt9+qnd1sjdPYL68kIl+xV/0Lm46tsFxssbtFrLdK4DXeg== X-Received: by 2002:a6b:8f93:: with SMTP id r141-v6mr19020561iod.118.1539090960196; Tue, 09 Oct 2018 06:16:00 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id z195-v6sm12441920iof.71.2018.10.09.06.15.58 for <control <at> debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 06:15:59 -0700 (PDT) To: control <at> debbugs.gnu.org From: Assaf Gordon <assafgordon@HIDDEN> Message-ID: <4a989558-22a6-492a-cb5a-babec2aad4b2@HIDDEN> Date: Tue, 9 Oct 2018 07:15:57 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tags 22427 moreinfo severity 22427 wishlist stop [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (assafgordon[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.166.45 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.166.45 listed in list.dnswl.org] 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 1.0 (+) tags 22427 moreinfo severity 22427 wishlist stop
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.