zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Martijn Dekker <martijn@inlv.org>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] return status 126 for execution failures other than 'not found'
Date: Fri, 8 May 2020 13:54:18 -0700	[thread overview]
Message-ID: <CAH+w=7Y_xSJ_fvrumDhz-b0VWV_wW3nV4f=5MX1gG6wx1WvVrg@mail.gmail.com> (raw)
In-Reply-To: <ca0be2a8-cbb7-2861-713f-2fd1d23e06c0@inlv.org>

On Fri, May 8, 2020 at 1:37 PM Martijn Dekker <martijn@inlv.org> wrote:
>
> Currently, the execute() function in Src/exec.c only returns status 126
> if the error code is EACCES (permission denied) or ENOEXEC (exec format
> error). In all other cases, 127 is returned.
>
> That logic is not right, because 127 is the specific case: it is only to
> be used if the command was not found. Any failure to execute after the
> command is found should yield status 126.

Aside from the "zsh is not POSIX unless invoked as sh" standpoint ...

> The attached patch changes that logic to return status 127 if there is
> no error number (which happens if a PATH search does not find a command)
> or if the error number is ENOENT (no such file or directory). In all
> other cases it now returns 126.

... shouldn't EPERM also be in that list?  A file that's not
executable or otherwise not reachable seems to fall into the "not
found" category.

  reply	other threads:[~2020-05-08 20:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 20:36 Martijn Dekker
2020-05-08 20:54 ` Bart Schaefer [this message]
2020-05-09 15:35 ` Daniel Shahaf

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='CAH+w=7Y_xSJ_fvrumDhz-b0VWV_wW3nV4f=5MX1gG6wx1WvVrg@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=martijn@inlv.org \
    --cc=zsh-workers@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).