Menu

#2 Incorrect error handling running the Debian 11 version in Debian 12

1.0
open
nobody
None
2024-01-07
2024-01-07
No

While I realize qmol_0.6-1_amd64.deb is for Debian 11 and you haven't published one for 12, it DOES work on Debian 12, and I thought you might find these observations useful.

Errors should cause a non-zero exit code and error messages should go to stderr, not stdout. As demonstrated below, both of these standards are being ignored:
$ qmol ch4 2>/dev/null
ERROR: Undefined symbol: ch

$ echo $?
0
$

If I want to wrap a cli command in a script, I expect error messages and output to be clearly separated and an exit code that tells me the command failed. With unconventional practices like the above I'm forced to grep the output for telltale expressions to see if there was an error. If a command fails, for whatever reason, nothing but a line-feed should go to stdout and the exit code should be non-zero.

Also, maybe what follows makes sense and I just don't understand it, but, at the very least, the message that it DOES send to stderr is extraordinarily unclear:

$ qmol --help >/dev/null
QIODevice::read (QFile, "/home/j/.local/share/qmol/usr/local/share/qmol/usr/share/qmol/groups"): device not open
$

Device? What device? That looks like a path to a regular file or directory to me. If "device" means file system rather than a block device, then both / and $HOME are obviously mounted rw. I don't know what else "open" could mean in that context.

Discussion


Log in to post a comment.