zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: David Aspinwall <aspinwall@TimesTen.com>,
	amol@blarg.net, zsh-workers@math.gatech.edu
Subject: Re: execve bug
Date: Wed, 16 Jun 1999 06:42:01 +0000	[thread overview]
Message-ID: <990616064201.ZM25950@candle.brasslantern.com> (raw)
In-Reply-To: <un1y28rsc.fsf@TimesTen.com>

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


  reply	other threads:[~1999-06-18  8:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-14 20:13 David Aspinwall
1999-06-16  6:42 ` Bart Schaefer [this message]
1999-06-16  6:56 ` PATCH: " Bart Schaefer
1999-06-16  8:51   ` PATCH: pws-22: " Peter Stephenson
1999-06-15 17:16 David Aspinwall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=990616064201.ZM25950@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=amol@blarg.net \
    --cc=aspinwall@TimesTen.com \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).