POSIXLY_CORRECT and install scripts
I usually run with POSIXLY_CORRECT set to 1. This causes the occasional
program and install script to fail due to unexpectedly getting standards
compliant behaviour instead of whatever the GNU programs usually do. Mostly
it's pretty minor failures easily fixed.
However there seems to be a major problem with su(1). As far as I can tell the
"su -" syntax depends completely on the non-posix argument permutation that
GNU getopts does. If you have POSIXLY_CORRECT set it always fails to parse the
This wreaks havoc with maintainer scripts. A lot of packages use su to do
parts of their install and a lot of them use the "su -" syntax.
It would be a good idea to have developers set POSIXLY_CORRECT at least once
during testing their packages to ensure they aren't depending on some
non-posix GNU behaviour in their packages. Ideally at least some developers
should use it all the time to avoid such bugs at run-time.
While on the topic another comment:
The code in "su" doesn't match the man page at all. The man page says:
"Any arguments supplied after the username will be passed to the invoked shell
(shell must support the -c command line option in order for a command to be
passed to it).".
Instead the code handles a few options explicitly including -c and disallows
anything else. I don't see any reason to hard code the meaning of -c like this
or to disallow other options, all it does is make it impossible to take
advantage of unusual shells via su. It seems the traditional logic of passing
remaining arguments through would be uniformly better than this hard coded