retitle 990265 mksh: output error is not checked for some builtins
reopen 990265
thanks

On 2021-06-24 13:49:55 +0000, Thorsten Glaser wrote:
> At the start of those commands, stdout is closed, so you violate that
> constraint. Note POSIX is not just demands on the implementation but
> also on the user, for example, it specifically permits extensions where
> the behaviour is otherwise unspecified, i.e. which could not happen in
> a conforming user.
[...]

Note that here, pwd is a builtin, so that there is no
"program start-up". So no constraints are violated.

Anyway, this was just an example. So, instead of a closed stdout,
let's write to a full file system:

$ pwd > /dev/full
$ echo $?
0
$ /bin/pwd > /dev/full
/bin/pwd: write error: No space left on device
$ echo $?
1

With the mksh builtin, the error is not detected.

Whatever POSIX says, it is important to report an error in such
a case, at least for the robustness of scripts.

Same problem with ksh93.

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to