Live data from Hacker News

All means are fair except solving the problem

yosefk.com

21–30 of 60 posts

Re: All means are fair except solving the problem

#22
> Instead, they were quick to point out that it’s hard to know where these warnings could come from, and we cannot risk all those critical workflows failing when some case of misuse surfaces in a new context.

Ah yes, Schroedinger's workflow. So important any disruption is a disaster, and simultaneously so unimportant they couldn't possibly spend a single dime on the tools critical to the workflow.

Re: All means are fair except solving the problem

#24
post #17

Earlier quoted context omitted.

Another thing that gets screwed up a lot is: Comand line usage help/information should be printed to stderr if it was invoked because the user passed an invalid option to the command line (in other words, the usage text counts as diagnostic[1] info), but it should be printed to stdout if the user invoked the application with -h, --help or similar. Reasons: 1. If you mess up the command line to the program in a script…

Disagree. stdout is only reserved for actual processed command output. It may be empty, it may be invalid because the input was invalid (shit in, shit out), but it may never be things intended for a human to read. If one wants to use a pager (like I sometimes do, though most of the time I just scroll up), they'll just use `foo 2>&1 | less`.

GNU offers guidance[1] to output --help to stdout, but it's not against the law to do it your way.

1: https://www.gnu.org/prep/standards/html_node/_002d_002dhelp....

Re: All means are fair except solving the problem

#25
post #3

Aren't you supposed to return a 0 status code when "yea done!" and some other status code when it wasn't done?

Indeed you're supposed to, but that way if someone calls exit(0), it looks like the program worked fine, when in fact they committed some debug code and made the program no longer run to completion. "Yay, done" was put in for the scripts to flag this sort of thing, presumably based on experience.

Next thing you know, you'll have to skip a major version number in your product because a significant fraction of your user base string parse its name to determine what version it is.

Re: All means are fair except solving the problem

#26
post #20

Earlier quoted context omitted.

Why not have the program exit with exit code 0 on success, and non-0 on failure, like almost every program in a POSIX environment ever ?

see yosefk reply above

I'm sorry, but "they committed some debug code that made the program exit(0)" for me is pretty much equivalent to "they committed some debug code that made the program not work correctly".

Re: All means are fair except solving the problem

#27
post #17

Earlier quoted context omitted.

Disagree. stdout is only reserved for actual processed command output. It may be empty, it may be invalid because the input was invalid (shit in, shit out), but it may never be things intended for a human to read. If one wants to use a pager (like I sometimes do, though most of the time I just scroll up), they'll just use `foo 2>&1 | less`.

GNU offers guidance[1] to output --help to stdout, but it's not against the law to do it your way. 1: https://www.gnu.org/prep/standards/html_node/_002d_002dhelp....

I guess this is a point where I disagree with GNU. Then again, the reasons why I disagree are subtle enough that I don't care too much... I think this particular thing doesn't matter very much in practice, so go do your thing GNU...

Re: All means are fair except solving the problem

#28
post #15

Does no one know what exit codes and stderr vs. stdout is anymore? I work with old and new code bases used by many clients in complicated setups, but adding a warning to stderr while stdout was left untouched, and proper exit codes maintained, was hardly, if ever, a problem so far. Of course, there's always some unpleasant exception, but it's rare. And of course, I also understand that the author might have found the…

Yes, this was also exactly what I have thought while reading TFA.

Re: All means are fair except solving the problem

#29
post #17

Earlier quoted context omitted.

Another thing that gets screwed up a lot is: Comand line usage help/information should be printed to stderr if it was invoked because the user passed an invalid option to the command line (in other words, the usage text counts as diagnostic[1] info), but it should be printed to stdout if the user invoked the application with -h, --help or similar. Reasons: 1. If you mess up the command line to the program in a script…

Disagree. stdout is only reserved for actual processed command output. It may be empty, it may be invalid because the input was invalid (shit in, shit out), but it may never be things intended for a human to read. If one wants to use a pager (like I sometimes do, though most of the time I just scroll up), they'll just use `foo 2>&1 | less`.

I see you've never tried to run command --help | less

Re: All means are fair except solving the problem

#30
I have seen this kind of thing go so many ways.

- sometimes you can get the status code, sometimes you can't.

- sometimes you can separate out stdout from stderr, sometimes you can't

- sometimes the program generating the error message identifies itself, sometimes it doesn't

- sometimes you don't know if you have a "good error" (ok to ignore) or a "bad error" (cannot ignore)

I am a fan of the HARD FAIL.

I think internal unit tests or things like that should hard fail, then get a human to either fix it, or put in a hard exception.

if it is user-facing... sigh

Post reply on HN