]> Savannah Git Hosting - gnulib.git/commitdiff
quotearg: fix shell-escape quoting with single quotes
authorPádraig Brady <P@draigBrady.com>
Wed, 3 Apr 2024 14:46:47 +0000 (15:46 +0100)
committerPádraig Brady <P@draigBrady.com>
Wed, 3 Apr 2024 22:18:18 +0000 (23:18 +0100)
With shell-escape quoting, we misquoted strings
where the first and last characters required escaping,
while the string also contained single quotes.

* lib/quotearg.c (quotearg_buffer_restyled): Ensure that
pending_shell_escape_end is reset to the initial state
when reprocessing input due to single quotes.
* tests/test-quotearg-simple.c: Add a minimal test case.
* tests/test-quotearg.c: Likewise.
* tests/test-quotearg.h: Likewise.
Reported by Grisha Levit

ChangeLog
lib/quotearg.c
tests/test-quotearg-simple.c
tests/test-quotearg.c
tests/test-quotearg.h

index d6b9f731bc76fd30e36f28072b0d9bd035c6cf23..226d0d53114079d046007698fd09713ee0801052 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2024-04-03  Pádraig Brady  <P@draigBrady.com>
+
+       quotearg: fix shell-escape quoting with single quotes
+       With shell-escape quoting, we misquoted strings
+       where the first and last characters required escaping,
+       while the string also contained single quotes.
+
+       * lib/quotearg.c (quotearg_buffer_restyled): Ensure that
+       pending_shell_escape_end is reset to the initial state
+       when reprocessing input due to single quotes.
+       * tests/test-quotearg-simple.c: Add a minimal test case.
+       * tests/test-quotearg.c: Likewise.
+       * tests/test-quotearg.h: Likewise.
+       Reported by Grisha Levit
+
 2024-04-02  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Use [] instead of list() to initialize empty lists.
index 847101e6059cb434a79c6680e0bdaeb2ae4472f1..5ca511a4924717900fe24dc73a7fec4af454a04b 100644 (file)
@@ -260,7 +260,6 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
   bool backslash_escapes = false;
   bool unibyte_locale = MB_CUR_MAX == 1;
   bool elide_outer_quotes = (flags & QA_ELIDE_OUTER_QUOTES) != 0;
-  bool pending_shell_escape_end = false;
   bool encountered_single_quote = false;
   bool all_c_and_shell_quote_compat = true;
 
@@ -303,7 +302,8 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
       } \
     while (0)
 
