bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bash: remove the format string "%q" in the unicode3.sub


From: address@hidden
Subject: bash: remove the format string "%q" in the unicode3.sub
Date: Tue, 9 Aug 2016 15:18:17 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2

Hi all

When I run the tests for the bash, the sub-test unicode3.sub of intl.tests failed.

The sub-test unicode3.sub contain the following:

    payload=$'\065\247\100\063\231\053\306\123\070\237\242\352\263'
    "$payload"
    printf %q "$payload"

In this situation, the format string "%q" in command printf means that when the
character in the payload is not in {alpha & digit & punctuation & ISO 646(7-bit)}, it
would print the string with ANSI-C style quoted string: $'...' , we can check the source code
at:

    http://git.savannah.gnu.org/cgit/bash.git/tree/builtins/printf.def#n557
    http://git.savannah.gnu.org/cgit/bash.git/tree/lib/sh/strtrans.c#n207

Because the payload variable contain the above situation, so the test results look like $'...' ,
when compared with the intl.right that contain the converted character(extended ASCII), so
the test failed.

Can we remove the format string "%q", so just

     printf "$payload"

In this way, the output of test is same as the intl.right.

//dengke

reply via email to

[Prev in Thread] Current Thread [Next in Thread]