Skip to content
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

libredirect: misc changes #50302

Merged
merged 3 commits into from Nov 13, 2018
Merged

libredirect: misc changes #50302

merged 3 commits into from Nov 13, 2018

Conversation

zimbatm
Copy link
Member

@zimbatm zimbatm commented Nov 13, 2018

Motivation for this change

Make libredirect a bit more easy to use

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

reduces a bit of duplication and can also be used from the outside:

   export LD_PRELOAD=${libredirect}/lib/${libredirect.libName}
@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: libredirect

Partial log (click to expand)

strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/f414hjmb0y45a65qsxh8r6yzlc2bk6gi-libredirect-0/lib
patching script interpreter paths in /nix/store/f414hjmb0y45a65qsxh8r6yzlc2bk6gi-libredirect-0
checking for references to /build in /nix/store/f414hjmb0y45a65qsxh8r6yzlc2bk6gi-libredirect-0...
shrinking RPATHs of ELF executables and libraries in /nix/store/48r5rfdqfi1lqjlpcq6vvzl4xg9826ys-libredirect-0-hook
strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/48r5rfdqfi1lqjlpcq6vvzl4xg9826ys-libredirect-0-hook
checking for references to /build in /nix/store/48r5rfdqfi1lqjlpcq6vvzl4xg9826ys-libredirect-0-hook...
running install tests
/nix/store/f414hjmb0y45a65qsxh8r6yzlc2bk6gi-libredirect-0

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: libredirect

Partial log (click to expand)

strip is /nix/store/p9akxn2sfy4wkhqdqa3li97pc6jaz3r1-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/mkbnxivfdmwnb7clsnlzzf5mi446c0rn-libredirect-0/lib
patching script interpreter paths in /nix/store/mkbnxivfdmwnb7clsnlzzf5mi446c0rn-libredirect-0
checking for references to /build in /nix/store/mkbnxivfdmwnb7clsnlzzf5mi446c0rn-libredirect-0...
shrinking RPATHs of ELF executables and libraries in /nix/store/c6nd3g9b8fwgcr8rby69rl0g3qy8w1n6-libredirect-0-hook
strip is /nix/store/p9akxn2sfy4wkhqdqa3li97pc6jaz3r1-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/c6nd3g9b8fwgcr8rby69rl0g3qy8w1n6-libredirect-0-hook
checking for references to /build in /nix/store/c6nd3g9b8fwgcr8rby69rl0g3qy8w1n6-libredirect-0-hook...
running install tests
/nix/store/mkbnxivfdmwnb7clsnlzzf5mi446c0rn-libredirect-0

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: libredirect

Partial log (click to expand)

install: creating directory '/nix/store/mm8xnmg80flbm0a77vz1c43kvja84pg8-libredirect-0/lib'
'libredirect.dylib' -> '/nix/store/mm8xnmg80flbm0a77vz1c43kvja84pg8-libredirect-0/lib/libredirect.dylib'
post-installation fixup
strip is /nix/store/g5r4apl0za012ffs6ladinwa5w0m1l3k-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/mm8xnmg80flbm0a77vz1c43kvja84pg8-libredirect-0/lib
patching script interpreter paths in /nix/store/mm8xnmg80flbm0a77vz1c43kvja84pg8-libredirect-0
strip is /nix/store/g5r4apl0za012ffs6ladinwa5w0m1l3k-cctools-binutils-darwin/bin/strip
patching script interpreter paths in /nix/store/jrwkwkl7gyk24y6kn5lqpi3fs9zhz6hj-libredirect-0-hook
running install tests
/nix/store/mm8xnmg80flbm0a77vz1c43kvja84pg8-libredirect-0

Copy link
Member

@aszlig aszlig left a comment

Choose a reason for hiding this comment

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

👍 Maybe it makes sense to also add a way to make it easy to add those environment variables to makeWrapper, as it's used in that way throughout nixpkgs.

