bug-sed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23415: sed bug with the D command verb


From: Dylan Wagstaff
Subject: bug#23415: sed bug with the D command verb
Date: Sun, 1 May 2016 19:58:28 +1200

Hello GNU sed maintainers; Mr Bonzini, et. al.,

I believe I have discovered a bug in GNU sed in that it diverges from POSIX
specification, and documented behaviour in the man page regarding the D
command verb.

I have browsed commit messages at
http://git.savannah.gnu.org/cgit/sed.git/log/sed from the release version
listed below until now, but none indicate that the issue has been
located/fixed in the current development state.

I hope the following information satisfies guidelines found in the
--version output / man page, and
https://www.gnu.org/software/sed/manual/sed.html#Reporting-Bugs

*sed version:*

$ sed --version
sed (GNU sed) 4.2.2
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jay Fenlason, Tom Lord, Ken Pizzini,
and Paolo Bonzini
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <address@hidden>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.

*Documentation extract:*
$ man sed
[...]
d - Delete pattern space. Start next cycle.

D - If pattern space contains no newline, start a normal new cycle as if
the d command was issued. Otherwise, delete text in the pattern space up to
the first newline, and restart cycle with the resultant pattern space,
without reading a new line of input.
[...]

which concurs with at least the 2013 edition of the specification found at
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html#tag_20_116_13_03

*Issue:*
The 'D' command verb always acts as the 'd' command verb (even with the
presence of a newline in the pattern space).

*Steps to reproduce:*
Using GNU bash

$ sed -e 's/newline/\n/; D; i\text from the i command' <<< "here-string
with a newline in the middle of it"

*Expected output:*
text from the i command
 in the middle of it

*Actual output:*

(none)

*Furthermore:*
I know the pattern space to hold a newline via the substitution of the D
command in the above to P, which functions correctly to give the output:

here-string with a
text from the i command
here-string with a
 in the middle of it

I hope this to assist in locating and correcting the issue.

Sincerely,
Dylan Wagstaff


reply via email to

[Prev in Thread] Current Thread [Next in Thread]