On 14/08/2021 15:08, наб wrote:
Package: coreutils
Version: 8.32-4
Severity: normal
File: /usr/bin/printf

Dear Maintainer,

Consider the following invocation:
        /bin/printf "%q" $'\001'\'$'\001'
(i.e. 1st=dollar+letter q, 2nd=byte 1+apostrophe+byte 1)

What do you expect the output to be? I'd expect something like
        $'\001'\'$'\001'
or, in the, rather verbose, printf format,
        ''$'\001'\'''$'\001'

Okay, now what does the invocation output?
        '\001'\'''$'\001'

Uh-oh! And what fill feeding that into an Almquist shell give?
        $ echo -n '\001'\'''$'\001' | hexdump -C
        00000000  5c 30 30 31 27 01                                 |\001'.|
        00000006

Sheesh!

As far as I can tell, a sequence of any string that needs escaping,
followed by an apostrophe, followed by another string that needs
escaping will trigger this, and the example above is the minimal case.

Independently reported and fixed at:
https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00041.html

so this can be closed.

thanks,
Padraig

Reply via email to