From: <zeurkous@volny.cz>
To: <zsh-workers@zsh.org>
Cc: Daniel Shahaf <d.s@daniel.shahaf.name>
Subject: revised patch: zshmisc(1) clarify non-successful exit statuses
Date: Fri, 23 Apr 2021 14:18:44 +0200 [thread overview]
Message-ID: <20210423141844.D01FC4C9@volny.cz> (raw)
In-Reply-To: <20210414134033.1AB3540B@volny.cz>
#?patch
#
# This revised patch adds, to the zshmisc(1) manual page, clarity about
# the exit status on exec failure.
#
# Due to a comment on the original patches, made on the zsh-workers
# mailing list: me didn't include a patch to zshmisc.1 this time.
#
# As me still doesn't use yodl: the immediately above does mean that
# me hasn't seen how it actually looks after typesetting.
#
# The copied use of startsitem() was suggested on the same mailing list.
# Me hopes me did it right.
#
# Note that the "operating system-dependent" part is made more
# complicated by zsh' habit of de-capitalizing the initial character of
# the string returned by strerror(3).
#
# Hope this is more useful (it is to me),
#
# --zeurkous, Fri Apr 23 12:09:47 UTC 2021.
#
--- Doc/Zsh/..v/5.8/exec.yo Mon Dec 4 14:09:35 2017
+++ Doc/Zsh/exec.yo Fri Apr 23 12:02:30 2021
@@ -14,10 +14,22 @@
vindex(path, use of)
Otherwise, the shell searches each element of tt($path) for a
-directory containing an executable file by that name. If the
-search is unsuccessful, the shell prints an error message and returns
-a nonzero exit status.
+directory containing an executable file by that name.
+If execution fails: an error message is printed, and one of the
+following values is returned.
+
+startsitem()
+sitem(127)
+The search was unsuccessful. The error message is
+`tt(command not found:) var(cmd)'.
+sitem(126)
+The executable file has insufficient permissions, or is a directory or
+other type of special file, or is not a script (see below) and in a
+format unrecognized by the operating system. The exact conditions and
+error message are operating system-dependent; see manref(execve)(2).
+endsitem()
+
If execution fails because the file is not in executable format,
and the file is not a directory, it is assumed to be a shell
script. tt(/bin/sh) is spawned to execute it. If the program
@@ -29,10 +41,6 @@
If no external command is found but a function tt(command_not_found_handler)
exists the shell executes this function with all
command line arguments. The return status of the function becomes the
-status of the command. If the function wishes to mimic the
-behaviour of the shell when the command is not found, it should
-print the message `tt(command not found:) var(cmd)' to standard error
-and return status 127. Note that the handler is executed in a
+status of the command. Note that the handler is executed in a
subshell forked to execute an external command, hence changes to
directories, shell parameters, etc. have no effect on the main shell.
-
next prev parent reply other threads:[~2021-04-23 12:19 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-11 12:15 zeurkous
2021-04-13 15:52 ` Daniel Shahaf
2021-04-13 18:03 ` zeurkous
2021-04-14 11:03 ` Daniel Shahaf
2021-04-14 11:40 ` zeurkous
2021-04-23 12:18 ` zeurkous [this message]
2021-04-23 16:07 ` revised " Daniel Shahaf
2021-04-23 16:15 ` Daniel Shahaf
2021-04-23 20:25 ` zeurkous
2021-04-23 20:14 ` Lawrence Velázquez
2021-04-23 20:29 ` zeurkous
2021-04-23 20:39 ` Lawrence Velázquez
2021-04-23 20:57 ` zeurkous
2021-04-23 20:51 ` Bart Schaefer
2021-04-23 21:03 ` zeurkous
2021-04-23 21:12 ` Bart Schaefer
2021-04-23 21:18 ` zeurkous
2021-04-23 22:31 ` Bart Schaefer
2021-04-26 16:25 ` zeurkous
2021-04-29 14:20 ` Daniel Shahaf
2021-05-09 19:04 ` Lawrence Velázquez
2021-05-31 1:09 ` Lawrence Velázquez
2021-05-31 4:09 ` Bart Schaefer
2021-05-31 4:37 ` Lawrence Velázquez
2021-06-30 17:51 ` zeurkous
2021-06-30 22:12 ` Lawrence Velázquez
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=20210423141844.D01FC4C9@volny.cz \
--to=zeurkous@volny.cz \
--cc=d.s@daniel.shahaf.name \
--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).