From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6956 invoked from network); 18 Jun 1999 08:55:56 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 18 Jun 1999 08:55:56 -0000 Received: (qmail 6417 invoked by alias); 18 Jun 1999 08:55:52 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6708 Received: (qmail 6398 invoked from network); 18 Jun 1999 08:55:47 -0000 From: "Bart Schaefer" Message-Id: <990616064201.ZM25950@candle.brasslantern.com> Date: Wed, 16 Jun 1999 06:42:01 +0000 In-Reply-To: Comments: In reply to David Aspinwall "execve bug" (Jun 14, 1:13pm) References: X-Mailer: Z-Mail (5.0.0 30July97) To: David Aspinwall , amol@blarg.net, zsh-workers@math.gatech.edu Subject: Re: execve bug MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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