~cdv/public-inbox

The Problem With GNU getopt; Or, On Standards

Haelwenn (lanodan) Monnier
Details
Message ID
<20191104154434.GB27255@cloudsdale.the-delta.net.eu.org>
DKIM signature
missing
Download raw message
> It doesn't matter if /bin/true is an empty file with the execute bit 
> set or a C program the entire text of which is 
> ``int main(void) { return 0; }``. They both return a true value that 
> my shell that I can rely on in a script.

One could also note that with GNU true(1) it is possible to get POSIX 
violations quite easily, one being that true shouldn't use stdout, but 
`true --help` and `true --version` will use it. And one could except it 
to return non-zero in case of an error when using them (such as an 
out-of-memory for printf).

I've also set `POSIXLY_CORRECT=1` in my ~/.profile and probably will for 
/etc/profile as well later, I hope nothing will end up breaking but I'm 
pretty sure it will happen as GNUisms are quite popular.