summary refs log tree commit diff
path: root/pkgs/tools/X11/xdg-utils/default.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-07-05 09:25:13 +0200
committeraszlig <aszlig@redmoonstudios.org>2015-07-05 09:25:13 +0200
commit2467c437b7103f5895c163b56484420c5ecc5553 (patch)
treec8e76446e4a5c891dcc620cdbb0f7785b2c4bcb6 /pkgs/tools/X11/xdg-utils/default.nix
parente199d9e844e002852e142268fdc1143000dfbf6f (diff)
downloadnixlib-2467c437b7103f5895c163b56484420c5ecc5553.tar
nixlib-2467c437b7103f5895c163b56484420c5ecc5553.tar.gz
nixlib-2467c437b7103f5895c163b56484420c5ecc5553.tar.bz2
nixlib-2467c437b7103f5895c163b56484420c5ecc5553.tar.lz
nixlib-2467c437b7103f5895c163b56484420c5ecc5553.tar.xz
nixlib-2467c437b7103f5895c163b56484420c5ecc5553.tar.zst
nixlib-2467c437b7103f5895c163b56484420c5ecc5553.zip
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 <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/tools/X11/xdg-utils/default.nix')
-rw-r--r--pkgs/tools/X11/xdg-utils/default.nix2
1 files changed, 1 insertions, 1 deletions
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