Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add quotes to exec command in mu find #311

Closed
wants to merge 1 commit into from

2 participants

@iltempo

I came across this when I was trying to find messages and show it in less mu find whatever --exec "less".

If messages are found in paths containing spaces like ~/Mail/account/[Gmail] All Messages/, less is called with the parts and won't find the files.

@djcb
Owner

Ah, good catch. However, the fix should probably also handle e.g. where there's are quotation marks etc. in the string.

@iltempo

I'm not a C expert. But as it seems putting double quotes around the file name should solve the problem. Double quotes are escaped. http://developer.gimp.org/api/2.0/glib/glib-String-Utility-Functions.html#g-strescape

@djcb
Owner

This is solved now, using g_shell_quote.

@djcb djcb closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 9, 2013
  1. @iltempo
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  mu/mu-cmd-find.c
View
2  mu/mu-cmd-find.c
@@ -145,7 +145,7 @@ exec_cmd (MuMsg *msg, MuMsgIter *iter, MuConfig *opts, GError **err)
gboolean rv;
escpath = g_strescape (mu_msg_get_path (msg), NULL);
- cmdline = g_strdup_printf ("%s %s", opts->exec, escpath);
+ cmdline = g_strdup_printf ("%s '%s'", opts->exec, escpath);
rv = g_spawn_command_line_sync (cmdline, NULL, NULL, &status, err);
Something went wrong with that request. Please try again.