[Goodies-dev] [Bug 4028] New: commands with quotes do not run in genmon

bugzilla-daemon at xfce.org bugzilla-daemon at xfce.org
Sat Apr 19 23:46:24 CEST 2008


DO NOT REPLY TO THIS EMAIL.  Also, do not reply via email to the person
whose email is mentioned below.  To comment on this bug, please visit:
http://bugzilla.xfce.org/show_bug.cgi?id=4028

           Summary: commands with quotes do not run in genmon
           Product: Xfce Panel Plugins
           Version: unspecified
          Platform: PC (x86)
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: Medium
         Component: genmon
        AssignedTo: goodies-dev at xfce.org
        ReportedBy: stephent98 at hotmail.com


Commands with quotes do not run. Instead, the genmon plugin displays "XXX".
Reproduce by configuring genmon to invoke this command once per second:
sh -c 'echo -n "foo "; echo bar'
In a terminal window, this command produces "foo bar".

The problem is that the command line is over-parsed. From strace:
$ ps -e | fgrep genmon
13783 ?        00:00:01 xfce4-genmon-pl
$ strace -p 13783 -f -e write=2 2>x.log

[pid 14338] execve("/bin/sh", ["sh"..., "-c"..., "\'echo"..., "-n"...,
"\"foo"..., "\";"..., "echo"..., "bar\'"...], [/* 39 vars */]) = 0

Which produces these errors:
[pid 14338] write(2, "-n: -c: line 0: unexpected EOF w"..., 62) = 62
 | 00000  2d 6e 3a 20 2d 63 3a 20  6c 69 6e 65 20 30 3a 20  -n: -c:  line 0:  |
 | 00010  75 6e 65 78 70 65 63 74  65 64 20 45 4f 46 20 77  unexpect ed EOF w |
 | 00020  68 69 6c 65 20 6c 6f 6f  6b 69 6e 67 20 66 6f 72  hile loo king for |
 | 00030  20 6d 61 74 63 68 69 6e  67 20 60 27 27 0a         matchin g `''.   |
[pid 14338] write(2, "-n: -c: line 1: syntax error: un"..., 53) = 53
 | 00000  2d 6e 3a 20 2d 63 3a 20  6c 69 6e 65 20 31 3a 20  -n: -c:  line 1:  |
 | 00010  73 79 6e 74 61 78 20 65  72 72 6f 72 3a 20 75 6e  syntax e rror: un |
 | 00020  65 78 70 65 63 74 65 64  20 65 6e 64 20 6f 66 20  expected  end of  |
 | 00030  66 69 6c 65 0a                                    file.             |

The same command run from the launcher plugin does not produce any errors (as
shown by strace). The launcher plugin calls g_shell_parse_argv() in
xfce4-panel-4.4.2/plugins/launcher/launcher.c.

A suggested solution is to replace the call to ParseCmdline() in cmdspawn.c
with a call to g_shell_parse_argv() and remove ParseCmdline() from cmdspawn.c.

g_shell_parse_argv() is documented here:
http://library.gnome.org/devel/glib/stable/glib-Shell-related-Utilities.html#g-shell-parse-argv

xfce4-genmon-plugin 3.2 - Generic Monitor


-- 
Configure bugmail: http://bugzilla.xfce.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Goodies-dev mailing list