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

chromium: Add missing dependency on gnugrep #86662

Merged
merged 1 commit into from Jul 17, 2020

Conversation

glittershark
Copy link
Member

@glittershark glittershark commented May 3, 2020

The bin script that runs chromium calls out to gnugrep:

# libredirect causes chromium to deadlock on startup
export LD_PRELOAD="$(echo -n "$LD_PRELOAD" | tr ':' '\n' | grep -v /lib/libredirect\\.so$ | tr '\n' ':')"

but gnugrep ismissing as a runtime dependency of the chromium package. I found thisout when I was trying to put it in a docker image and was getting errors that grep didn't exist.

I'm a little unfamiliar with how makeWrapper works, so this may not actually be the right way to include this - I'm mostly submitting this as a call for help, because it felt broken to me.

Motivation for this change
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.

@euank
Copy link
Member

euank commented May 3, 2020

This change doesn't look like it should fix the issue. Did it actually fix it in practice?

The reason I don't think it fixes the issue is because the grep issue is a runtime dependency (in the wrapper script), and you added it as a buildInput only... but a buildInput doesn't end up as a runtime dependency unless there's a reference to it in one of the output artifacts.
This is described in this nix pill.

Because of that, I think you'll also want to add an explicit reference to the gnugrep derivation. Specifically, the following line could be changed to add the runtime reference:

export LD_PRELOAD="\$(echo -n "\$LD_PRELOAD" | tr ':' '\n' | grep -v /lib/libredirect\\\\.so$ | tr '\n' ':')"

If we change that to ${gnugrep}/bin/grep instead of grep, that should result in the wrapper script having the full derivation path for grep, and thus result in the automatic runtime dependency stuff to pick up the need for gnugrep.

@glittershark glittershark marked this pull request as draft July 9, 2020 20:48
The bin script that runs chromium calls out to gnugrep - but gnugrep is
missing as a runtime dependency of the chromium package. I found this
out when I was trying to put it in a docker image.
@glittershark glittershark marked this pull request as ready for review July 9, 2020 20:52
@glittershark
Copy link
Member Author

@euank yeah, I had sorta assumed that makeWrapper did some magic with buildInputs, but I suppose that'd be kinda silly - thanks for the specific line suggestion. I've made that change and built + tested it and it works great

@glittershark
Copy link
Member Author

ran nixosTests.chromium locally and it passed

@Profpatsch
Copy link
Member

Huh, I don’t see how that changes anything at runtime, since that build script is run in the nix sandbox (inside of mkDerivation), so if grep was not in PATH there this would always have failed

Copy link
Member

@primeos primeos left a comment

Choose a reason for hiding this comment

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

The diff LGTM.

@Profpatsch this isn't clear from the limited diff context but that line is actually part of the wrapper ($out/bin/chromium) and as a result it is actually executed at runtime instead of in the build sandbox.

@Profpatsch Profpatsch merged commit d433839 into NixOS:master Jul 17, 2020
@glittershark glittershark deleted the chromium-missing-dependency branch July 17, 2020 16:40
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