Package: hurd
Version: CVS
Severity: important

If the #! line of a script contains an argument for the
interpreter, the argument gets its first character doubled.  This
prevents installation of packages which use #!/bin/sh -e in their
maintainer scripts.

kalle@PC486:/tmp$ ls -l abc
-rwxrwxr-x    1 kalle    root           16 Apr 17 17:16 abc
kalle@PC486:/tmp$ cat abc
#!/bin/echo def
kalle@PC486:/tmp$ ./abc
ddef ./abc

Here's the fix.  INTERP_LEN will still include the null because P
points to the character after the null.

--- hurd/exec/hashexec.c.orig   Mon Mar 20 08:57:44 2000
+++ hurd/exec/hashexec.c        Mon Apr 17 17:13:10 2000
@@ -178,7 +178,7 @@
 
       arg = p + strspn (p, " \t");
       arg_len = interp_len - 1 - (arg - interp_buf); /* without null here */
-      interp_len = p + 1 - interp; /* This one includes the null.  */
+      interp_len = p - interp; /* This one includes the null.  */
 
       if (arg_len == 0)
        arg = NULL;

After installing the patched version and rebooting:

kalle@PC486:/tmp$ ls -l abc
-rwxrwxr-x    1 kalle    root           16 Apr 17 17:24 abc
kalle@PC486:/tmp$ cat abc
#!/bin/echo def
kalle@PC486:/tmp$ ./abc
def ./abc

When I noticed the problem, I initially tried attaching gdb to
the exec server and setting breakpoints.  But when I told gdb to
continue, it said it was unable to wait for the process and soon
after that the exec server seemed to crash -- or perhaps it
stopped at the breakpoint but didn't tell gdb.

Is it possible to debug the primary exec server with gdb?
Or is it possible to run another exec server and debug that?

Reply via email to