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

execline: wrap unconditionally; strip #78372

Merged
merged 1 commit into from Jan 24, 2020
Merged

Conversation

alyssais
Copy link
Member

Motivation for this change

I don't think there's any situation in which an unwrapped execlineb is
useful -- if you want to use different versions of the execlineb tool
it'll still prefer ones in PATH. At the same time, implementing the
wrapper in this way, as a series of two derivations, meant that we
didn't get stdenv goodness for the wrapper. This meant that, for
example, the wrapper was not stripped, and so execline ended up with
runtime dependencies on gcc and the Linux headers. I don't want to
have to reimplement this sort of stuff when it's already in stdenv,
and so it makes much more sense to create the wrapper in the
mkDerivation call, where all of stdenv's normal magic will find it.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-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)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

I don't think there's any situation in which an unwrapped execlineb is
useful -- if you want to use different versions of the execlineb tool
it'll still prefer ones in PATH.  At the same time, implementing the
wrapper in this way, as a series of two derivations, meant that we
didn't get stdenv goodness for the wrapper.  This meant that, for
example, the wrapper was not stripped, and so execline ended up with
runtime dependencies on gcc and the Linux headers.  I don't want to
have to reimplement this sort of stuff when it's already in stdenv,
and so it makes much more sense to create the wrapper in the
mkDerivation call, where all of stdenv's normal magic will find it.
cc \
-O \
-Wall -Wpedantic \
-D 'EXECLINEB_PATH()="${execline}/bin/execlineb"' \
-D 'EXECLINE_BIN_PATH()="${execline}/bin"' \
Copy link
Member Author

Choose a reason for hiding this comment

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

@Profpatsch why are these functions, btw?

Copy link
Member

Choose a reason for hiding this comment

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

I don’t remember, but I remember that there was a semantic difference that makes it work/not work

Copy link
Member

Choose a reason for hiding this comment

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

Consult the gcc manual of your choice I guess :)

@Profpatsch
Copy link
Member

I don't think there's any situation in which an unwrapped execlineb is
useful

I think there is, if you don’t want to have an overhead of two exec calls per call to execlineb (which is about 2–10ms).

We don’t have to remove the wrapper, we can use mkDerivation instead of runCommandCC. I wasn’t aware that without the stdenv strip gcc was in the runtime closure, that’s a good catch.

@alyssais
Copy link
Member Author

alyssais commented Jan 23, 2020 via email

@alyssais
Copy link
Member Author

alyssais commented Jan 23, 2020 via email

@Profpatsch
Copy link
Member

If you were worried about exec overhead, surely you wouldn't be using execline, where literally every operation adds another exec?

That’s a good counterargument.

@Profpatsch Profpatsch merged commit 5e4c494 into NixOS:master Jan 24, 2020
@alyssais alyssais deleted the execline branch April 19, 2021 13:26
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

2 participants