Bug in busybox sed - this one is real

Rich Felker dalias at aerifal.cx
Fri Jun 8 14:48:28 UTC 2012


On Fri, Jun 08, 2012 at 03:36:02PM +0200, John Spencer wrote:
> On 06/08/2012 10:26 AM, Denys Vlasenko wrote:
> >
> >I had to d/l apr-1.4.6 source to get non-mangled sed command of yours.
> >
> >Fixed in git, please try it...
> >
> 
> very nice, thanks. i can now build the entirety of sabotage linux
> only using bb sed,
> 
> except: psmisc 22.13
> 
> i attach the log (search for XXX, ca line 100) which shows what sed
> expression was used and output for both busybox and gnu sed.
>
> [...]
> 
> export LC_ALL=C ; \
> 	gcc -E -dM signames.c |\
> 	tr -s '\t ' ' ' | sort -n -k 3 | sed \
> 's:#define SIG\([A-Z]\+[0-9]*\) \([0-9]\+\) *\(\|/\*.*\)$:{\ \2,"\1" },:p;d' | \
> 	  grep -v '[0-9][0-9][0-9]' >signames.h || \
> 	  { rm -f signames.h; exit 1; }
> sed failure type XXX !

This is a bug in their sed script. There is no "+" repetition operator
in BRE. To obtain the same effect, they should simply be using:

\([0-9][0-9]*\)

instead of

\([0-9]\+\)

It probably works with some systems due to \+ being accepted as an
extension in BRE that's equivalent the the ERE + repetition, but it's
wrong.

Rich


More information about the busybox mailing list