Package: ion3
Version: 20050502-2
Severity: wishlist
Tags: patch

Hi,
when ion3 executes programms (e.g. xterm) it uses sh -c "...". The
so spawned sh process hangs around until the program exits.

If ion used sh -c "exec ..." there wouldn't be an extra shell around
for each command executed.

The only problem with this is when a command sequence is executed
instead of a command, e.g. sh -c "exec xterm; xterm". This obviously
doesn't work.

I've written a patch that checks for ';' in the command string, uses
sh -c "..." if it's found and sh -c "exec ..." otherwise.

That patch is attached, works fine on my system, on commands as well
as on sequences.

Cheers,
Christian Aichinger


-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'testing-proposed-updates'), (500, 
'proposed-updates'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-rc6-vs2.1.0-pre1-r20050817
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=UTF-8)

Versions of packages ion3 depends on:
ii  libc6                    2.3.5-8         GNU C Library: Shared libraries an
ii  libice6                  6.8.2.dfsg.1-11 Inter-Client Exchange library
ii  liblua50                 5.0.2-5.1       Main interpreter library for the L
ii  liblualib50              5.0.2-5.1       Extension library for the Lua 5.0 
ii  libsm6                   6.8.2.dfsg.1-11 X Window System Session Management
ii  libx11-6                 4.3.0.dfsg.1-13 X Window System protocol client li
ii  libxext6                 6.8.2.dfsg.1-11 X Window System miscellaneous exte
ii  xlibs                    6.8.2.dfsg.1-11 X Window System client libraries m

ion3 recommends no packages.

-- no debconf information
diff -Nur ion3-20060524.orig/libmainloop/exec.c ion3-20060524/libmainloop/exec.c
--- ion3-20060524.orig/libmainloop/exec.c       2006-05-24 18:23:26.000000000 
+0200
+++ ion3-20060524/libmainloop/exec.c    2006-06-13 13:34:41.000000000 +0200
@@ -35,15 +35,25 @@
 #define SHELL_PATH "/bin/sh"
 #define SHELL_NAME "sh"
 #define SHELL_ARG "-c"
+#define SHELL_PREPEND "exec "
 
 
 void mainloop_do_exec(const char *cmd)
 {
     char *argv[4];
+    char *newcmd;
+    
+    if (strchr(cmd, ';')) {
+        newcmd = cmd;
+    } else {
+        newcmd = malloc(strlen(SHELL_PREPEND)+strlen(cmd)+1);
+        strcpy(newcmd, SHELL_PREPEND);
+        strcat(newcmd, cmd);
+    }
 
     argv[0]=SHELL_NAME;
     argv[1]=SHELL_ARG;
-    argv[2]=(char*)cmd; /* stupid execve... */
+    argv[2]=(char*)newcmd; /* stupid execve... */
     argv[3]=NULL;
     execvp(SHELL_PATH, argv);
 }

Attachment: signature.asc
Description: Digital signature

Reply via email to