[geany/geany] 41184e: Properly escape working directory in run script using g_shell_quote()

Jiří Techet git-noreply at xxxxx
Fri Jul 3 08:30:23 UTC 2015


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Fri, 03 Jul 2015 08:30:23 UTC
Commit:      41184e4b986b513da7163136da38eb6401ca88e5
             https://github.com/geany/geany/commit/41184e4b986b513da7163136da38eb6401ca88e5

Log Message:
-----------
Properly escape working directory in run script using g_shell_quote()

The g_strescape() function escapes non-ASCII characters so that bash
doesn't understand them.


Modified Paths:
--------------
    src/build.c

Modified: src/build.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -1088,9 +1088,9 @@ static gchar *build_create_shellscript(const gchar *working_dir, const gchar *cm
 	str = g_strdup_printf("cd \"%s\"\n\n%s\n\n%s\ndel \"%%0\"\n\npause\n", working_dir, expanded_cmd, (autoclose) ? "" : "pause");
 	g_free(expanded_cmd);
 #else
-	escaped_dir = g_strescape(working_dir, NULL);
+	escaped_dir = g_shell_quote(working_dir);
 	str = g_strdup_printf(
-		"#!/bin/sh\n\nrm $0\n\ncd \'%s\'\n\n%s\n\necho \"\n\n------------------\n(program exited with code: $?)\" \
+		"#!/bin/sh\n\nrm $0\n\ncd %s\n\n%s\n\necho \"\n\n------------------\n(program exited with code: $?)\" \
 		\n\n%s\n", escaped_dir, cmd, (autoclose) ? "" :
 		"\necho \"Press return to continue\"\n#to be more compatible with shells like "
 			"dash\ndummy_var=\"\"\nread dummy_var");



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list