[glib] Fix regression in g_shell_parse_argv()
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Fix regression in g_shell_parse_argv()
- Date: Thu, 13 Sep 2012 08:20:41 +0000 (UTC)
commit c99acf51d0405500592c36b739faa6bfcdb8181a
Author: Alexander Larsson <alexl redhat com>
Date: Thu Sep 13 10:13:04 2012 +0200
Fix regression in g_shell_parse_argv()
The commit in 6e4acf44b3a943906432a2bf55223ac107d8e0c2 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
glib/gshell.c | 8 ++++----
glib/tests/shell.c | 3 ++-
2 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/glib/gshell.c b/glib/gshell.c
index 6b166e1..2891206 100644
--- a/glib/gshell.c
+++ b/glib/gshell.c
@@ -518,7 +518,10 @@ tokenize_command_line (const gchar *command_line,
g_string_append_c (current_token, *p);
/* FALL THRU */
-
+ case '\\':
+ current_quote = *p;
+ break;
+
case '#':
if (p == command_line)
{ /* '#' was the first char */
@@ -538,9 +541,6 @@ tokenize_command_line (const gchar *command_line,
break;
}
break;
- case '\\':
- current_quote = *p;
- break;
default:
/* Combines rules 4) and 6) - if we have a token, append to it,
diff --git a/glib/tests/shell.c b/glib/tests/shell.c
index 41ecb9d..41e9d68 100644
--- a/glib/tests/shell.c
+++ b/glib/tests/shell.c
@@ -66,7 +66,8 @@ static CmdlineTest cmdline_tests[] =
{ "foo '\"bar\" baz", 0, { NULL }, G_SHELL_ERROR_BAD_QUOTING },
{ "", 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]