On 2021-06-28 21:28:37 +0700, Robert Elz wrote: > Date: Mon, 28 Jun 2021 15:48:33 +0200 > From: Vincent Lefevre <[email protected]> > Message-ID: <[email protected]> > > | So, if writing to a closed fd yields unspecified behaviour, what > | does "refers to no open file" mean? > > No, you misunderstood. It isn't writing to the closed fd, that's perfectly > defined (as you quoted) what generates unspecified behaviour is invoking > any of the standard utilities (non-standard ones are always unspecified of > course) with any of stdin stdout or stderr not properly opened (stdin for > reads, at least, stdout and stderr for writes).
Where is this written (at least for the particular case of builtins)? For the non-standard utilities, they are not specified by POSIX, but their behavior may be specified by something else, and I doubt that the shell is allowed to mess up their normal execution just because they are not specified by POSIX. > But no-one has ever really liked the results when applications start > reporting stdout/stderr write errors (in the latter case, the only way > would be to try opening /dev/tty or use something like syslog()). I don't think POSIX requires that error messages be really written with some other mean in case of error when writing these error messages. In any case, terminating with a nonzero exit status would allow the user (e.g. a script) to detect the issue. -- Vincent Lefèvre <[email protected]> - 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)
