From: Raghavendra D Prabhu <rprabhu@wnohang.net>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-users@zsh.org
Subject: Re: Weird behaviour
Date: Sun, 3 Apr 2011 15:39:19 +0530 [thread overview]
Message-ID: <20110403100918.GA5126@Xye> (raw)
In-Reply-To: <110402170529.ZM5325@torch.brasslantern.com>
[-- Attachment #1: Type: text/plain, Size: 1340 bytes --]
* On Sat, Apr 02, 2011 at 05:05:29PM -0700, Bart Schaefer <schaefer@brasslantern.com> wrote:
>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.
Cool. Thanks for the explanation.
--------------------------
Raghavendra Prabhu
GPG ID:D72BE977
[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]
next prev parent reply other threads:[~2011-04-03 10:09 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
2011-04-03 10:09 ` Raghavendra D Prabhu [this message]
[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=20110403100918.GA5126@Xye \
--to=rprabhu@wnohang.net \
--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).