Uzbl

Tasklist

FS#279 - shell_cmd arguments strangely permuted

Attached to Project: Uzbl
Opened by Dylan Simon (dylex) - 2011-08-18 06:01:07 AM
Task Type Bug Report
Category uzbl-core
Status Unconfirmed
Assigned To No-one
Operating System Linux
Severity Low
Priority Normal
Reported Version Development
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

When I try to set shell_cmd to something with more than two arguments, strange things happen. For example, if I 'set shell_cmd = echo a b c', and then run 'sh foo bar', I get "c b a foo echo bar". In order to do something sensible, I had to 'set shell_cmd = sh "shift ; eval $0" -c' rather than the other way around. It looks like the shell_cmd arguments are getting inverted in spawn_sh, and I don't understand the purpose of it. However, I only just started using uzbl, so I may be missing something critical.
This task depends upon

Comment by Dylan Simon (dylex) - 2011-08-18 03:27:51 PM
Also, %s doesn't seem to get expanded in shell_cmd as the README claims.
Comment by Dylan Simon (dylex) - 2011-08-23 12:08:52 AM
Here's a patch for you

diff --git a/src/uzbl-core.c b/src/uzbl-core.c
index af60767..4d4868f 100644
--- a/src/uzbl-core.c
+++ b/src/uzbl-core.c
@@ -595,10 +595,9 @@ spawn_sh(GArray *argv, GString *result) {
if(!cmd)
return;

- gchar *cmdname = g_strdup(cmd[0]);
- g_array_insert_val(argv, 1, cmdname);
+ g_array_insert_val(argv, 1, cmd[0]);

- for (i = 1; i < g_strv_length(cmd); i++)
+ for (i = g_strv_length(cmd)-1; i > 0; i--)
g_array_prepend_val(argv, cmd[i]);

if (result) {
@@ -609,7 +608,6 @@ spawn_sh(GArray *argv, GString *result) {
} else
run_command(cmd[0], (const gchar **) argv->data, FALSE, NULL);

- g_free (cmdname);
g_strfreev (cmd);
}

Loading...