[email protected] wrote, on 27 Jun 2021: > > Don Cragun via austin-group-l at The Open Group dixit: > > > • When an unrecoverable error condition is > > encountered, the utility shall exit with a > > non-zero exit status. > > Is “pwd >/dev/full” an “unrecoverable error condition” as regards > the pwd utility? > > I think not.
It most certainly is an unrecoverable error condition. As can be seen from strace: $ strace mksh -c 'pwd > /dev/full' 2>&1 | grep ^write write(1, "/tmp\n", 5) = -1 ENOSPC (No space left on device) The (builtin) pwd utility got an error when it tried to write() to standard output. I suppose you could argue that ENOSPC can be considered recoverable since some space could be freed, but in that case pwd would need to try to recover from it (i.e. try again later), not just exit. > It validated the current working directory and attempted > to hand the information over; what the user does with it is the user’s > fault. It attempted BUT FAILED to hand the information over. "What the user does with it" is irrelevant because there was no "it" for the user to do something with. -- Geoff Clare <[email protected]> The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England
