On 16/10/16 17:49, Bruno Haible wrote: > Hi Pádraig, > > On a glibc system (glibc 2.15, Linux 3.8) I get these test failures > from a gnulib testdir: > > 1) For module 'quotearg': > > FAIL: test-quotearg.sh > > $ LOCALE=fr_FR.UTF-8 LOCALEDIR=locale ./test-quotearg > test-quotearg.h:53: assertion 'la == lb' failed > > (gdb) where > #0 0x00007ffff7a52035 in raise () from /lib/x86_64-linux-gnu/libc.so.6 > #1 0x00007ffff7a5579b in abort () from /lib/x86_64-linux-gnu/libc.so.6 > #2 0x00000000004011a3 in compare (a=0x4063d5 "««\\»»", la=9, b=0x608460 "«a' > b»", lb=8) at test-quotearg.h:53 > #3 0x000000000040159f in compare_strings (func=0x401684 > <use_quotearg_buffer>, results=0x6081e0, ascii_only=false) at > test-quotearg.h:91 > #4 0x0000000000401ae3 in main (argc=1, argv=0x7fffffffdb98) at > test-quotearg.c:87 > > Apparently the quoting result of string "a' b", which ought to have been > "«a' b»", is now "««\\»»" - which is complete nonsense. > > Can you reproduce this? You must first make sure that you have a fr_FR.UTF-8 > locale on your system. If not, create it using > # localedef -i fr_FR -f UTF-8 fr_FR.UTF-8' > > > 2) For module 'sh-quote', which relies on 'quotearg': > > FAIL: test-sh-quote > > test-sh-quote.c:48: assertion 'buf[output_len + 1] == '%'' failed > FAIL test-sh-quote (exit status: 134) > > > 3) For module 'system-quote', which relies on 'sh-quote': > > FAIL: test-system-quote.sh > > test-system-quote-main.c:65: assertion 'buf[output_len + 1] == '%'' failed > FAIL test-system-quote.sh (exit status: 134) > > > I suspect the commit that you delivered on 2016-10-03, since that's the only > recent change in this area. Can you please take a deep look?
The attached should fix up those tests. Sorry for missing those. Pádraig.
>From 9fe86b15e4de4ea6d28486fff74bd772b8325e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com> Date: Sun, 16 Oct 2016 22:51:30 +0100 Subject: [PATCH] quotearg: fix stale tests * tests/test-quotearg.c [locale_results]: Add the missing str7 entries to the expected results. tests/test-system-quote-main.c (check_one): Don't enforce that we don't write beyond the returned length, since that's no longer the case if we switch to a more concise quoting style. * tests/test-sh-quote.c (check_one): Likewise. (main): Adjust for the new more concise quoting style. Reported by Bruno Haible. --- tests/test-quotearg.c | 12 ++++++------ tests/test-sh-quote.c | 4 +--- tests/test-system-quote-main.c | 2 -- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/test-quotearg.c b/tests/test-quotearg.c index e43573d..d9a636b 100644 --- a/tests/test-quotearg.c +++ b/tests/test-quotearg.c @@ -37,24 +37,24 @@ static struct result_groups locale_results[] = { /* locale_quoting_style */ { { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" RQ, - LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ }, + LQ "a' b" RQ, LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ }, { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" RQ, - LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ}, + LQ "a' b" RQ, LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ}, { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a\\:b" RQ, LQ "a\\\\b" RQ, - LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ } }, + LQ "a' b" RQ, LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ } }, /* clocale_quoting_style */ { { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" RQ, - LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ }, + LQ "a' b" RQ, LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ }, { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" RQ, - LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ }, + LQ "a' b" RQ, LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ }, { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a\\:b" RQ, LQ "a\\\\b" RQ, - LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ } } + LQ "a' b" RQ, LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ } } }; #endif /* ENABLE_NLS */ diff --git a/tests/test-sh-quote.c b/tests/test-sh-quote.c index a2633ba..091da34 100644 --- a/tests/test-sh-quote.c +++ b/tests/test-sh-quote.c @@ -41,11 +41,9 @@ check_one (const char *input, const char *expected) ASSERT (output_len <= sizeof (buf) - 2); memset (buf, '\0', output_len + 1); - buf[output_len + 1] = '%'; bufend = shell_quote_copy (buf, input); ASSERT (bufend == buf + output_len); ASSERT (memcmp (buf, output, output_len + 1) == 0); - ASSERT (buf[output_len + 1] == '%'); ASSERT (strcmp (output, expected) == 0); @@ -91,7 +89,7 @@ main (void) check_one ("&", "'&'"); /* "'" would be interpreted as the start of a string. */ - check_one ("'foo'bar", "''\\''foo'\\''bar'"); /* or "\"'foo'bar\"" */ + check_one ("'foo'bar", "\"'foo'bar\""); /* '(' at the beginning of argv[0] would introduce a subshell command. */ check_one ("(", "'('"); diff --git a/tests/test-system-quote-main.c b/tests/test-system-quote-main.c index 8eb6a17..40d7ec6 100644 --- a/tests/test-system-quote-main.c +++ b/tests/test-system-quote-main.c @@ -58,11 +58,9 @@ check_one (enum system_command_interpreter interpreter, const char *prog, ASSERT (output_len <= sizeof (buf) - 2); memset (buf, '\0', output_len + 1); - buf[output_len + 1] = '%'; bufend = system_quote_copy (buf, interpreter, input); ASSERT (bufend == buf + output_len); ASSERT (memcmp (buf, output, output_len + 1) == 0); - ASSERT (buf[output_len + 1] == '%'); /* Store INPUT in EXPECTED_DATA_FILE, for verification by the child process. */ -- 2.5.5