Skip to main content
9 events
when toggle format what by license comment
Dec 21, 2016 at 21:36 comment added Charles Duffy If it were the default, then it would be the behavior in question if not explicitly otherwise specified, as opposed to the behavior in question only if a utility's specification uses the words "The standard error shall be used only for diagnostic messages" -- itself an explicit specification.
Dec 21, 2016 at 12:01 comment added muru @StephenKitt of course. We know of utilities which output to stderr without being in an abnormal state - dd has to output stats on completion, rm and find do when they have to prompt (this could be taken as progress information).
Dec 21, 2016 at 11:55 comment added Stephen Kitt Well, I'd say the "unless otherwise specified" is a rather significant caveat: a POSIX utility could very well specify that it outputs progress information on its standard error, and it would be standards-compliant. You're right, it is interesting that the "default behaviour" (which still requires a specific mention in the relevant section) is to only use standard error if the exit code also indicates an error; but it's not limiting.
Dec 21, 2016 at 11:48 comment added muru @StephenKitt which doesn't change my point. POSIX utilities either a) don't output to stderr, b) use it only for diagnostic messages if something goes wrong, c) use it only for diagnostic messages even if nothing goes wrong and d) use it for something else. I said that they only use it for diagnostic messages if something goes wrong (a, b), unless otherwise stated (c, d). Now, my claim is that this is the default, which it clearly is, since that's why it's template.
Dec 21, 2016 at 11:42 comment added Stephen Kitt It only supports the claim as the default behaviour for POSIX utilities, and even then only in specific cases (utilities which use the phrase mentioned). This part of POSIX isn't normative (AIUI), it's a template: it tells you how to read the utility specifications, it doesn't specify the utilities' behaviour. Specifically, it defines the meanings of the phrases "The standard error shall be used only for diagnostic messages." and "Not used." in the "STDERR" sections of utility specifications. Each utility specifies its behaviour, and it can use those phrases as shorthand.
Dec 21, 2016 at 11:32 comment added muru @StephenKitt neither do I. But he's debating with his CTO, who says that stderr output is an indication of something going wrong, and the standard does support his claim as the default behaviour.
Dec 21, 2016 at 11:26 comment added Stephen Kitt I understand this as describing the meaning of the "STDERR" section given in the specifications of each POSIX utility, not as a general definition for standard error usage. I don't think terdon is writing a standard POSIX utility here ;-).
Dec 21, 2016 at 6:59 history edited muru CC BY-SA 3.0
added 46 characters in body
Dec 21, 2016 at 6:51 history answered muru CC BY-SA 3.0