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

Open
wants to merge 1 commit into
base: master
from

Conversation

@glittershark
Copy link
Contributor

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
Contributor

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 Jul 9, 2020
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 force-pushed the glittershark:chromium-missing-dependency branch from f8d6e28 to 25e338a Jul 9, 2020
@glittershark glittershark marked this pull request as ready for review Jul 9, 2020
@glittershark
Copy link
Contributor Author

glittershark commented Jul 9, 2020

@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
Contributor Author

glittershark commented Jul 9, 2020

ran nixosTests.chromium locally and it passed

@Profpatsch
Copy link
Member

Profpatsch commented Jul 10, 2020

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 left a comment

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.

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

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.