From 2467c437b7103f5895c163b56484420c5ecc5553 Mon Sep 17 00:00:00 2001 From: aszlig Date: Sun, 5 Jul 2015 09:25:13 +0200 Subject: [PATCH] xdg_utils: Fix wrong substitution of grep command. Fixes regression introduced by 16406e63b310e832b017bf9ef0473a6aa792f7da. 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 --- pkgs/tools/X11/xdg-utils/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/X11/xdg-utils/default.nix b/pkgs/tools/X11/xdg-utils/default.nix index 7ba20480b6f5..24b9096d27c6 100644 --- a/pkgs/tools/X11/xdg-utils/default.nix +++ b/pkgs/tools/X11/xdg-utils/default.nix @@ -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