zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Weird behaviour
Date: Sat, 02 Apr 2011 17:05:29 -0700	[thread overview]
Message-ID: <110402170529.ZM5325@torch.brasslantern.com> (raw)
In-Reply-To: <20110402210017.GB5738@Xye>

On Apr 3,  2:30am, Raghavendra D Prabhu wrote:
}
} Xye% ""
} zsh: permission denied:
} ============================
} Is this a bug or some weird quirk ?

Neither, exactly.

You've asked the shell to execute the command named (empty string) found
anywhere in the directories named in $PATH.

Bash searches the path and finds no executable file named (empty string)
so it gives up and prints "command not found".

Zsh does the same search, but instead of giving up at the end it repeats
the attempt with actual execve() system calls, so as to find the "real"
error that the operating system would report if you were to have typed
out the full path to the command.  That error is "permission denied"
because (any directory name)/(empty string) is the same as the directory
itself, and directories can't be executed as commands.

Aside:  As it happens, if you were to have typed out the full path in
bash, it first calls execve(), but when that fails with "permission
denied" bash goes one step further and stat()s the path to determine
if it is a directory, and if so prints "is a directory" instead of the
permission error.


  reply	other threads:[~2011-04-03  0:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-02 21:00 Raghavendra D Prabhu
2011-04-03  0:05 ` Bart Schaefer [this message]
2011-04-03 10:09   ` Raghavendra D Prabhu
     [not found] <1239988964.1061254.1462817768615.JavaMail.yahoo.ref@mail.yahoo.com>
2016-05-09 18:16 ` weird behaviour david sowerby
     [not found] <670153790.1038299.1462818842516.JavaMail.yahoo.ref@mail.yahoo.com>
2016-05-09 18:34 ` david sowerby
2016-05-09 20:04   ` Nikolay Aleksandrovich Pavlov (ZyX)
     [not found] <2078594247.1137691.1462826039528.JavaMail.yahoo.ref@mail.yahoo.com>
2016-05-09 20:33 ` david sowerby
2016-05-10  3:12   ` Bart Schaefer

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=110402170529.ZM5325@torch.brasslantern.com \
    --to=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).