New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qtbase: force to use bash in glibc system() and popen() calls #37082
Conversation
At least qmake relies on popen using shell not as simple as our /bin/sh, so use bash for it.
cc @shlevy |
👎 from me. I don't think we should have an entirely new glibc just for this case. I'd be in favor of an effort to make glibc by default use sh from PATH or even hard-code bash (this presents some bootstrapping problems, but not insurmountable), I'd even implement that myself if we had the goahead, but as long as glibc is as it is we should simply patch misbehaving tools not to use And, FWIW, while the impurity here is in glibc this is also a qmake bug, as usages of |
And, FWIW, while the impurity here is in glibc this is also a qmake bug, as usages of `system` should not expect anything more than POSIX shell. So patches here would be reasonable to submit upstream.
For the record: the current version of the Single Unix Specification requires `command -v` to be available, see http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html — so relying on it is in line with «/bin/sh is just POSIX»
|
Ah, OK, this is just another manifestation of the overly weak /bin/sh issue then. Still, IMO any nix tool depending on /bin/sh, especially during builds, is a bug, though admittedly one harder to get patched upstream. |
It is not relying on |
glibc_2_27 = callPackage ../development/libraries/glibc/2.27.nix { | ||
installLocales = config.glibc.locales or false; | ||
}; | ||
glibc = if hostPlatform.isRiscV then glibc_2_27 else glibc_2_26; | ||
glibc_bash = glibc_2_26_bash; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shlevy why not making this the default glibc then?
@Mic92 As for "why not make it the default glibc", I don't know. I tried proposing it years ago and it was rejected. Note that it's not completely trivial, as there is a bootstrapping issue to fix, but certainly fixable. See e.g. #4998 (though the conversation spread across multiple threads) |
@shlevy then |
@Mic92 I never said it was. As I said, I'd be in favor of such an effort and even reimplement it myself if it were acceptable. Given that it's not, patching qmake (or wrapping it with some LD_PRELOAD or whatever) is the right way to go. |
Motivation for this change
Due to inherent impurity in qmake (actually, glibc), it depends on
/bin/sh
to provide certain non-POSIX commands (qmake usescommand -v <tool>
to find tools likemoc
, you can find details at #36903). I've decided that it should be better to remove this impurity by forcing qmake to use version of glibc that has all references to/bin/sh
replaced with essentially${pkgs.bash}/bin/sh
.I've build most of Qt stuff with this change with no problems.
This change should also help with some Qt package failures at #36453 (18.03 ZHF).
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)