-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
autoPatchelfHook: optimize performance; better error handling #101142
Conversation
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/mach-nix-create-python-environments-quick-and-easy/6858/79 |
Co-authored-by: symphorien <[email protected]> Co-authored-by: Sandro <[email protected]>
I'm not proficient enough in bash to review. All I can say is that if you feel brave enough, you can run shellcheck on the file :) |
Thanks for the hint. I went through shellcheck now and got rid of the red ones and most of the orange ones. A few of them are definitely not satisfiable. But I think it is fine now. I tested autoPatchelfHook again and it worked. BTW, wouldn't it be best to include shellcheck as a github check, since multiple people are referring to it? Also I'm playing with the thought of re-implementing autoPatchelfHook some day in python and make use of multiprocessing (or async), since it is still quite slow after all. |
@Ericson2314 @SuperSandro2000 |
This rebuilds quite a lot. Can you please target staging? |
Targeted staging |
I would be definitely for it. Less work for me and the CI complains about a lot of stuff. You could create an issue or if it is not to much work create a PR, too. It is important that only changed files are complained about.
I would prefer it if it would be kept bash only to reduce rebuilds and cyclic dependencies. Maybe you can utilize parallels or some bash multi thread tricks like storing pids and waiting until they are done. I can dig you up an examplke if you like. |
or better you suggest it here #104594 to be added to the list. |
Thanks for your comment. I added a proposal for shellcheck in the issue mentioned. The time might come where I'd like to optimize this further. But for now the most important issues are fixed I think. Not sure if this helps, but this version of auto-patchelf.sh is used in mach-nix for some time now and I didn't receive any issues so far concerning .so dependencies. |
I am not sure and thats why I don't feel comfortable merging this. |
Github assigned 4 reviewers. One approved, one unresponsive and 2 not sure. No further comments given on what needs to be improved. |
@DavHau like @symphorien I am not very competent with bash, so I can't review this. Otherwise, I do like the change! Anyway, I will merge it. If it causes trouble it can always be reverted.
Some other scripts were converted from bash, but got some resistance and the feedback that they should be implemented in rust instead. I disagree with that it absolutely needs to be rust. You will get mixed responses. Note you will always have a small part of bash considering the stdenv is in bash. |
This seems to break when i.e. Native is |
@eadwu, I'm not sure if I understand correctly. A binary which has been processes by autoPatchelfHook is afterwards broken, so that it cannot be read by ldd of another platform? Or is autoPatchelfHook failing during build? |
If I remember correctly, it crashes in this step https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/auto-patchelf.sh#L133 |
I can reproduce this crash with androidenv. Running with set -x, it seems like I get a failure when patching
|
mksdcard (from an already patched version) is: |
So question is why this fails:
|
I found the problem. local missing="$(...)" seems to behave differently than local missing
missing="$()" |
@DavHau Yeah, Shellcheck will actually warn about that. Declaring a local and using $() in the same line will hide the return value. |
## Changelog for nixpkgs: Commits: [NixOS/nixpkgs@57a787c9...be0b453d](NixOS/nixpkgs@57a787c...be0b453) * [`975db4fb`](NixOS/nixpkgs@975db4f) libreswan: Unbreak the package * [`eff84793`](NixOS/nixpkgs@eff8479) libreswan: remove darwin from list of supported platforms * [`76ea74b9`](NixOS/nixpkgs@76ea74b) volctl: 0.6.3 -> 0.8.0 * [`e78a2d39`](NixOS/nixpkgs@e78a2d3) vtk: qt514 -> qt515 * [`27679361`](NixOS/nixpkgs@2767936) thunderbird: Add gpg/gpgme dependencies. Fixes NixOS/nixpkgs#98765. * [`f86651e6`](NixOS/nixpkgs@f86651e) texlive.combine: set allowSubstitutes = true * [`be8a89e7`](NixOS/nixpkgs@be8a89e) directx-shader-compiler: Add Darwin support * [`6ac71f59`](NixOS/nixpkgs@6ac71f5) linux: backport support for RTL8761b to 5.4 * [`81f4bca1`](NixOS/nixpkgs@81f4bca) rtl8761b-firmware: init at rtk1395 * [`9b3fe2ee`](NixOS/nixpkgs@9b3fe2e) kakoune: fix installCheck * [`e72bd9f0`](NixOS/nixpkgs@e72bd9f) thunderbird-bin: Add gpg/gpgme dependencies. Fixes NixOS/nixpkgs#98765 * [`44372487`](NixOS/nixpkgs@4437248) thunderbird, thunderbird.bin: Refactor: Reorder import lists. * [`07c40561`](NixOS/nixpkgs@07c4056) gnats: format hardened flag isn't supported * [`8123355e`](NixOS/nixpkgs@8123355) ncmpcpp: 0.8.2 -> 0.9.1 * [`39ebc637`](NixOS/nixpkgs@39ebc63) nixos/tests/prometheus: increase `memorySize` * [`81f1b21a`](NixOS/nixpkgs@81f1b21) perldevel: 5.33.4 -> 5.33.5 * [`5a26fb3c`](NixOS/nixpkgs@5a26fb3) prometheus: 2.22.2 -> 2.23.0 * [`7262fb68`](NixOS/nixpkgs@7262fb6) imapfilter: 2.6.16 -> 2.7.5 * [`b33b0865`](NixOS/nixpkgs@b33b086) prometheus: gross hack to fix linker flags for versioning info * [`fd4a486d`](NixOS/nixpkgs@fd4a486) gama: 2.09 -> 2.12 * [`1ed65d38`](NixOS/nixpkgs@1ed65d3) qgis: 3.10.11 → 3.10.13, mark unbroken * [`c25347d8`](NixOS/nixpkgs@c25347d) qjackctl: add `jackSession` option * [`2a9b003c`](NixOS/nixpkgs@2a9b003) yj: 4.0.0 -> 5.0.0 * [`6481892b`](NixOS/nixpkgs@6481892) pythonPackages.backports_unittest-mock: Disable tests * [`55f2b802`](NixOS/nixpkgs@55f2b80) pythonPackages.pytest-black: Disable tests * [`bfec86da`](NixOS/nixpkgs@bfec86d) pythonPackages.pytest-mypy: Disable tests * [`77d92137`](NixOS/nixpkgs@77d9213) pythonPackages.setuptools-scm-git-archive: Disable tests * [`ed0c68df`](NixOS/nixpkgs@ed0c68d) python37Packages.zstd: 1.4.5.1 -> 1.4.8.1 * [`3c2bacaa`](NixOS/nixpkgs@3c2baca) python37Packages.pybullet: 3.0.7 -> 3.0.8 * [`f061d6ff`](NixOS/nixpkgs@f061d6f) coursier: 2.0.7 -> 2.0.8 * [`421b7874`](NixOS/nixpkgs@421b787) python3Packages.botocore: 1.19.42 -> 1.19.43 * [`be349362`](NixOS/nixpkgs@be34936) python3Packages.boto3: 1.16.42 -> 1.16.43 * [`9f371adb`](NixOS/nixpkgs@9f371ad) awscli: 1.18.202 -> 1.18.203 * [`1d364e51`](NixOS/nixpkgs@1d364e5) tests/shadow: Improve * [`cb665178`](NixOS/nixpkgs@cb66517) picocom: 3.1 -> 3.2a (NixOS/nixpkgs#107379) * [`f971e075`](NixOS/nixpkgs@f971e07) python37Packages.casbin: 0.13.0 -> 0.14.0 * [`2a9ac172`](NixOS/nixpkgs@2a9ac17) lib.systems: update processor architecture info * [`466759ff`](NixOS/nixpkgs@466759f) libnice: 0.1.16 -> 0.1.18 * [`fe23bdae`](NixOS/nixpkgs@fe23bda) alsaLib: 1.2.3 -> 1.2.4 * [`72f71e90`](NixOS/nixpkgs@72f71e9) alsa-firmware: 1.2.1 -> 1.2.4 * [`1734a9a5`](NixOS/nixpkgs@1734a9a) tilt: 0.17.13 -> 0.18.1 * [`e24bf906`](NixOS/nixpkgs@e24bf90) vscode: 1.51.1 -> 1.52.1 * [`1714db88`](NixOS/nixpkgs@1714db8) python37Packages.hmmlearn: unbreak tests * [`18906f45`](NixOS/nixpkgs@18906f4) anki-bin: init at 2.1.36 * [`0769fe27`](NixOS/nixpkgs@0769fe2) anki-bin: add darwin support * [`847b317a`](NixOS/nixpkgs@847b317) anki-bin: force x11 * [`97216046`](NixOS/nixpkgs@9721604) steamPackages.steam: add udev rules * [`156ce8d3`](NixOS/nixpkgs@156ce8d) brave: 1.18.70 -> 1.18.75 * [`cb1e980a`](NixOS/nixpkgs@cb1e980) craftos-pc: init at 2.4.5 * [`5ea85813`](NixOS/nixpkgs@5ea8581) qjackctl: 0.6.3 -> 0.9.0 * [`3b05df1d`](NixOS/nixpkgs@3b05df1) arduino: core 1.8.12 -> 1.8.13 * [`5b95e93e`](NixOS/nixpkgs@5b95e93) zig: 0.6.0 -> 0.7.1 * [`7a369982`](NixOS/nixpkgs@7a36998) pythonPackages.fontparts: 0.9.6 -> 0.9.7 * [`3daa2557`](NixOS/nixpkgs@3daa255) websocketpp: fix cross * [`c505e571`](NixOS/nixpkgs@c505e57) tree-sitter: patch out web-ui by default, to drop emscripten * [`a285c3e9`](NixOS/nixpkgs@a285c3e) Revert "alsa-firmware: 1.2.1 -> 1.2.4" * [`2c3ca455`](NixOS/nixpkgs@2c3ca45) mavproxy: 1.8.29 -> 1.8.30 * [`61892329`](NixOS/nixpkgs@6189232) python37Packages.auth0-python: 3.13.0 -> 3.14.0 * [`f63d8369`](NixOS/nixpkgs@f63d836) picard: 2.5.4 -> 2.5.5 * [`0b505071`](NixOS/nixpkgs@0b50507) libctemplate: 2.3 -> 2.4 (NixOS/nixpkgs#107423) * [`022d7207`](NixOS/nixpkgs@022d720) arduino: use gtk3 * [`caa725a6`](NixOS/nixpkgs@caa725a) nixos/nextcloud: fix missing quotes arround $* in occ wrapper and replace with $@ * [`12b1d81a`](NixOS/nixpkgs@12b1d81) orca: 3.38.1 -> 3.38.2 * [`e8824681`](NixOS/nixpkgs@e882468) arduino: teensyduino 1.51 -> 1.53 * [`2b131c97`](NixOS/nixpkgs@2b131c9) nixos/kresd: set .stopIfChanged = false * [`351f3c04`](NixOS/nixpkgs@351f3c0) chromiumDev: Fix the build (libxshmfence is now required) * [`bdedc49b`](NixOS/nixpkgs@bdedc49) fbcat: init at 0.5.1 * [`4ac5d226`](NixOS/nixpkgs@4ac5d22) autoPatchelfHook: fix bug introduced by NixOS/nixpkgs#101142 * [`2fde1e63`](NixOS/nixpkgs@2fde1e6) autoPatchelfHook: fix shellcheck errors * [`2efcf6dc`](NixOS/nixpkgs@2efcf6d) autoPatchelf: add comment why ignore failing ldd/sed * [`2cab4879`](NixOS/nixpkgs@2cab487) toybox: fix cross-compilation * [`c674a513`](NixOS/nixpkgs@c674a51) nixos/systemd: provide libidn2 for systemd-resolved
maybe add yourself as codeowner ? |
@symphorien: Thought about this already, but I still don't like the notion of "owner" in this regard (which to me would imply BDFL) and I only want to be notified. However, since the alternative would be to rely on everyone to do a |
I really hate the very concept of this file (the reason being that I think "owner" implies some form of BDFL rather than just being notified), but since there were recent[1] changes[2] in auto-patchelf.sh which I missed it's probably a good idea to add myself there solely for being notified, because ofborg can't seem to infer maintainer information here. To make indentation consistent with all the other entries in the codeowners file, I also re-indented the other entries in the "Nixpkgs Internals" block. [1]: NixOS#101142 [2]: NixOS#106830 Signed-off-by: aszlig <[email protected]>
Motivation for this change
autoPatchelfHook has the following problems:
Things done
patchelf $file
to make sure they are actually valid for patchelf.sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)