zsh-users
 help / color / mirror / code / Atom feed
From: Chet Ramey <chet.ramey@case.edu>
To: Bart Schaefer <schaefer@brasslantern.com>, zsh-users@zsh.org
Cc: chet.ramey@case.edu
Subject: Re: Running "unset path" breaks PATH despite emulation being enabled
Date: Sun, 10 Sep 2017 14:51:15 -0400	[thread overview]
Message-ID: <2ca0606c-3c56-8275-e9b2-a8159d018b80@case.edu> (raw)
In-Reply-To: <170909152512.ZM9176@torch.brasslantern.com>

On 9/9/17 6:25 PM, Bart Schaefer wrote:

> I just had a look at the Bash sources.  Chet will correct me if I'm wrong,
> but as far as I can tell if argv[0] is not already at least a partial
> path, then $BASH is set by doing a path search for the first matching
> executable.  Thus $BASH will be "the first one listed in a $PATH folder" 
> when argv[0] contains no "/" separators, even if the actual executable
> came from somewhere else.

This is about the best you can do. The only additional thing would be to
assume that the executed binary came from the current directory if you
can't find it in $PATH, because that's how execve(2) and its siblings work.
It's a heuristic based on how the shell is commonly executed, but it can
certainly be fooled.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/


      parent reply	other threads:[~2017-09-10 18:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170908082917.v5j4vczoq75vs5lk@sinister.lan.codevat.com>
     [not found] ` <CAHYJk3RD6p7PwRaZSUbJSAE0Bi6_2+NKLC3MV+32Lh+PmzsAdA@mail.gmail.com>
2017-09-09 21:38   ` Eric Pruitt
2017-09-09 22:25     ` Bart Schaefer
2017-09-09 22:38       ` Eric Pruitt
2017-09-10  9:42         ` Daniel Shahaf
2017-09-10 23:50         ` Bart Schaefer
2017-09-11  4:39           ` Eric Pruitt
2017-09-10 18:51       ` Chet Ramey [this message]

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=2ca0606c-3c56-8275-e9b2-a8159d018b80@case.edu \
    --to=chet.ramey@case.edu \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /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).