From 96ebf614ad267150f417faeb122d80588e414d6d Mon Sep 17 00:00:00 2001 From: volth Date: Tue, 6 Mar 2018 13:00:14 +0000 Subject: [PATCH] chromium, google-chrome: fix escaping of commandLineArgs --- .../networking/browsers/chromium/default.nix | 2 +- .../browsers/google-chrome/default.nix | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index 1f6eb7c178fb..1458a1816569 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -90,7 +90,7 @@ in stdenv.mkDerivation { mkdir -p "$out/bin" eval makeWrapper "${browserBinary}" "$out/bin/chromium" \ - ${commandLineArgs} \ + --add-flags ${escapeShellArg (escapeShellArg commandLineArgs)} \ ${concatMapStringsSep " " getWrapperFlags chromium.plugins.enabled} ed -v -s "$out/bin/chromium" << EOF diff --git a/pkgs/applications/networking/browsers/google-chrome/default.nix b/pkgs/applications/networking/browsers/google-chrome/default.nix index eaa05726f1c0..d2d26190ce05 100644 --- a/pkgs/applications/networking/browsers/google-chrome/default.nix +++ b/pkgs/applications/networking/browsers/google-chrome/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, patchelf, bash +{ stdenv, fetchurl, patchelf, makeWrapper # Linked dynamic libraries. , glib, fontconfig, freetype, pango, cairo, libX11, libXi, atk, gconf, nss, nspr @@ -72,7 +72,7 @@ in stdenv.mkDerivation rec { src = chromium.upstream-info.binary; buildInputs = [ - patchelf + patchelf makeWrapper # needed for GSETTINGS_SCHEMAS_PATH gsettings-desktop-schemas glib gtk @@ -120,14 +120,11 @@ in stdenv.mkDerivation rec { mv "$icon_file" "$logo_output_path/google-$appname.png" done - cat > $exe << EOF - #!${bash}/bin/sh - export LD_LIBRARY_PATH=$rpath\''${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} - export PATH=$binpath\''${PATH:+:\$PATH} - export XDG_DATA_DIRS=$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH\''${XDG_DATA_DIRS:+:}\$XDG_DATA_DIRS - $out/share/google/$appname/google-$appname ${commandLineArgs} "\$@" - EOF - chmod +x $exe + makeWrapper "$out/share/google/$appname/google-$appname" "$exe" \ + --prefix LD_LIBRARY_PATH : "$rpath" \ + --prefix PATH : "$binpath" \ + --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" \ + --add-flags ${escapeShellArg commandLineArgs} for elf in $out/share/google/$appname/{chrome,chrome-sandbox,nacl_helper}; do patchelf --set-rpath $rpath $elf