pkgs/build-support/libredirect/test.c Outdated Show resolved Hide resolved
@@ -8,30 +8,40 @@ stdenv.mkDerivation {
cp ${./test.c} test.c
'';

shlibext = stdenv.targetPlatform.extensions.sharedLibrary;
libName = "libredirect" + stdenv.targetPlatform.extensions.sharedLibrary;
Copy link
Member

Choose a reason for hiding this comment

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

👍

@zimbatm
Copy link
Member Author

zimbatm commented Nov 13, 2018

@LnL7 addressed your comment as well

@zimbatm zimbatm requested a review from LnL7 November 13, 2018 14:59
@zimbatm
Copy link
Member Author

zimbatm commented Nov 13, 2018

@aszlig good idea about makeWrapper, although I am not exactly sure how to structure this. Something like:

{ libredirect, myprogram, iana-etc }:
libredirect.wrapWith {
  bin = "${myprogram}";
  redirects = {
    "/etc/protocols" = "${iana-etc}/etc/protocols";
  };
}

but then it's not very composable

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: libredirect

Partial log (click to expand)

strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/i4bdgqqqq4dbr1s8gyj0l6iac2vhikbf-libredirect-0/lib
patching script interpreter paths in /nix/store/i4bdgqqqq4dbr1s8gyj0l6iac2vhikbf-libredirect-0
checking for references to /build in /nix/store/i4bdgqqqq4dbr1s8gyj0l6iac2vhikbf-libredirect-0...
shrinking RPATHs of ELF executables and libraries in /nix/store/fi13dclgy1l294x96rda0rr2qggjs87x-libredirect-0-hook
strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/fi13dclgy1l294x96rda0rr2qggjs87x-libredirect-0-hook
checking for references to /build in /nix/store/fi13dclgy1l294x96rda0rr2qggjs87x-libredirect-0-hook...
running install tests
/nix/store/i4bdgqqqq4dbr1s8gyj0l6iac2vhikbf-libredirect-0

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: libredirect

Partial log (click to expand)

strip is /nix/store/p9akxn2sfy4wkhqdqa3li97pc6jaz3r1-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/b9xxxw6blssdmp1gcw2vsrwgpcxwg1z7-libredirect-0/lib
patching script interpreter paths in /nix/store/b9xxxw6blssdmp1gcw2vsrwgpcxwg1z7-libredirect-0
checking for references to /build in /nix/store/b9xxxw6blssdmp1gcw2vsrwgpcxwg1z7-libredirect-0...
shrinking RPATHs of ELF executables and libraries in /nix/store/g1wwxvahmapkajbip73333442kfcans4-libredirect-0-hook
strip is /nix/store/p9akxn2sfy4wkhqdqa3li97pc6jaz3r1-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/g1wwxvahmapkajbip73333442kfcans4-libredirect-0-hook
checking for references to /build in /nix/store/g1wwxvahmapkajbip73333442kfcans4-libredirect-0-hook...
running install tests
/nix/store/b9xxxw6blssdmp1gcw2vsrwgpcxwg1z7-libredirect-0

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: libredirect

Partial log (click to expand)

install: creating directory '/nix/store/y69lp7hjxc81ddsci16clg6vdhvm9szy-libredirect-0/lib'
'libredirect.dylib' -> '/nix/store/y69lp7hjxc81ddsci16clg6vdhvm9szy-libredirect-0/lib/libredirect.dylib'
post-installation fixup
strip is /nix/store/g5r4apl0za012ffs6ladinwa5w0m1l3k-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/y69lp7hjxc81ddsci16clg6vdhvm9szy-libredirect-0/lib
patching script interpreter paths in /nix/store/y69lp7hjxc81ddsci16clg6vdhvm9szy-libredirect-0
strip is /nix/store/g5r4apl0za012ffs6ladinwa5w0m1l3k-cctools-binutils-darwin/bin/strip
patching script interpreter paths in /nix/store/i1y39prhqbwv0sx9sfs88mxby24y99fj-libredirect-0-hook
running install tests
/nix/store/y69lp7hjxc81ddsci16clg6vdhvm9szy-libredirect-0

@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Attempted: libredirect

Partial log (click to expand)

  /nix/store/9nfkarmjsmhix968n49whcnqb9bj6lkc-libredirect-0.drv
building '/nix/store/9nfkarmjsmhix968n49whcnqb9bj6lkc-libredirect-0.drv'...
unpacking sources
patching sources
configuring
no configure script, doing nothing
building
clang-5.0: error: no such file or directory: '/nix/store/n170fix4dfxixmm4d0l2wy3w1ahsdw6x-libredirect-0/lib/libredirect.dylib'
builder for '/nix/store/9nfkarmjsmhix968n49whcnqb9bj6lkc-libredirect-0.drv' failed with exit code 1
error: build of '/nix/store/9nfkarmjsmhix968n49whcnqb9bj6lkc-libredirect-0.drv' failed

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: libredirect

Partial log (click to expand)

/nix/store/b9xxxw6blssdmp1gcw2vsrwgpcxwg1z7-libredirect-0

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: libredirect

Partial log (click to expand)

strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/i4bdgqqqq4dbr1s8gyj0l6iac2vhikbf-libredirect-0/lib
patching script interpreter paths in /nix/store/i4bdgqqqq4dbr1s8gyj0l6iac2vhikbf-libredirect-0
checking for references to /build in /nix/store/i4bdgqqqq4dbr1s8gyj0l6iac2vhikbf-libredirect-0...
shrinking RPATHs of ELF executables and libraries in /nix/store/fi13dclgy1l294x96rda0rr2qggjs87x-libredirect-0-hook
strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/fi13dclgy1l294x96rda0rr2qggjs87x-libredirect-0-hook
checking for references to /build in /nix/store/fi13dclgy1l294x96rda0rr2qggjs87x-libredirect-0-hook...
running install tests
/nix/store/i4bdgqqqq4dbr1s8gyj0l6iac2vhikbf-libredirect-0

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: libredirect

Partial log (click to expand)

/nix/store/b9xxxw6blssdmp1gcw2vsrwgpcxwg1z7-libredirect-0

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: libredirect

Partial log (click to expand)

install: creating directory '/nix/store/y69lp7hjxc81ddsci16clg6vdhvm9szy-libredirect-0/lib'
'libredirect.dylib' -> '/nix/store/y69lp7hjxc81ddsci16clg6vdhvm9szy-libredirect-0/lib/libredirect.dylib'
post-installation fixup
strip is /nix/store/g5r4apl0za012ffs6ladinwa5w0m1l3k-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/y69lp7hjxc81ddsci16clg6vdhvm9szy-libredirect-0/lib
patching script interpreter paths in /nix/store/y69lp7hjxc81ddsci16clg6vdhvm9szy-libredirect-0
strip is /nix/store/g5r4apl0za012ffs6ladinwa5w0m1l3k-cctools-binutils-darwin/bin/strip
patching script interpreter paths in /nix/store/i1y39prhqbwv0sx9sfs88mxby24y99fj-libredirect-0-hook
running install tests
/nix/store/y69lp7hjxc81ddsci16clg6vdhvm9szy-libredirect-0

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: libredirect

Partial log (click to expand)

strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/i4bdgqqqq4dbr1s8gyj0l6iac2vhikbf-libredirect-0/lib
patching script interpreter paths in /nix/store/i4bdgqqqq4dbr1s8gyj0l6iac2vhikbf-libredirect-0
checking for references to /build in /nix/store/i4bdgqqqq4dbr1s8gyj0l6iac2vhikbf-libredirect-0...
shrinking RPATHs of ELF executables and libraries in /nix/store/fi13dclgy1l294x96rda0rr2qggjs87x-libredirect-0-hook
strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/fi13dclgy1l294x96rda0rr2qggjs87x-libredirect-0-hook
checking for references to /build in /nix/store/fi13dclgy1l294x96rda0rr2qggjs87x-libredirect-0-hook...
running install tests
/nix/store/i4bdgqqqq4dbr1s8gyj0l6iac2vhikbf-libredirect-0

This allows to simplify the usage of libredirect inside of nix build
sandboxes. Add "libredirect.hook" to the build inputs to get everything
linked in automaticall. All that's left is to set NIX_REDIRECTS and call
the target program.
@zimbatm zimbatm merged commit 695a3d4 into NixOS:master Nov 13, 2018
@zimbatm zimbatm deleted the libredirect-misc branch November 13, 2018 23:17
@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: libredirect

Partial log (click to expand)

install: creating directory '/nix/store/6vn8w14x6a4la0y40iljrkms4vnwb4hc-libredirect-0/lib'
'libredirect.dylib' -> '/nix/store/6vn8w14x6a4la0y40iljrkms4vnwb4hc-libredirect-0/lib/libredirect.dylib'
post-installation fixup
strip is /nix/store/g5r4apl0za012ffs6ladinwa5w0m1l3k-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/6vn8w14x6a4la0y40iljrkms4vnwb4hc-libredirect-0/lib
patching script interpreter paths in /nix/store/6vn8w14x6a4la0y40iljrkms4vnwb4hc-libredirect-0
strip is /nix/store/g5r4apl0za012ffs6ladinwa5w0m1l3k-cctools-binutils-darwin/bin/strip
patching script interpreter paths in /nix/store/wci08yhxiw2kgxw4wypdb6mkabcx6yf4-libredirect-0-hook
running install tests
/nix/store/6vn8w14x6a4la0y40iljrkms4vnwb4hc-libredirect-0

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: libredirect

Partial log (click to expand)

strip is /nix/store/p9akxn2sfy4wkhqdqa3li97pc6jaz3r1-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/p9nkdadfwmw121jinmnlay30gr0i9nbp-libredirect-0/lib
patching script interpreter paths in /nix/store/p9nkdadfwmw121jinmnlay30gr0i9nbp-libredirect-0
checking for references to /build in /nix/store/p9nkdadfwmw121jinmnlay30gr0i9nbp-libredirect-0...
shrinking RPATHs of ELF executables and libraries in /nix/store/kzalzbhqciaws120irlnmc9sjd79y5ay-libredirect-0-hook
strip is /nix/store/p9akxn2sfy4wkhqdqa3li97pc6jaz3r1-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/kzalzbhqciaws120irlnmc9sjd79y5ay-libredirect-0-hook
checking for references to /build in /nix/store/kzalzbhqciaws120irlnmc9sjd79y5ay-libredirect-0-hook...
running install tests
/nix/store/p9nkdadfwmw121jinmnlay30gr0i9nbp-libredirect-0

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: libredirect

Partial log (click to expand)

strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/vjq2rjv45qbpck23bnk7lcy04g6qny9p-libredirect-0/lib
patching script interpreter paths in /nix/store/vjq2rjv45qbpck23bnk7lcy04g6qny9p-libredirect-0
checking for references to /build in /nix/store/vjq2rjv45qbpck23bnk7lcy04g6qny9p-libredirect-0...
shrinking RPATHs of ELF executables and libraries in /nix/store/pshppj62szkyvw97vr2iskslr96k40al-libredirect-0-hook
strip is /nix/store/vcc4svb8gy29g4pam2zja6llkbcwsyiq-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/pshppj62szkyvw97vr2iskslr96k40al-libredirect-0-hook
checking for references to /build in /nix/store/pshppj62szkyvw97vr2iskslr96k40al-libredirect-0-hook...
running install tests
/nix/store/vjq2rjv45qbpck23bnk7lcy04g6qny9p-libredirect-0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants