bug in busybox sed with non-ascii chars

Denys Vlasenko vda.linux at googlemail.com
Fri May 2 05:34:57 UTC 2014


On Wednesday 30 April 2014 10:31, Natanael Copa wrote:
> Hi,
> 
> I came across a bug (or feature) in busybox sed when trying to build firefox-29.
> 
> Testcase based on what firefox's configure scripts does:
> 
> ASCII='AA'
> NONASCII=$'\246\246'
> 
> echo -e "($ASCII)\n($NONASCII)" | busybox sed 's/$/,/'
> 
> 
> Expected result is a comma (,) after both lines. Actual result is that
> the line with non-ascii does not get any comma.

Can't reproduce with uclibc-based busybox:

ASCII='AA'
NONASCII=$'\246\246'
# GNU sed version 4.1.5
echo -e "($ASCII)\n($NONASCII)" | /usr/bin/sed 's/$/,/' | hexdump -C
echo -e "($ASCII)\n($NONASCII)" | ./busybox sed 's/$/,/' | hexdump -C

Result:

00000000  28 41 41 29 2c 0a 28 a6  a6 29 2c 0a              |(AA),.(..),.|
0000000c
00000000  28 41 41 29 2c 0a 28 a6  a6 29 2c 0a              |(AA),.(..),.|
0000000c


> With gnu sed both lines gets a trailing comma.
> 
> BusyBox v1.22.1 compiled against musl libc.
> 
> Ideas?

(1) Post your .config
(2) Does the same happen if built against glibc?


More information about the busybox mailing list