[Thunar-dev] Configure Custom Actions

Benedikt Meurer benedikt.meurer at unix-ag.uni-siegen.de
Wed Jan 25 18:07:56 CET 2006


Tim Alexander wrote:
> Hello eveeryone!

Hey Tim,

> I'm new, so please be kind. I'm not a very
> experienced programmer, though I'm picking things up, so I may be able
> to help out in the future. For now, I'm a Software Test Engineer for
> Bayer Healthcare.
> 
> I found a bug in the system, and thought I should report it. When I
> set  a custom action, it puts single quotes around everything that was
> a special character in the command that was issued. IE:
> 
> Assuming;
> 1. Command is meant to open readme.txt as root in gedit.
> 2. You are in the /home/user directory.
> 
> Custom Action 1:
> sudo gedit %n
> 
> Command Executed 1:
> sudo gedit /home/user/'readme.txt'
> 
> Resulting Issue 1:
> A filename is assumed to be 'readme.txt'
> It should be readme.txt
> 
> Command Action 2:
> sudo gedit %f
> 
> Command Executed 2:
> sudo gedit /home/user/'/home/user/readme.txt'
> 
> Resulting Issue 2:
> The path is passed to gedit, along with the current path, making gedit
> unable to find the file.
> The single quotes still present a problem, as gedit throws an error
> when attempting to save.
> 
> Solution 1:
> Remove the single quotes, and replace them with double quotes (")
> 
> Solution 2:
> Have special paramaters (%n, %f, %N, %F, %d, %D) totally strip the
> path before evaluating the special parameter.

I'm sorry, but I cannot really reproduce the problem. In fact, I'm not
even sure if I understand the problem. The problematic cases you list
above work fine here.

What thunar-uca does currently, is:

(1) generate the command line, using g_shell_quote() [1] to quote all
paths being inserted into the command line.
(2) convert the command line to an argument vector using
g_shell_parse_argv() [2]
(3) execute the command

Maybe you can provide some more information, esp. how did you check what
command is being executed?

greets,
Benedikt

[1]
http://developer.gnome.org/doc/API/2.0/glib/glib-Shell-related-Utilities.html#g-shell-quote
[2]
http://developer.gnome.org/doc/API/2.0/glib/glib-Shell-related-Utilities.html#g-shell-parse-argv



More information about the Thunar-dev mailing list