- process_input:
+ process_input: ;
+  bool pending_shell_escape_end = false;
 
   switch (quoting_style)
     {
index 5a9a7695e8ce9cfd2013290c919031d53aad8b4b..18d33d434410f4041cd76bc87e16bf9c184afaa0 100644 (file)
 
 static struct result_groups results_g[] = {
   /* literal_quoting_style */
-  { { "", "\0""1\0", 3, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b",
+  { { "", "\0""1\0", 3, "simple", "\t'\t", " \t\n'\"\033?""?/\\", "a:b", "a\\b",
       "a' b", LQ RQ, LQ RQ },
-    { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b",
+    { "", "1", 1, "simple", "\t'\t", " \t\n'\"\033?""?/\\", "a:b", "a\\b",
       "a' b", LQ RQ, LQ RQ },
-    { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b",
+    { "", "1", 1, "simple", "\t'\t", " \t\n'\"\033?""?/\\", "a:b", "a\\b",
       "a' b", LQ RQ, LQ RQ } },
 
   /* shell_quoting_style */
-  { { "''", "\0""1\0", 3, "simple", "' \t\n'\\''\"\033?""?/\\'", "a:b",
-      "'a\\b'", "\"a' b\"", LQ RQ, LQ RQ },
-    { "''", "1", 1, "simple", "' \t\n'\\''\"\033?""?/\\'", "a:b",
-      "'a\\b'", "\"a' b\"", LQ RQ, LQ RQ },
-    { "''", "1", 1, "simple", "' \t\n'\\''\"\033?""?/\\'", "'a:b'",
-      "'a\\b'", "\"a' b\"", LQ RQ, LQ RQ } },
+  { { "''", "\0""1\0", 3, "simple", "'\t'\\''\t'",
+      "' \t\n'\\''\"\033?""?/\\'", "a:b", "'a\\b'", "\"a' b\"",
+      LQ RQ, LQ RQ },
+    { "''", "1", 1, "simple", "'\t'\\''\t'",
+      "' \t\n'\\''\"\033?""?/\\'", "a:b", "'a\\b'", "\"a' b\"",
+      LQ RQ, LQ RQ },
+    { "''", "1", 1, "simple", "'\t'\\''\t'",
+      "' \t\n'\\''\"\033?""?/\\'", "'a:b'", "'a\\b'", "\"a' b\"",
+      LQ RQ, LQ RQ } },
 
   /* shell_always_quoting_style */
-  { { "''", "'\0""1\0'", 5, "'simple'", "' \t\n'\\''\"\033?""?/\\'", "'a:b'",
-      "'a\\b'", "\"a' b\"", "'" LQ RQ "'", "'" LQ RQ "'" },
-    { "''", "'1'", 3, "'simple'", "' \t\n'\\''\"\033?""?/\\'", "'a:b'",
-      "'a\\b'", "\"a' b\"", "'" LQ RQ "'", "'" LQ RQ "'" },
-    { "''", "'1'", 3, "'simple'", "' \t\n'\\''\"\033?""?/\\'", "'a:b'",
-      "'a\\b'", "\"a' b\"", "'" LQ RQ "'", "'" LQ RQ "'" } },
+  { { "''", "'\0""1\0'", 5, "'simple'", "'\t'\\''\t'",
+      "' \t\n'\\''\"\033?""?/\\'", "'a:b'", "'a\\b'", "\"a' b\"",
+      "'" LQ RQ "'", "'" LQ RQ "'" },
+    { "''", "'1'", 3, "'simple'", "'\t'\\''\t'",
+      "' \t\n'\\''\"\033?""?/\\'", "'a:b'", "'a\\b'", "\"a' b\"",
+      "'" LQ RQ "'", "'" LQ RQ "'" },
+    { "''", "'1'", 3, "'simple'", "'\t'\\''\t'",
+      "' \t\n'\\''\"\033?""?/\\'", "'a:b'", "'a\\b'", "\"a' b\"",
+      "'" LQ RQ "'", "'" LQ RQ "'" } },
 
   /* shell_escape_quoting_style */
-  { { "''", "''$'\\0''1'$'\\0'", 15, "simple",
+  { { "''", "''$'\\0''1'$'\\0'", 15, "simple", "''$'\\t'\\'''$'\\t'",
       "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "a:b",
       "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", LQ RQ },
-    { "''", "''$'\\0''1'$'\\0'", 15, "simple",
+    { "''", "''$'\\0''1'$'\\0'", 15, "simple", "''$'\\t'\\'''$'\\t'",
       "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "a:b",
       "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", LQ RQ },
-    { "''", "''$'\\0''1'$'\\0'", 15, "simple",
+    { "''", "''$'\\0''1'$'\\0'", 15, "simple", "''$'\\t'\\'''$'\\t'",
       "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "'a:b'",
       "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", LQ RQ } },
 
   /* shell_escape_always_quoting_style */
-  { { "''", "''$'\\0''1'$'\\0'", 15, "'simple'",
+  { { "''", "''$'\\0''1'$'\\0'", 15, "'simple'", "''$'\\t'\\'''$'\\t'",
       "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "'a:b'",
       "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" },
-    { "''", "''$'\\0''1'$'\\0'", 15, "'simple'",
+    { "''", "''$'\\0''1'$'\\0'", 15, "'simple'", "''$'\\t'\\'''$'\\t'",
       "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "'a:b'",
       "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" },
-    { "''", "''$'\\0''1'$'\\0'", 15, "'simple'",
+    { "''", "''$'\\0''1'$'\\0'", 15, "'simple'", "''$'\\t'\\'''$'\\t'",
       "' '$'\\t\\n'\\''\"'$'\\033''?""?/\\'", "'a:b'",
       "'a\\b'", "\"a' b\"", "''$'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" } },
 
   /* c_quoting_style */
-  { { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+  { { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\"\\t'\\t\"",
       "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"",
       "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" },
-    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\"\\t'\\t\"",
       "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"",
       "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" },
-    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\"\\t'\\t\"",
       "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a\\:b\"", "\"a\\\\b\"",
       "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" } },
 
   /* c_maybe_quoting_style */
-  { { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"",
-      "a:b", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ },
-    { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"",
-      "a:b", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ },
-    { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"",
-      "\"a:b\"", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ } },
+  { { "", "\"\\0001\\0\"", 9, "simple", "\"\\t'\\t\"",
+      "\" \\t\\n'\\\"\\033?""?/\\\\\"", "a:b", "a\\b", "a' b",
+      "\"" LQ_ENC RQ_ENC "\"", LQ RQ },
+    { "", "\"\\0001\\0\"", 9, "simple", "\"\\t'\\t\"",
+      "\" \\t\\n'\\\"\\033?""?/\\\\\"", "a:b", "a\\b", "a' b",
+      "\"" LQ_ENC RQ_ENC "\"", LQ RQ },
+    { "", "\"\\0001\\0\"", 9, "simple", "\"\\t'\\t\"",
+      "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "a\\b", "a' b",
+      "\"" LQ_ENC RQ_ENC "\"", LQ RQ } },
 
   /* escape_quoting_style */
-  { { "", "\\0001\\0", 7, "simple", " \\t\\n'\"\\033?""?/\\\\", "a:b",
-      "a\\\\b", "a' b", LQ_ENC RQ_ENC, LQ RQ },
-    { "", "\\0001\\0", 7, "simple", " \\t\\n'\"\\033?""?/\\\\", "a:b",
-      "a\\\\b", "a' b", LQ_ENC RQ_ENC, LQ RQ },
-    { "", "\\0001\\0", 7, "simple", " \\t\\n'\"\\033?""?/\\\\", "a\\:b",
-      "a\\\\b", "a' b", LQ_ENC RQ_ENC, LQ RQ } },
+  { { "", "\\0001\\0", 7, "simple", "\\t'\\t", " \\t\\n'\"\\033?""?/\\\\",
+      "a:b", "a\\\\b", "a' b", LQ_ENC RQ_ENC, LQ RQ },
+    { "", "\\0001\\0", 7, "simple", "\\t'\\t", " \\t\\n'\"\\033?""?/\\\\",
+      "a:b", "a\\\\b", "a' b", LQ_ENC RQ_ENC, LQ RQ },
+    { "", "\\0001\\0", 7, "simple", "\\t'\\t", " \\t\\n'\"\\033?""?/\\\\",
+      "a\\:b", "a\\\\b", "a' b", LQ_ENC RQ_ENC, LQ RQ } },
 
   /* locale_quoting_style */
-  { { "''", "'\\0001\\0'", 9, "'simple'", "' \\t\\n\\'\"\\033?""?/\\\\'",
-      "'a:b'", "'a\\\\b'", "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" },
-    { "''", "'\\0001\\0'", 9, "'simple'", "' \\t\\n\\'\"\\033?""?/\\\\'",
-      "'a:b'", "'a\\\\b'", "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" },
-    { "''", "'\\0001\\0'", 9, "'simple'", "' \\t\\n\\'\"\\033?""?/\\\\'",
-      "'a\\:b'", "'a\\\\b'", "'a\\' b'",
+  { { "''", "'\\0001\\0'", 9, "'simple'", "'\\t\\'\\t'",
+      "' \\t\\n\\'\"\\033?""?/\\\\'", "'a:b'", "'a\\\\b'", "'a\\' b'",
+      "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" },
+    { "''", "'\\0001\\0'", 9, "'simple'", "'\\t\\'\\t'",
+      "' \\t\\n\\'\"\\033?""?/\\\\'", "'a:b'", "'a\\\\b'", "'a\\' b'",
+      "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" },
+    { "''", "'\\0001\\0'", 9, "'simple'", "'\\t\\'\\t'",
+      "' \\t\\n\\'\"\\033?""?/\\\\'", "'a\\:b'", "'a\\\\b'", "'a\\' b'",
       "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" } },
 
   /* clocale_quoting_style */
-  { { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+  { { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\"\\t'\\t\"",
       "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"",
       "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" },
-    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\"\\t'\\t\"",
       "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "\"a\\\\b\"",
       "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" },
-    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\"\\t'\\t\"",
       "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a\\:b\"", "\"a\\\\b\"",
       "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" } }
 };
 
 static struct result_groups flag_results[] = {
   /* literal_quoting_style and QA_ELIDE_NULL_BYTES */
-  { { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b", "a' b",
-      LQ RQ, LQ RQ },
-    { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b", "a' b",
-      LQ RQ, LQ RQ },
-    { "", "1", 1, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b", "a' b",
-      LQ RQ, LQ RQ } },
+  { { "", "1", 1, "simple", "\t'\t", " \t\n'\"\033?""?/\\",
+      "a:b", "a\\b", "a' b", LQ RQ, LQ RQ },
+    { "", "1", 1, "simple", "\t'\t", " \t\n'\"\033?""?/\\",
+      "a:b", "a\\b", "a' b", LQ RQ, LQ RQ },
+    { "", "1", 1, "simple", "\t'\t", " \t\n'\"\033?""?/\\",
+      "a:b", "a\\b", "a' b", LQ RQ, LQ RQ } },
 
   /* c_quoting_style and QA_ELIDE_OUTER_QUOTES */
-  { { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"",
-      "a:b", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ },
-    { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"",
-      "a:b", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ },
-    { "", "\"\\0001\\0\"", 9, "simple", "\" \\t\\n'\\\"\\033?""?/\\\\\"",
-      "\"a:b\"", "a\\b", "a' b", "\"" LQ_ENC RQ_ENC "\"", LQ RQ } },
+  { { "", "\"\\0001\\0\"", 9, "simple", "\"\\t'\\t\"",
+      "\" \\t\\n'\\\"\\033?""?/\\\\\"", "a:b", "a\\b", "a' b",
+      "\"" LQ_ENC RQ_ENC "\"", LQ RQ },
+    { "", "\"\\0001\\0\"", 9, "simple", "\"\\t'\\t\"",
+      "\" \\t\\n'\\\"\\033?""?/\\\\\"", "a:b", "a\\b", "a' b",
+      "\"" LQ_ENC RQ_ENC "\"", LQ RQ },
+    { "", "\"\\0001\\0\"", 9, "simple", "\"\\t'\\t\"",
+      "\" \\t\\n'\\\"\\033?""?/\\\\\"", "\"a:b\"", "a\\b", "a' b",
+      "\"" LQ_ENC RQ_ENC "\"", LQ RQ } },
 
   /* c_quoting_style and QA_SPLIT_TRIGRAPHS */
-  { { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+  { { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\"\\t'\\t\"",
       "\" \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a:b\"", "\"a\\\\b\"",
       "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" },
-    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\"\\t'\\t\"",
       "\" \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a:b\"", "\"a\\\\b\"",
       "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" },
-    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"",
+    { "\"\"", "\"\\0001\\0\"", 9, "\"simple\"", "\"\\t'\\t\"",
       "\" \\t\\n'\\\"\\033?\"\"?/\\\\\"", "\"a\\:b\"", "\"a\\\\b\"",
       "\"a' b\"", "\"" LQ_ENC RQ_ENC "\"", "\"" LQ RQ "\"" } }
 };
@@ -167,79 +181,79 @@ static char const *custom_quotes[][2] = {
 
 static struct result_groups custom_results[] = {
   /* left_quote = right_quote = "" */
-  { { "", "\\0001\\0", 7, "simple",
+  { { "", "\\0001\\0", 7, "simple", "\\t'\\t",
       " \\t\\n'\"\\033?""?/\\\\", "a:b", "a\\\\b",
       "a' b", LQ_ENC RQ_ENC, LQ RQ },
-    { "", "\\0001\\0", 7, "simple",
+    { "", "\\0001\\0", 7, "simple", "\\t'\\t",
       " \\t\\n'\"\\033?""?/\\\\", "a:b", "a\\\\b",
       "a' b", LQ_ENC RQ_ENC, LQ RQ },
-    { "", "\\0001\\0", 7, "simple",
+    { "", "\\0001\\0", 7, "simple", "\\t'\\t",
       " \\t\\n'\"\\033?""?/\\\\", "a\\:b", "a\\\\b",
       "a' b", LQ_ENC RQ_ENC, LQ RQ } },
 
   /* left_quote = right_quote = "'" */
-  { { "''", "'\\0001\\0'", 9, "'simple'",
+  { { "''", "'\\0001\\0'", 9, "'simple'", "'\\t\\'\\t'",
       "' \\t\\n\\'\"\\033?""?/\\\\'", "'a:b'", "'a\\\\b'",
       "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" },
-    { "''", "'\\0001\\0'", 9, "'simple'",
+    { "''", "'\\0001\\0'", 9, "'simple'", "'\\t\\'\\t'",
       "' \\t\\n\\'\"\\033?""?/\\\\'", "'a:b'", "'a\\\\b'",
       "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" },
-    { "''", "'\\0001\\0'", 9, "'simple'",
+    { "''", "'\\0001\\0'", 9, "'simple'", "'\\t\\'\\t'",
       "' \\t\\n\\'\"\\033?""?/\\\\'", "'a\\:b'", "'a\\\\b'",
       "'a\\' b'", "'" LQ_ENC RQ_ENC "'", "'" LQ RQ "'" } },
 
   /* left_quote = "(" and right_quote = ")" */
-  { { "()", "(\\0001\\0)", 9, "(simple)",
+  { { "()", "(\\0001\\0)", 9, "(simple)", "(\\t'\\t)",
       "( \\t\\n'\"\\033?""?/\\\\)", "(a:b)", "(a\\\\b)",
       "(a' b)", "(" LQ_ENC RQ_ENC ")", "(" LQ RQ ")" },
-    { "()", "(\\0001\\0)", 9, "(simple)",
+    { "()", "(\\0001\\0)", 9, "(simple)", "(\\t'\\t)",
       "( \\t\\n'\"\\033?""?/\\\\)", "(a:b)", "(a\\\\b)",
       "(a' b)", "(" LQ_ENC RQ_ENC ")", "(" LQ RQ ")" },
-    { "()", "(\\0001\\0)", 9, "(simple)",
+    { "()", "(\\0001\\0)", 9, "(simple)", "(\\t'\\t)",
       "( \\t\\n'\"\\033?""?/\\\\)", "(a\\:b)", "(a\\\\b)",
       "(a' b)", "(" LQ_ENC RQ_ENC ")", "(" LQ RQ ")" } },
 
   /* left_quote = ":" and right_quote = " " */
-  { { ": ", ":\\0001\\0 ", 9, ":simple ",
+  { { ": ", ":\\0001\\0 ", 9, ":simple ", ":\\t'\\t ",
       ":\\ \\t\\n'\"\\033?""?/\\\\ ", ":a:b ", ":a\\\\b ",
       ":a'\\ b ", ":" LQ_ENC RQ_ENC " ", ":" LQ RQ " " },
-    { ": ", ":\\0001\\0 ", 9, ":simple ",
+    { ": ", ":\\0001\\0 ", 9, ":simple ", ":\\t'\\t ",
       ":\\ \\t\\n'\"\\033?""?/\\\\ ", ":a:b ", ":a\\\\b ",
       ":a'\\ b ", ":" LQ_ENC RQ_ENC " ", ":" LQ RQ " " },
-    { ": ", ":\\0001\\0 ", 9, ":simple ",
+    { ": ", ":\\0001\\0 ", 9, ":simple ", ":\\t'\\t ",
       ":\\ \\t\\n'\"\\033?""?/\\\\ ", ":a\\:b ", ":a\\\\b ",
       ":a'\\ b ", ":" LQ_ENC RQ_ENC " ", ":" LQ RQ " " } },
 
   /* left_quote = " " and right_quote = ":" */
-  { { " :", " \\0001\\0:", 9, " simple:",
+  { { " :", " \\0001\\0:", 9, " simple:", " \\t'\\t:",
       "  \\t\\n'\"\\033?""?/\\\\:", " a\\:b:", " a\\\\b:",
       " a' b:", " " LQ_ENC RQ_ENC ":", " " LQ RQ ":" },
-    { " :", " \\0001\\0:", 9, " simple:",
+    { " :", " \\0001\\0:", 9, " simple:", " \\t'\\t:",
       "  \\t\\n'\"\\033?""?/\\\\:", " a\\:b:", " a\\\\b:",
       " a' b:", " " LQ_ENC RQ_ENC ":", " " LQ RQ ":" },
-    { " :", " \\0001\\0:", 9, " simple:",
+    { " :", " \\0001\\0:", 9, " simple:", " \\t'\\t:",
       "  \\t\\n'\"\\033?""?/\\\\:", " a\\:b:", " a\\\\b:",
       " a' b:", " " LQ_ENC RQ_ENC ":", " " LQ RQ ":" } },
 
   /* left_quote = "# " and right_quote = "\n" */
-  { { "# \n", "# \\0001\\0\n", 10, "# simple\n",
+  { { "# \n", "# \\0001\\0\n", 10, "# simple\n", "# \\t'\\t\n",
       "#  \\t\\n'\"\\033?""?/\\\\\n", "# a:b\n", "# a\\\\b\n",
       "# a' b\n", "# " LQ_ENC RQ_ENC "\n", "# " LQ RQ "\n" },
-    { "# \n", "# \\0001\\0\n", 10, "# simple\n",
+    { "# \n", "# \\0001\\0\n", 10, "# simple\n", "# \\t'\\t\n",
       "#  \\t\\n'\"\\033?""?/\\\\\n", "# a:b\n", "# a\\\\b\n",
       "# a' b\n", "# " LQ_ENC RQ_ENC "\n", "# " LQ RQ "\n" },
-    { "# \n", "# \\0001\\0\n", 10, "# simple\n",
+    { "# \n", "# \\0001\\0\n", 10, "# simple\n", "# \\t'\\t\n",
       "#  \\t\\n'\"\\033?""?/\\\\\n", "# a\\:b\n", "# a\\\\b\n",
       "# a' b\n", "# " LQ_ENC RQ_ENC "\n", "# " LQ RQ "\n" } },
 
   /* left_quote = "\"'" and right_quote = "'\"" */
-  { { "\"''\"", "\"'\\0001\\0'\"", 11, "\"'simple'\"",
+  { { "\"''\"", "\"'\\0001\\0'\"", 11, "\"'simple'\"", "\"'\\t'\\t'\"",
       "\"' \\t\\n\\'\"\\033?""?/\\\\'\"", "\"'a:b'\"", "\"'a\\\\b'\"",
       "\"'a' b'\"", "\"'" LQ_ENC RQ_ENC "'\"", "\"'" LQ RQ "'\"" },
-    { "\"''\"", "\"'\\0001\\0'\"", 11, "\"'simple'\"",
+    { "\"''\"", "\"'\\0001\\0'\"", 11, "\"'simple'\"", "\"'\\t'\\t'\"",
       "\"' \\t\\n\\'\"\\033?""?/\\\\'\"", "\"'a:b'\"", "\"'a\\\\b'\"",
       "\"'a' b'\"", "\"'" LQ_ENC RQ_ENC "'\"", "\"'" LQ RQ "'\"" },
-    { "\"''\"", "\"'\\0001\\0'\"", 11, "\"'simple'\"",
+    { "\"''\"", "\"'\\0001\\0'\"", 11, "\"'simple'\"", "\"'\\t'\\t'\"",
       "\"' \\t\\n\\'\"\\033?""?/\\\\'\"", "\"'a\\:b'\"", "\"'a\\\\b'\"",
       "\"'a' b'\"", "\"'" LQ_ENC RQ_ENC "'\"", "\"'" LQ RQ "'\"" } }
 };
index 335bbd5aee3d69c2a73971362e19b2d5577405fe..c9889496d97f48c5c68f8245ce01efe09ea518d2 100644 (file)
 
 static struct result_groups locale_results[] = {
   /* locale_quoting_style */
-  { { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ,
+  { { LQ RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ "\\t'\\t" RQ,
       LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" 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 RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ "\\t'\\t" RQ,
       LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" 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 RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ "\\t'\\t" RQ,
       LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a\\:b" RQ, LQ "a\\\\b" 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 RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ "\\t'\\t" RQ,
       LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" 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 RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ "\\t'\\t" RQ,
       LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a:b" RQ, LQ "a\\\\b" 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 RQ, LQ "\\0001\\0" RQ, 11, LQ "simple" RQ, LQ "\\t'\\t" RQ,
       LQ " \\t\\n'\"\\033?""?/\\\\" RQ, LQ "a\\:b" RQ, LQ "a\\\\b" RQ,
       LQ "a' b" RQ, LQ LQ RQ_ESC RQ, LQ LQ RQ_ESC RQ } }
 };
index 47de7fee9fa5cba4df7abacb488bc438bbfff39c..b0e0296c79093b2734fff2ccc44e991e3e83f93d 100644 (file)
@@ -21,6 +21,7 @@ struct result_strings {
   char const *str2; /* Translation of "\0""1\0".  */
   size_t len2; /* Length of str2.  */
   char const *str3; /* Translation of "simple".  */
+  char const *str4q; /* Translation of "\t'\t".  */
   char const *str4; /* Translation of " \t\n'\"\033?""?/\\".  */
   char const *str5; /* Translation of "a:b".  */
   char const *str6; /* Translation of "a\\b".  */
@@ -43,7 +44,7 @@ struct result_groups {
 # define RQ_ESC "\\\302\273"
 
 static struct result_strings inputs = {
-  "", "\0001\0", 3, "simple", " \t\n'\"\033?""?/\\", "a:b", "a\\b",
+  "", "\0001\0", 3, "simple", "\t'\t", " \t\n'\"\033?""?/\\", "a:b", "a\\b",
   "a' b", LQ RQ, NULL
 };
 
@@ -74,6 +75,10 @@ compare_strings (char *(func) (char const *, size_t *),
   p = func (inputs.str3, &len);
   compare (results->str3, strlen (results->str3), p, len);
 
+  len = strlen (inputs.str4q);
+  p = func (inputs.str4q, &len);
+  compare (results->str4q, strlen (results->str4q), p, len);
+
   len = strlen (inputs.str4);
   p = func (inputs.str4, &len);
   compare (results->str4, strlen (results->str4), p, len);