Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: execve bug
- X-seq: zsh-workers 6708
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: David Aspinwall <aspinwall@xxxxxxxxxxxx>, amol@xxxxxxxxx, zsh-workers@xxxxxxxxxxxxxxx
- Subject: Re: execve bug
- Date: Wed, 16 Jun 1999 06:42:01 +0000
- In-reply-to: <un1y28rsc.fsf@xxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <un1y28rsc.fsf@xxxxxxxxxxxx>
On Jun 14, 1:13pm, David Aspinwall wrote:
} Subject: execve bug
}
} If you have a script called 'dog' whose first line is '#!/bin/sh '
} (i.e., has at least one space after the interpreter name), and
} the OS doesn't support #!, zsh will wind up calling execve with
} an argv of ("/bin/sh", "", "dog").
Thanks for pointing this out. The same problem happens with a trailing
tab, so I think the following patch is better. There was also no reason
for the old code wandereding all the way to t0 == ct clobbering newlines
once the first one was found.
Index: Src/exec.c
==========================================================================
@@ -251,7 +251,9 @@
if (execvebuf[1] == '!') {
for (t0 = 0; t0 != ct; t0++)
if (execvebuf[t0] == '\n')
- execvebuf[t0] = '\0';
+ break;
+ while (inblank(execvebuf[t0]))
+ execvebuf[t0--] = '\0';
execvebuf[POUNDBANGLIMIT] = '\0';
for (ptr = execvebuf + 2; *ptr && *ptr == ' '; ptr++);
for (ptr2 = ptr; *ptr && *ptr != ' '; ptr++);
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author