-- Edsger Dijkstra (ish)
And it really says something about how important it is to license one’s software under GPLv3 or similar!
So I understand, but patching bash to fix the --posix mode should still be done.
(The OS shell of choice being zsh.)
The only way is to set their strange /etc/private symlink (cf sh(1)) to change what /bin/sh execs, and to do it again after each update which resets it.
"Applications should note that the standard PATH to the shell cannot be assumed to be either /bin/sh or /usr/bin/sh, and should be determined by interrogation of the PATH returned by getconf PATH, ensuring that the returned pathname is an absolute pathname and not a shell built-in."
"Furthermore, on systems that support executable scripts (the "#!" construct), it is recommended that applications using executable scripts install them using getconf PATH to determine the shell pathname and update the "#!" script appropriately as it is being installed (for example, with sed)."
Ref: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/s...
So, apparently on systems, where sh resides in /bin, "getconf CONF" will return /bin . However, this is not always the case. For example, on my Fedora Linux it is /usr/bin
$ getconf PATH
/usr/bin
$ ls -l /usr/bin/sh
lrwxrwxrwx. 1 root root 4 Jan 2 2023 /usr/bin/sh -> bash
$ ls -l /bin/sh
lrwxrwxrwx. 1 root root 4 Jan 2 2023 /bin/sh -> bash
$ ls -ld /bin
lrwxrwxrwx. 1 root root 7 Aug 9 2022 /bin -> usr/binIf only we could write #!sh to do a PATH lookup...
Thanks for finding the exact POSIX section describing its own failings!
On Gentoo (with the recent merged-usr profile), getconf PATH returns "/bin:/usr/bin", heh.
As for why they haven't done it yet, I'd guess it's just to preserve backward compatibility with old scripts that rely on quirks of bash's sh compatibility mode.
It’s irrelevant. Neither POSIX nor the UNIX certification (or being a descendant of the UNIXes of old like the BSDs) requires a recent GNU userland (which is, as the name implies, not UNIX).
> > Until you have to gets your hands dirty and find small and bigger faults everywhere. For example, /bin/sh [...] doesn't work properly in these two parameter expansion cases:
> It’s irrelevant. Neither POSIX nor the UNIX certification [...] requires a recent GNU userland
Is it irrelevant?
If an implementation passes the conformance test suite, but is buggy according to the text of the spec in a way that is not caught by the test suite, can one really say it's "fully compliant with the POSIX standard"?
Is it the test suite that's the final arbiter of the POSIX standard, or is the text of the spec? Because I thought that the point of having a written spec, ratified by a standards body, is that the text of the spec defines what the spec is. It is the text of the spec that is submitted to the standards body, after all, not the test suite.
Until you have to gets your hands dirty and find small and bigger faults everywhere. For example, /bin/sh defaults to their ancient (last GPL2 release) bash that doesn't work properly in these two parameter expansion cases:
Second one bit me quite badly when doing heredocs to generate JSON.