Zsh Mailing List Archive
Messages sorted by:
Re: Weird behaviour
- X-seq: zsh-users 15917
- From: Raghavendra D Prabhu <rprabhu@xxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Weird behaviour
- Date: Sun, 3 Apr 2011 15:39:19 +0530
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=wnohang.net; s=mail; t=1301825365; bh=BSMJq/jnBhKm+WrIyZ/sXdMFYlqlUMct4JzJtPxVjU8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=ZvwXP/9OlyFWpLmM7azkz1UyjZB29jSdjBB4nlSafU5LIwm383ddn9R7HWSCIzy5H RA6SpTk+wW5qFQ7msddEnB/4PD4lUuSM5Dv3GNKfTlft2dEQ91PC7DJHjkpbaV2xXF d9nWJi883Sish5VQ7iwFeFyLJ52ZStDIAAhCh0fw=
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=wnohang.net; s=mail; t=1301825364; bh=BSMJq/jnBhKm+WrIyZ/sXdMFYlqlUMct4JzJtPxVjU8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=HcR6HiPWaSJ9yv+QrjM3JbZT2WQGygDZuQaHKzuVZ1jCdmIRzibQSZ5Ix/F2BVNEu YShJhbPsEb1hoXwHkMXw3Wte0lj1K54/9FrxCdRW0125OSs4XbTGx4e6ZvqSAgCpUX Bul6V9YT5ze0pHrtU9UaDUOtQFmXbuKnlotldAP8=
- In-reply-to: <110402170529.ZM5325@torch.brasslantern.com>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:email@example.com>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20110402210017.GB5738@Xye> <110402170529.ZM5325@torch.brasslantern.com>
* On Sat, Apr 02, 2011 at 05:05:29PM -0700, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
On Apr 3, 2:30am, Raghavendra D Prabhu wrote:
} Xye% ""
} zsh: permission denied:
} Is this a bug or some weird quirk ?
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
Cool. Thanks for the explanation.
Description: PGP signature
Messages sorted by: