mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 16:06:16 +01:00
Fix regression in g_shell_parse_argv()
The commit in 6e4acf44b3
broke
the fallthrough case for '\\' when it changed the '#' case.
This caused issues like this:
https://bugzilla.gnome.org/show_bug.cgi?id=683821
https://bugzilla.gnome.org/show_bug.cgi?id=562907
This commit is contained in:
parent
d6b9df6949
commit
c99acf51d0
@ -518,6 +518,9 @@ tokenize_command_line (const gchar *command_line,
|
|||||||
g_string_append_c (current_token, *p);
|
g_string_append_c (current_token, *p);
|
||||||
|
|
||||||
/* FALL THRU */
|
/* FALL THRU */
|
||||||
|
case '\\':
|
||||||
|
current_quote = *p;
|
||||||
|
break;
|
||||||
|
|
||||||
case '#':
|
case '#':
|
||||||
if (p == command_line)
|
if (p == command_line)
|
||||||
@ -538,9 +541,6 @@ tokenize_command_line (const gchar *command_line,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '\\':
|
|
||||||
current_quote = *p;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Combines rules 4) and 6) - if we have a token, append to it,
|
/* Combines rules 4) and 6) - if we have a token, append to it,
|
||||||
|
@ -66,7 +66,8 @@ static CmdlineTest cmdline_tests[] =
|
|||||||
{ "foo '\"bar\" baz", 0, { NULL }, G_SHELL_ERROR_BAD_QUOTING },
|
{ "foo '\"bar\" baz", 0, { NULL }, G_SHELL_ERROR_BAD_QUOTING },
|
||||||
{ "", 0, { NULL }, G_SHELL_ERROR_EMPTY_STRING },
|
{ "", 0, { NULL }, G_SHELL_ERROR_EMPTY_STRING },
|
||||||
{ " ", 0, { NULL }, G_SHELL_ERROR_EMPTY_STRING },
|
{ " ", 0, { NULL }, G_SHELL_ERROR_EMPTY_STRING },
|
||||||
{ "# foo bar", 0, { NULL }, G_SHELL_ERROR_EMPTY_STRING }
|
{ "# foo bar", 0, { NULL }, G_SHELL_ERROR_EMPTY_STRING },
|
||||||
|
{"foo '/bar/summer'\\''09 tours.pdf'", 2, {"foo", "/bar/summer'09 tours.pdf", NULL}, -1}
|
||||||
};
|
};
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
Reference in New Issue
Block a user