-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
bazel_6: fix: make patched bash a native binary #268614
bazel_6: fix: make patched bash a native binary #268614
Conversation
https://hydra.nixos.org/build/240805256/nixlog/1 https://hydra.nixos.org/build/240805170/nixlog/2 Failure is a bit obscured but long story short, a script within bazel gets custom nixpkgs shebang which in turn makes shell run in POSIX-compatible mode. Bazel expects bash in non-POSIX mode and osx-specific script starts to fail due to `set -e` and subshell interaction differences in those modes (sub-shells and functions suddently start inheriting `set -e` and fail to produce desired output). More debug info is available in NixOS#267670 Shell scripts aren't guaranteed to work as interpreters in shebang. In particular thin shell wrappers aren't shebang-ready on MacOS. It may work sometimes depending on what exactly would try to execute a script with such shebang, but generally it's not guaranteed to work. See NixOS#124556 Bash wrapper was introduced in NixOS#266847 and so far seems like the issue only affects darwin builds: hydra failure is in osx-specific script, also shebang issue is usually darwin-specific. Let's wrap it as a native binary to make it shebang-compatible. The wrapper is only currently added to `bazel_6` so no need for changes in other versions. ZHF: NixOS#265948
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.
I feel like this could be done with writeCBin
, but let's unblock for now.
pkgs/development/tools/build-managers/bazel/bazel_6/default.nix
Outdated
Show resolved
Hide resolved
Co-authored-by: Uri Baghin <[email protected]>
Will wait for ofborg builds then merge. |
For other issues on recent main branch seems like recent switch to CLang 16 is to blame, have a draft #268620 but it needs more work, turns out we can't override |
Successfully created backport PR for |
Description of changes
https://hydra.nixos.org/build/240805256/nixlog/1
https://hydra.nixos.org/build/240805170/nixlog/2
Failure is a bit obscured but long story short, a script within bazel gets custom nixpkgs shebang which in turn makes shell run in POSIX-compatible mode. Bazel expects bash in non-POSIX mode and osx-specific script starts to fail due to
set -e
and subshell interaction differences in those modes (sub-shells and functions suddently start inheritingset -e
and fail to produce desired output). More debug info is available in #267670Shell scripts aren't guaranteed to work as interpreters in shebang. In particular thin shell wrappers aren't shebang-ready on MacOS. It may work sometimes depending on what exactly would try to execute a script with such shebang, but generally it's not guaranteed to work. See #124556
Bash wrapper was introduced in #266847 and so far seems like the issue only affects darwin builds: hydra failure is in osx-specific script, also shebang issue is usually darwin-specific.
Let's wrap it as a native binary to make it shebang-compatible.
The wrapper is only currently added to
bazel_6
so no need for changes in other versions.Note: there seems to be some other breakage on the most recent main branch, probably makes sense to address separately
ZHF: #265948
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)