zsh-workers
 help / color / mirror / code / Atom feed
From: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>
To: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>,
	<zsh-workers@sunsite.auc.dk>
Subject: RE: PATCH: POSIX exit codes (not quite Re: status codes on Dec OSF)
Date: Wed, 27 Jun 2001 11:15:22 +0400	[thread overview]
Message-ID: <000c01c0fed8$edde6520$21c9ca95@mow.siemens.ru> (raw)
In-Reply-To: <000501c0fd3b$ad5a7be0$21c9ca95@mow.siemens.ru>

>
> > 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


  reply	other threads:[~2001-06-27  7:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1000304181244.ZM24879@candle.brasslantern.com>
2001-06-21 21:46 ` status codes on Dec OSF Brian Harvell
2001-06-22  6:01   ` Andrej Borsenkow
2001-06-23  3:49     ` PATCH: POSIX exit codes (not quite Re: status codes on Dec OSF) Bart Schaefer
2001-06-23 18:22       ` Bart Schaefer
2001-06-25  5:57         ` Andrej Borsenkow
2001-06-27  7:15           ` Andrej Borsenkow [this message]
2001-06-27  7:46             ` Bart Schaefer
2001-06-27 13:02               ` Brian Harvell
2001-06-22  7:03   ` status codes on Dec OSF Sven Wischnowsky

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='000c01c0fed8$edde6520$21c9ca95@mow.siemens.ru' \
    --to=andrej.borsenkow@mow.siemens.ru \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).