[BusyBox] BusyBox SED bugs reproducible at will.
Serge Caron
scaron at pcevolution.com
Mon Mar 18 12:33:03 UTC 2002
1) The construct [[:space:]]* is broken and sed will enter an infinite loop
if this construct is used in a substitute command with the g modifier.
to reproduce:
echo "12345" | sed -e "s/[[:space:]]/,/"
12345 (as expected)
echo "12345" | sed -e "s/[[:space:]]*/,/"
,12345 (BUG!!!)
echo "12345" | sed -e "s/[[:space:]]*/,/g"
(Infinite loop :()
2) Processing the input line mutiple times yield unexpected results:
(in this example, suppose you want to remove comments and whitespace for
a file in /etc)
sed -e "s/#.*$//" -e "/^[[:space:]]*$/d" /etc/inittab > junk
all comments are deleted and only empty lines not originaly containing
comments are deleted.
3) BusyBox sed adds a newline at the end of the input stream
echo -n "12345" | sed -e "s/3/c/" >> junk
echo -n "12345" | sed -e "s/3/c/" >> junk
cat junk
12c45
12c45
Regards
Serge Caron
More information about the busybox
mailing list