Switch test to using our printf

This test wants to generate a U+FDD2 to see it is not mishandled.

To do so, we tried to use sh, which on my system is bash and can do
`$'\ufdd2'`.

Unfortunately on other systems it might be dash, which won't do that.

Since I don't know of a good no-dependency portable way to generate
this (I dimly remember python3 being a shim on some systems, so I do
not want to invoke it here), we'll just use our own printf.

Which is a worse test, we control both parts, but it'll do.

Fixes #10134
This commit is contained in:
Fabian Boehm 2023-12-04 19:30:31 +01:00
parent 4a618f14f1
commit b2ef44a277

View File

@ -592,8 +592,8 @@ $fish -c 'echo \ufdd2"fart"'
# CHECKERR: echo \ufdd2"fart"
# CHECKERR: ^~~~~~~~~~~^
echo (sh -c 'printf \$\'\ufdd2foo\'') | string escape
# CHECK: \$\\ufdd2foo
echo (printf '\ufdd2foo') | string escape
# CHECK: \Xef\Xb7\X92foo
printf '%s\n' "#!/bin/sh" 'echo $0' > $tmpdir/argv0.sh
chmod +x $tmpdir/argv0.sh