zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: execve bug
Date: Wed, 16 Jun 1999 06:56:37 +0000	[thread overview]
Message-ID: <990616065637.ZM25982@candle.brasslantern.com> (raw)
In-Reply-To: <un1y28rsc.fsf@TimesTen.com>

(I inadvertently sent another copy of this though math.gatech.edu because
that's where David sent the mail to which I replied.  My other doesn't have
the word "PATCH" in the header, and hasn't come back to me yet, so on the
chance that it's been hung out in limbo I'm sending this one.)

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


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  parent reply	other threads:[~1999-06-16  6:57 UTC|newest]

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

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=990616065637.ZM25982@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).