Skip to content

stdenv/patchelf hook: filter any RPATHs outside $NIX_STORE#247478

Draft
vcunat wants to merge 1 commit intoNixOS:stagingfrom
vcunat:p/patchelf-filter-rpaths
Draft

stdenv/patchelf hook: filter any RPATHs outside $NIX_STORE#247478
vcunat wants to merge 1 commit intoNixOS:stagingfrom
vcunat:p/patchelf-filter-rpaths

Conversation

@vcunat
Copy link
Copy Markdown
Member

@vcunat vcunat commented Aug 6, 2023

I can't imagine any use case for keeping such RPATHs by default, and at least our sandboxed builds on Linux would complain:
RPATH of binary /nix/store/FOO contains a forbidden reference to /build/

It's not rare that invidual nix expressions had to work around such unwanted references to build dirs, e.g. see commit 3af97fc or lots of "-DCMAKE_SKIP_BUILD_RPATH=ON" (and probably more I've missed)

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

I can't imagine any use case for keeping such RPATHs by default,
and at least our sandboxed builds on Linux would complain:
 RPATH of binary /nix/store/FOO contains a forbidden reference to /build/

It's not rare that invidual nix expressions had to work around such
unwanted references to build dirs, e.g. see commit 3af97fc or
lots of "-DCMAKE_SKIP_BUILD_RPATH=ON" (and probably more I've missed)
@vcunat vcunat added the 6.topic: stdenv Standard environment label Aug 6, 2023
@github-actions github-actions bot removed the 6.topic: stdenv Standard environment label Aug 6, 2023
@vcunat
Copy link
Copy Markdown
Member Author

vcunat commented Aug 6, 2023

So far I'm opening just to get initial feedback. I haven't done any testing yet, etc.

I can imagine conditioning this like "${IN_NIX_SHELL:-}" != "impure", for example.

@vcunat vcunat added the 6.topic: stdenv Standard environment label Aug 11, 2023
@Artturin Artturin self-requested a review August 28, 2023 16:05
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: stdenv Standard environment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants