1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 21:21:06 +00:00

xdg_utils: Fix wrong substitution of grep command.

Fixes regression introduced by 16406e63b3.

Not replacing "egrep" with a negated character class on [^e] needs to be
put back into the replacement, because if we have something like:

foo="$(grep xxx)"

The replacement would be something like this:

foo="$/nix/store/.../bin/grep xxx)"

Which will lead to wrong behavior and in cases of for example
"xdg-screensaver", even directly to a syntax error:

xdg-screensaver: line 178: syntax error near unexpected token `('
xdg-screensaver: line 178: `command="/nix/store/.../bin/grep -E
                            "^Exec(\[[^]=]*])?=" "$file" |
                            /nix/store/.../bin/cut -d= -f 2- |
                            first_word`"'

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2015-07-05 09:25:13 +02:00
parent e199d9e844
commit 2467c437b7
No known key found for this signature in database
GPG key ID: D0EBD0EC8C2DC961

View file

@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
substituteInPlace $item --replace "cut " "${coreutils}/bin/cut "
substituteInPlace $item --replace "sed " "${gnused}/bin/sed "
substituteInPlace $item --replace "egrep " "${gnugrep}/bin/egrep "
sed -i $item -e "s#[^e]grep #${gnugrep}/bin/grep #g" # Don't replace 'egrep'
sed -i $item -re "s#([^e])grep #\1${gnugrep}/bin/grep #g" # Don't replace 'egrep'
substituteInPlace $item --replace "which " "${which}/bin/which "
substituteInPlace $item --replace "/usr/bin/file" "${file}/bin/file"
done