NetBSD-Bugs archive

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

bin/45955: sed(1) fails to append newline after 'c' command



>Number:         45955
>Category:       bin
>Synopsis:       sed(1) fails to append newline after 'c' command
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 09 02:00:00 +0000 2012
>Originator:     Jonathan Wakely
>Release:        NetBSD 5.1
>Organization:
>Environment:
NetBSD gcc70.fsffrance.org 5.1 NetBSD 5.1 (GENERIC) #0: Sat Nov 6 13:19:33 UTC 
2010 
builds%b6.netbsd.org@localhost:/home/builds/ab/netbsd-5-1-RELEASE/amd64/201011061943Z-obj/home/builds/ab/netbsd-5-1-RELEASE/src/sys/arch/amd64/compile/GENERIC
 amd64
>Description:
in the command below sed should:

1) copy 'bar' (without following newline) to pattern space
2) apply 'c' command which:
2a) delete pattern space
2b) print 'bar'
3) print (empty) pattern space
4) append newline

step 4 is missing
>How-To-Repeat:
echo foo | sed 'c\
bar'

expected result is 'bar' followed by newline

actual result is just 'bar'
>Fix:
Explicitly include a newline in the replacement text:

echo foo | sed 'c\
bar\
'

but this produces two newlines on other platforms (e.g. with GNU or Solaris sed)



Home | Main Index | Thread Index | Old Index