box icon indicating copy to clipboard operation
box copied to clipboard

Requirements Checker outputs on stdout instead of stderr

Open arnegroskurth opened this issue 2 years ago • 0 comments

Bug report

Question Answer
Box version 3.16.0
PHP version 8.1.7
Platform with version Linux

This could also be considered a CR/FR but as it causes unexpected behaviour for software packaged with box, I rather think of it as a bug. The program arises when the program being packaged with box writes structured output (e.g. json) to stdout and its corresponding (debug-)logs to stderr. Activating debug-level logging via -vvv for the packaged program now breaks the json-output as the box-logs are also printed on stdout. As the output of the requirements checker is rather diagnostic then conversational (see: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html), I would expect to have that output on stderr.

For discussions around using stdout/stderr for logging:

  • https://unix.stackexchange.com/questions/331611/do-progress-reports-logging-information-belong-on-stderr-or-stdout
  • https://stackoverflow.com/questions/4919093/should-i-log-messages-to-stderr-or-stdout

IMO this should be resolved by just switching the stream here but in case this is considered a BC, it should at least become configurable somehow.

arnegroskurth avatar Jun 22 '22 08:06 arnegroskurth