Skip to content

[patch-glibc] fix permission errors for shrink-rpath #1672

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

Merged
merged 1 commit into from
Dec 7, 2023

Conversation

savil
Copy link
Collaborator

@savil savil commented Dec 6, 2023

Summary

Motivation: we were trying to call patchelf shrink-rpath on binaries being patched
for glibc, but would hit permission errors.

More Details:

for:

cat devbox.json
{
  "packages": {
    "hello":{ "version": "latest", "patch_glibc": true}
  },
}

in a ubuntu container:

when I run devbox shell, I see:

Error: Command: /home/devbox/.nix-profile/bin/nix print-dev-env /code/.devbox/gen/flake --extra-experimental-features ca-derivations --option experimental-features nix-command flakes fetch-closure --json: exit status 100

2023/12/06 21:19:05 Command stderr: copying path '/nix/store/zlzz2z48s7ry0hkl55xiqp5a73b4mzrg-gcc-wrapper-12.3.0' from 'https://cache.nixos.org'...
warning: Ignoring setting 'auto-allocate-uids' because experimental feature 'auto-allocate-uids' is not enabled
warning: Ignoring setting 'impure-env' because experimental feature 'configurable-impure-env' is not enabled
building '/nix/store/j4ymkws1mpx01mh9lysrzb8kdwq48yxa-devbox-patched-glibc.drv'...
copying path '/nix/store/bbxdw4rgwwl3gnajri82yidr1nlsfskf-stdenv-linux' from 'https://cache.nixos.org'...
error: builder for '/nix/store/j4ymkws1mpx01mh9lysrzb8kdwq48yxa-devbox-patched-glibc.drv' failed with exit code 123;
       last 4 log lines:
       > patching elf binaries count=1
       > running patchelf file="/nix/store/a4xdm6q25y0pd11jpljkgv9z78vpmwia-devbox-patched-glibc/bin/hello" rpath="/nix/store/gqghjch4p1s69sv4mcjksb2kb65rwqjy-glibc-2.38-23/lib:/nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib" perm="555"
       > shrinking binary rpaths
       > patchelf: open: Permission denied
       For full logs, run 'nix log /nix/store/j4ymkws1mpx01mh9lysrzb8kdwq48yxa-devbox-patched-glibc.drv'.
error: 1 dependencies of derivation '/nix/store/9hqky67zgpnz8iilf8vcg4n01aaiw7sz-nix-shell-env.drv' failed to build

How was it tested?

in a linux container, did devbox shell:

BEFORE: https://gist.github.com/savil/bc7ec6b923202c535e90002dc55fd0dc
AFTER: https://gist.github.com/savil/674091eafb3af058eecf3411a1854e65

Note that there are more NEEDED libraries, which are all the glibc libraries.
This demonstrates that the patch did work.

Copy link
Collaborator Author

savil commented Dec 6, 2023

@savil savil force-pushed the savil/fix-shrink-rpath branch from 1c7ccc5 to fa02155 Compare December 6, 2023 22:07
@savil savil requested a review from mikeland73 December 6, 2023 22:09
Copy link
Contributor

@mikeland73 mikeland73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what this does at all, but I trust you and your testing.

Base automatically changed from savil/build-all to main December 7, 2023 17:04
@savil savil force-pushed the savil/fix-shrink-rpath branch from fa02155 to f47029c Compare December 7, 2023 17:05
@savil savil merged commit 1444a58 into main Dec 7, 2023
@savil savil deleted the savil/fix-shrink-rpath branch December 7, 2023 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants