On 8/28/20 6:52 AM, Zack Weinberg wrote:
I think that for 2.70 we should make fd 0 read-only and 1,2
write-only here, and revisit this afterward -- when we're not in a
release freeze we can think about things like turning on set -e mode.
Sounds good.
In the longer term I doubt whether set -e is the way to go. I recall some old
shells mishandling it (e.g., with 'set -e' the command 'A || B' would cause the
shell to exit when A failed). And I suspect the use of 'set -e' to detect shell
errors is problematic even today. 'set -e' is intended more as a debugging aid
than as a programming facility.
One other issue: with some shells 'printf x >/dev/full' succeeds because they
buffer output, so you cannot rely on printf exit status telling you that the
output actually worked. One can work around this problem by using a utility like
'cat' that doesn't play the game, but of course this has its own issues....