From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9068 invoked by alias); 3 Apr 2011 10:09:32 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15917 Received: (qmail 12243 invoked from network); 3 Apr 2011 10:09:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at wnohang.net designates 178.79.154.173 as permitted sender) X-DKIM: Sendmail DKIM Filter v2.8.3 mail.wnohang.net 17FD524142 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= X-DKIM: Sendmail DKIM Filter v2.8.3 mail.wnohang.net 13A662401A 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= Date: Sun, 3 Apr 2011 15:39:19 +0530 From: Raghavendra D Prabhu To: Bart Schaefer Cc: zsh-users@zsh.org Subject: Re: Weird behaviour Message-ID: <20110403100918.GA5126@Xye> Mail-Followup-To: Bart Schaefer , zsh-users@zsh.org References: <20110402210017.GB5738@Xye> <110402170529.ZM5325@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lrZ03NoBR/3+SXJZ" Content-Disposition: inline In-Reply-To: <110402170529.ZM5325@torch.brasslantern.com> X-Operating-System: Arch linux x86_64 2.6.38.2-bldit-db-FAE X-Editor: VIM - Vi IMproved 7.3 User-Agent: Mutt/1.5.21 (2010-09-15) --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline * On Sat, Apr 02, 2011 at 05:05:29PM -0700, Bart Schaefer 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 --lrZ03NoBR/3+SXJZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBAgAGBQJNmEdOAAoJEKYW3KHXK+l3yuYH/jhXQs2TMCA5Y1RNeTiqIzkQ ggnWeGCRhXm4NhcuKnD9H4cNpVWvXMV4B3cjEgNkUO0V8pwBWlwAMfcMMmG1Wlkl QpdGwl68z7YTbFKECCkDpyfKiaqHxVloK64PSDJuqdoaCmLgQqapHK0zHnZ/ffs2 fuQbr/XppAMSv84ytfuW7DqmphWTHcJ7U3nmcfK0AbyFDPt4tkLnF1g3GOv+xO97 wr0I68IKVkXFVA6FAn+8d3gUO59hqoIio8VN/I84m/H3rFMa52zOZ7m4FXDcXBUq o30PVTgkOMsEMVBl+TmeU2710/94U/+sBj5yb5qk45yBIkS18IdxI/7PQNuXCjQ= =pj+7 -----END PGP SIGNATURE----- --lrZ03NoBR/3+SXJZ--