#990266 posh: output error is not checked for pwd

Package:
posh
Source:
posh
Description:
Policy-compliant Ordinary SHell
Submitter:
Vincent Lefevre
Date:
2021-07-05 08:57:02 UTC
Severity:
normal
#990266#5
Date:
2021-06-24 09:54:40 UTC
From:
To:
Like with ksh, output error is not checked for pwd (and maybe some
other builtins, but echo is OK), e.g. after closing stdout.

$ exec >&-
$ for i in echo pwd; do echo "[$i]" >&2; $i; echo $? >&2; done
[echo]
1
[pwd]
0

Note also that for pwd, POSIX[*] says:

  If an error is detected, output shall not be written to standard
  output, a diagnostic message shall be written to standard error,
  and the exit status is not zero.

so that one would expect a diagnostic message (and I think that
one should also get one for the other builtins).

[*] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pwd.html

#990266#10
Date:
2021-07-05 08:54:35 UTC
From:
To:
Since a closed stdout is unspecified behavior in POSIX (though there
is no reason to handle it like another error here), here's a testcase
with a full FS:

$ pwd > /dev/full
$ echo $?
0