sed bug report (Re: [BusyBox] BusyBox 1.0.0-pre8 released)
Junio C Hamano
junkio at cox.net
Tue Mar 30 07:36:26 UTC 2004
The sed command in busybox 1.0.0-pre8 loses leading whitespace in 'a'
command. The one in busybox 1.0.0-pre3 does not have this
problem.
The following is a transcript that reproduces it. The first run
uses busybox 1.0.0-pre3 as "/bin/sed" command, hence gets the
expected result. Later in the test, /bin/sed symlink is
changed to point at busybox 1.0.0-pre8 and the test script is
run again, which shows the failure.
root# cd /tmp
root# cat 1.sh
#!/bin/sh
cd /tmp
rm -f ipsec.conf ipsec.conf+
cat >ipsec.conf <<\EOF
version 2.0
config setup
klipsdebug=none
plutodebug=none
plutostderrlog=/dev/null
conn %default
keyingtries=1
...
EOF
if grep nat_traversal >/dev/null ipsec.conf
then
:;
else
rm -f ipsec.conf+
sed -e '/^config setup/a\
nat_traversal=yes' ipsec.conf >ipsec.conf+ &&
mv -f ipsec.conf+ ipsec.conf
fi
root# sh -x 1.sh
+ cd /tmp
+ rm -f ipsec.conf ipsec.conf+
+ cat
+ grep nat_traversal ipsec.conf
+ rm -f ipsec.conf+
+ sed -e /^config setup/a\
nat_traversal=yes ipsec.conf
+ mv -f ipsec.conf+ ipsec.conf
root# cat ipsec.conf
version 2.0
config setup
nat_traversal=yes
klipsdebug=none
plutodebug=none
plutostderrlog=/dev/null
conn %default
keyingtries=1
...
root# sed --version
sed: invalid option -- -
BusyBox v1.00-pre3 (2004.02.26-18:47+0000) multi-call binary
Usage: sed [-nef] pattern [files...]
root# ln -s busybox-pre8 /bin/sed-8
root# mv /bin/sed-8 /bin/sed
root# sed --version
This is not GNU sed version 4.0
root# sed --
BusyBox v1.00-pre8 (2004.03.30-02:44+0000) multi-call binary
Usage: sed [-nef] pattern [files...]
root# sh -x 1.sh
+ cd /tmp
+ rm -f ipsec.conf ipsec.conf+
+ cat
+ grep nat_traversal ipsec.conf
+ rm -f ipsec.conf+
+ sed -e /^config setup/a\
nat_traversal=yes ipsec.conf
+ mv -f ipsec.conf+ ipsec.conf
root# cat ipsec.conf
version 2.0
config setup
nat_traversal=yes
klipsdebug=none
plutodebug=none
plutostderrlog=/dev/null
conn %default
keyingtries=1
...
root#
More information about the busybox
mailing list