[PATCH] ls.tests: replace printf with $ECHO -ne
Michael Tokarev
mjt at tls.msk.ru
Fri Jun 12 04:38:45 UTC 2026
On 12.06.2026 06:31, Kang-Che Sung wrote:
> On Thu, Jun 11, 2026 at 8:08 PM Michael Tokarev via busybox
> <busybox at busybox.net> wrote:
>>
>> testsuite/ls.tests uses printf to produce a filename, but uses
>> \xNN escape sequence. Dash (debian default) has printf buult-in,
>> but it does not understand \xNN, - it produces literal \xNN
>> instead of a single-byte corresponding to the value NN.
>> So the test fails.
>>
>> Replace printf with $ECHO -ne - this one is used elsewhere
>> for similar purpose.
>
> printf(1) is in POSIX standard, while `echo -ne` is arguably less
> portable (according to Autoconf manual).
Nope. In busybox testsuite, $ECHO (not echo) is guaranteed to support
-e, -n, and all necessary escape sequences. If system-provided echo
is not good, an additional utility is built from busybox source.
> If the "\xNN" would present a problem, then how about octal escape
> sequence ("\NNN" where NNN is octal)?
There's no need too: a lot of other tests use \xNN with $ECHO -e.
Thanks,
/mjt
More information about the busybox
mailing list