Your message dated Thu, 28 Jun 2007 00:56:01 +0100
with message-id <[EMAIL PROTECTED]>
and subject line please execute commands via sh -c "exec xyz" instead of sh -c
"xyz"
has caused the attached Bug report to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere. Please contact me immediately.)
Debian bug tracking system administrator
(administrator, Debian Bugs database)
--- Begin Message ---
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);
}
signature.asc
Description: Digital signature
--- End Message ---
--- Begin Message ---
Christian 'Greek0' Aichinger <[EMAIL PROTECTED]> wrote:
> 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.
<snip>
There's the same problem with "&&", "||", and maybe others. So I think
this is a bad idea and I don't intend to change the way programs are
executed. I believe you should be able to change this behaviour at the
Lua level if you really want.
Ben.
--
Ben Hutchings
Anthony's Law of Force: Don't force it, get a larger hammer.
signature.asc
Description: This is a digitally signed message part
--- End Message ---