zsh-workers
 help / color / mirror / Atom feed
* twice revised patch: zshmisc(1) clarify non-successful exit statuses
@ 2021-07-08 20:53 zeurkous
  2021-07-18 22:27 ` Lawrence Velázquez
  0 siblings, 1 reply; 3+ messages in thread
From: zeurkous @ 2021-07-08 20:53 UTC (permalink / raw)
  To: zsh-workers; +Cc: d.s, larryv, schaefer

#?patch
#
# This twice revised patch adds, to the zshmisc(1) manual page, clarity
# about the exit status on exec failure.
#
# As me said before: me doesn't use yodl. However, in this revision:
# me believes that me has fixed the use of sitem(). (Don't shoot me if
# me got it wrong again.)
#
# One person branded me earlier wording of a sentence ``ungrammatical'';
# while me doesn't necessarily agree, me sees no harm in the proposed
# change and this has hence been incorporated.
#
# Hope this is even more useful (it is to me),
#
#         --zeurkous, Thu Jul  8 20:43:33 UTC 2021.
#
--- Doc/Zsh/..v/5.8/exec.yo	Mon Dec  4 14:09:35 2017
+++ Doc/Zsh/exec.yo	Thu Jul  8 20:13:50 2021
@@ -14,10 +14,21 @@
 
 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, is a
+directory or special file, or is not a script and is 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 +40,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.
-


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: twice revised patch: zshmisc(1) clarify non-successful exit statuses
  2021-07-08 20:53 twice revised patch: zshmisc(1) clarify non-successful exit statuses zeurkous
@ 2021-07-18 22:27 ` Lawrence Velázquez
  2021-07-28 17:48   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Lawrence Velázquez @ 2021-07-18 22:27 UTC (permalink / raw)
  To: zsh-workers; +Cc: zeurkous

On Thu, Jul 8, 2021, at 4:53 PM, zeurkous@volny.cz wrote:
> # One person branded me earlier wording of a sentence ``ungrammatical'';
> # while me doesn't necessarily agree, me sees no harm in the proposed
> # change and this has hence been incorporated.

Thanks, I appreciate it.

> --- Doc/Zsh/..v/5.8/exec.yo	Mon Dec  4 14:09:35 2017
> +++ Doc/Zsh/exec.yo	Thu Jul  8 20:13:50 2021
> @@ -14,10 +14,21 @@
>  
>  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, is a
> +directory or special file, or is not a script and is 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 +40,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.
> -

Anyone have further feedback and/or is up for committing this?

-- 
vq


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: twice revised patch: zshmisc(1) clarify non-successful exit statuses
  2021-07-18 22:27 ` Lawrence Velázquez
@ 2021-07-28 17:48   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2021-07-28 17:48 UTC (permalink / raw)
  To: Lawrence Velázquez; +Cc: Zsh hackers list, zeurkous

On Sun, Jul 18, 2021 at 3:28 PM Lawrence Velázquez <larryv@zsh.org> wrote:
>
> On Thu, Jul 8, 2021, at 4:53 PM, zeurkous@volny.cz wrote:
> > +sitem(127)(The search was unsuccessful.  The error message is
> > +`tt(command not found:) var(cmd)'.)
> > +sitem(126)(The executable file has insufficient permissions, [...]
>
> Anyone have further feedback and/or is up for committing this?

Assuming everyone agrees that the error numbers are correct, I've put
this on my list of things to commit, if no one else does so first (it
may yet be a little while before I actually reach the point of
committing the several things I'm following).


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-28 17:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08 20:53 twice revised patch: zshmisc(1) clarify non-successful exit statuses zeurkous
2021-07-18 22:27 ` Lawrence Velázquez
2021-07-28 17:48   ` Bart Schaefer

zsh-workers

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.vuxu.org/zsh-workers

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-workers zsh-workers/ https://inbox.vuxu.org/zsh-workers \
		zsh-workers@zsh.org
	public-inbox-index zsh-workers

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


code repositories for the project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git