From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26437 invoked from network); 27 Jun 2001 07:15:42 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 27 Jun 2001 07:15:42 -0000 Received: (qmail 7321 invoked by alias); 27 Jun 2001 07:14:42 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15107 Received: (qmail 7300 invoked from network); 27 Jun 2001 07:14:42 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer david.siemens.de) From: "Andrej Borsenkow" To: "Andrej Borsenkow" , Subject: RE: PATCH: POSIX exit codes (not quite Re: status codes on Dec OSF) Date: Wed, 27 Jun 2001 11:15:22 +0400 Message-ID: <000c01c0fed8$edde6520$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <000501c0fd3b$ad5a7be0$21c9ca95@mow.siemens.ru> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2479.0006 Importance: Normal > > > There is another effect of this: If there are two files in the > path with > > the same name, bash will always attempt to execute the first > one and fail > > with 126/"no such file", but zsh will keep searching and either execute > > the second one or report 127/"command not found". > > > > I guess, zsh's behaviour is more appropriate: > > [PATH search] > The list is searched from beginning to end, applying the filename to each > prefix, until an executable file with the specified name and appropriate > execution permissions is found. > On the second thought, may be zsh is wrong here. It depends on the definition of "appropriate execution permissions". It may be understood as "if file can be executed" (what zsh does currently). But I suspect, that it actually meant "stat.st_mode & (S_IXUSR|S_IXGRP|S_IXOTHR)". I.e. file with any executable bit set. Current zsh behaviour may lead to unexpected (inappropriate) command execution. Consider: bor@itsrm2% ll /usr/sbin/pkgadd -rwx------ 1 root sys 397793 Nov 18 1998 /usr/sbin/pkgadd* bor@itsrm2% pkgadd zsh: permission denied: pkgadd bor@itsrm2% cat > ~/bin/pkgadd #! /bin/sh echo Pkgadd here! bor@itsrm2% chmod +x ~/bin/pkgadd bor@itsrm2% pkgadd Pkgadd here! bor@itsrm2% print $path /tools/override/bin /usr/bin /usr/sbin /opt/bin /usr/ccs/bin /usr/ucb /tools/bin /opt/nsr /usr/dt/bin /usr/bin/X11 /opt/xms/bin /opt/xms-menu/bin /opt/Xprint/cmd /opt/Xprint/mercator/cmd /opt/lib/tele/bin /u1/nerv/bin /home/bor/bin bor@itsrm2% ll =pkgadd -rwxr-xr-x 1 bor sinix 30 Jun 27 11:11 /home/bor/bin/pkgadd* Any real reasons to retain current zsh exaustive path search? -andrej