Skip to content

xdg_utils: fix replacement of which with type -P #14674

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

Closed
wants to merge 1 commit into from

Conversation

Forkk
Copy link
Member

@Forkk Forkk commented Apr 13, 2016

Before, the postInstall in xdg_utils failed to properly replace all instances of which with type -P due to some errant spaces in the sed command. This fixes the problem (hopefully).

I'm lazy and I don't have a local copy of the nixpkgs repo at the moment, so I haven't really tested this yet, but I have tested a similar fix using overrideDerivation, so it'll probably work. ;)

Things done
  • Tested using sandboxing (nix-build --option build-use-chroot true or nix.useChroot on NixOS)
  • Built on platform(s)
    • NixOS
    • OS X
    • Linux
  • 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/)
  • Fits CONTRIBUTING.md.

Sorry, something went wrong.

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @vcunat, @oxij and @zimbatm to be potential reviewers

@joachifm
Copy link
Contributor

Hm, seeing some file not found errors in the travis build log, possibly a legit error.

@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
substituteInPlace $out/bin/xdg-mime \
--replace "/usr/bin/file" "${file}/bin/file"
sed 's# which # type -P #g' -i "$out"/bin/*
Copy link
Member

Choose a reason for hiding this comment

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

This adds a space in front of things like:

`which "$command"` -> ` type -P "$command"`

Something like this covers all of the cases:

diff --git a/pkgs/tools/X11/xdg-utils/default.nix b/pkgs/tools/X11/xdg-utils/default.nix
index e7233d0..63073ad 100644
--- a/pkgs/tools/X11/xdg-utils/default.nix
+++ b/pkgs/tools/X11/xdg-utils/default.nix
@@ -46,6 +46,7 @@ stdenv.mkDerivation rec {
       --replace "/usr/bin/file" "${file}/bin/file"

     sed 's# which # type -P #g' -i "$out"/bin/*
+    sed 's#`which #`type -P #g' -i "$out"/bin/*
   '';

   meta = with stdenv.lib; {

@domenkozar
Copy link
Member

Fixes NixOS/nixos#301

@fpletz
Copy link
Member

fpletz commented Nov 28, 2016

Should be fixed according to NixOS/nixos#301.

@fpletz fpletz closed this Nov 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants