Re: [v2 PATCH] eval: Reset handler when entering a subshell

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/03/2019 17:39, Jilles Tjoelker wrote:
On Sun, Mar 03, 2019 at 04:43:09PM +0000, Harald van Dijk wrote:
The effect of the command built-in is that "if the command_name is the same
as the name of one of the special built-in utilities, the special properties
in the enumerated list at the beginning of Special Built-In Utilities shall
not occur." This is ambiguous as to whether it is just about the special
properties associated with the . command, or whether it includes those
associated with the set command called indirectly, but it must be one or the
other. If it includes the set command, then the shell shall not exit, and
the correct output is a followed by b. If it does not include the set
command, then the shell shall exit, and the correct output is nothing. dash
outputs b, which is wrong in either case.

The way I interpret this is that any error while parsing or executing
the . or eval command(s) is a "special built-in utility error" which can
be "caught" using "command". Therefore, the correct output is an error
message about the invalid option (to stderr) followed by b. This is what
happens in FreeBSD sh (for quite a few years), ksh93 (20120801_2) and
mksh (56c).

That's how dash implements it too, but it plainly doesn't make sense based on POSIX's requirements. If the effect of "shall exit" does not occur, the result isn't "shall start exiting and then abort the exit", it's "shall not exit". In order to allow dash/FreeBSD sh's interpretation, POSIX would need to say something like "the special properties [...] shall be suppressed" rather than "[...] shall not occur".

Cheers,
Harald van Dijk



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux