IEEE Standards Interpretation for IEEE Std 1003.1™-2001 IEEE Standard Standard for Information Technology -- Portable Operating System Interface (POSIX®)
Copyright © 2006 by the Institute of Electrical and Electronics Engineers, Inc. 3 Park Avenue New York, New York 10016-5997 USA All Rights Reserved.
Interpretations are issued to explain and clarify the intent of a standard and do not constitute an alteration to the original standard. In addition, interpretations are not intended to supply consulting information. Permission is hereby granted to download and print one copy of this document. Individuals seeking permission to reproduce and/or distribute this document in its entirety or portions of this document must contact the IEEE Standards Department for the appropriate license. Use of the information contained in this document is at your own risk.
IEEE Standards Department Copyrights and Permissions 445 Hoes Lane, Piscataway, New Jersey 08855-1331, USA
Interpretation Request #105
Topic: nohup with standard output closed Relevant Sections: XCU nohup
For "nohup COMMAND", the standard says that if standard error is a terminal, all output of COMMAND is redirected to "the same file descriptor as the standard output", which is file descriptor 1. The use of the term "file descriptor" is confusing here; evidently "open file description" was intended, as the intent must have been to allow implementations to use the equivalent of dup2 to cause file descriptor 2 to reference the same open file description as file descriptor 1.
This confusing terminology leads to the question: what should nohup do if standard error is a terminal and standard output is closed?
In this situation:
Solaris 10 nohup opens nohup.out and redirects standard error to nohup.out, leaving standard output closed.
GNU nohup (coreutils 5.2.1) fails with a diagnostic.
GNU nohup (coreutils CVS) closes standard error, leaving standard output closed.
Do these behaviors all conform to the standard?
The proposed action attempts to clarify this issue, cleaning up the terminology about file descriptors versus file descriptions, and requiring the Solaris 10 behavior. From the point of users it's better to nail down this issue rather than leave it implementation defined, and I'm willing to change the GNU behavior to match Solaris, so long as I know that the Solaris behavior conforms.
Change XCU page 674 lines 26139-26140 from:
If the standard error is a terminal, all output written by the named utility to its standard error shall be redirected to the same file descriptor as the standard output.
If standard error is a terminal and standard output is open but is not a terminal, all output written by the named utility to its standard error shall be redirected to the same open file description as the standard output. If standard error is a terminal and standard output either is a terminal or is closed, the same output shall instead be appended to the end of the nohup.out file as described above.
The standard does not speak to this issue, and as such no conformance distinction can be made between alternative implementations based on this. This is being referred to the sponsor.
Rationale for Interpretation