GNU bug report logs - #32765
Bug when changing and adding line

Previous Next

Package: sed;

Reported by: Mohamed Akram <mohd.akram <at> outlook.com>

Date: Tue, 18 Sep 2018 21:57:02 UTC

Severity: normal

Tags: notabug

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32765 in the body.
You can then email your comments to 32765 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-sed <at> gnu.org:
bug#32765; Package sed. (Tue, 18 Sep 2018 21:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mohamed Akram <mohd.akram <at> outlook.com>:
New bug report received and forwarded. Copy sent to bug-sed <at> gnu.org. (Tue, 18 Sep 2018 21:57:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mohamed Akram <mohd.akram <at> outlook.com>
To: "bug-sed <at> gnu.org" <bug-sed <at> gnu.org>
Subject: Bug when changing and adding line
Date: Tue, 18 Sep 2018 21:55:30 +0000
Hi,

Given the following command:

echo foo | sed '{
c\
bar
a\
baz
}'

GNU sed 4.4 prints:

bar

Expected (and on macOS):

bar
baz

Regards,
Mohamed




Information forwarded to bug-sed <at> gnu.org:
bug#32765; Package sed. (Tue, 18 Sep 2018 22:17:01 GMT) Full text and rfc822 format available.

Message #8 received at 32765 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Mohamed Akram <mohd.akram <at> outlook.com>, 32765 <at> debbugs.gnu.org
Subject: Re: bug#32765: Bug when changing and adding line
Date: Tue, 18 Sep 2018 16:16:03 -0600
tag 32765 notabug
close 32765
thanks

Hello,

On 18/09/18 03:55 PM, Mohamed Akram wrote:
> Given the following command:
> 
> echo foo | sed '{
> c\
> bar
> a\
> baz
> }'
> 
> GNU sed 4.4 prints:
> 
> bar
> 
> Expected (and on macOS):
> 
> bar
> baz
> 

I think (based on reading the POSIX spec) that GNU sed
is actually correct, while MacOS's sed is wrong.

The POSIX standard says about the "c" command:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html#tag_20_116_13_03

  [2addr]c\
  text
     Delete the pattern space. With a 0 or 1 address or at the end of a
     2-address range, place text on the output and start the next cycle.


That is - after executing the "c" command (and outputting "bar"),
sed should "start the next cycle" - meaning skip all other commands.

I'm thus marking this as "not a bug",
but discussion can continue by replying to this thread.

regards,
 - assaf








Added tag(s) notabug. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 18 Sep 2018 22:17:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 32765 <at> debbugs.gnu.org and Mohamed Akram <mohd.akram <at> outlook.com> Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 18 Sep 2018 22:17:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 17 Oct 2018 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 245 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.