[PATCH] ls.tests: replace printf with $ECHO -ne

Harald van Dijk harald at gigawatt.nl
Fri Jun 12 03:58:54 UTC 2026


On 6/12/26 04:31, Kang-Che Sung via busybox 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).

That is why the patch does not use echo -ne. It uses $ECHO -ne, in line 
with existing busybox tests, which where necessary uses a helper program 
compiled from scripts/echo.c from the busybox source directory to 
reliably handle the -n and -e options.

> If the "\xNN" would present a problem, then how about octal escape
> sequence ("\NNN" where NNN is octal)?

This would be valid, but a bigger change and not matching the style of 
other busybox tests (as noted in the patch description). The submitted 
patch looks good to me as it is.

Cheers,
Harald van Dijk


More information about the busybox mailing list