ash: printf problem interpreting octal escape sequences

ralda at gmx.de ralda at gmx.de
Tue Mar 6 23:30:58 UTC 2012


> >> # Okay
> >> $ printf "%b" '\057usr\057bin\n'
> >> /usr/bin
> >>
> >> # Not okay
> >> $ printf "%b" '\0057usr\0057bin\n'
> >> 7usr7bin

Looks like "%b" shall accept '\0d', '\0dd' and '\0ddd' sequences in
argument strings (not in format strings). That's what the standard
documents seem to define for printf. So the above is a bug in
Busybox.

Beside this octal constants in printf format strings and other argument
strings (not %b) shall only accept '\d', '\dd' and '\ddd' sequences
(without the leading zero).

All this according to googled standards definitions.

--
Harald


More information about the busybox mailing list