diff options
author | Mogria <m0gr14@gmail.com> | 2017-03-15 11:32:44 +0100 |
---|---|---|
committer | Jörg Thalheim <Mic92@users.noreply.github.com> | 2017-03-15 11:32:44 +0100 |
commit | 1893ed54dc1ee7cef56be1c2ce7839c9523ba17e (patch) | |
tree | a672755262f2dd224246764d20621b0f47238da0 | |
parent | ada3bcdcda6c0a1b6d1267f5dfebe76538f4545b (diff) | |
download | nixlib-1893ed54dc1ee7cef56be1c2ce7839c9523ba17e.tar nixlib-1893ed54dc1ee7cef56be1c2ce7839c9523ba17e.tar.gz nixlib-1893ed54dc1ee7cef56be1c2ce7839c9523ba17e.tar.bz2 nixlib-1893ed54dc1ee7cef56be1c2ce7839c9523ba17e.tar.lz nixlib-1893ed54dc1ee7cef56be1c2ce7839c9523ba17e.tar.xz nixlib-1893ed54dc1ee7cef56be1c2ce7839c9523ba17e.tar.zst nixlib-1893ed54dc1ee7cef56be1c2ce7839c9523ba17e.zip |
sublime3: fix hardcoded /bin/bash when executing commands for build systems (#23561)
* sublime3: replace hardcoded /bin/bash with /usr/bin/env exec.py in Default.package-sublime calls /bin/bash with subprocess. See Issue #12011. Because of this builds could not be started from withtin Sublime Text. * sublime3: use wrapped of bash to fix internal build system Without the wrapped version of bash (a symlink to $bash/bin/bash) with LD_PRELOAD to glibc an relocation error occurs when trying to run builds from within Sublime Text 3. See Issue #12011.
-rw-r--r-- | pkgs/applications/editors/sublime3/default.nix | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/pkgs/applications/editors/sublime3/default.nix b/pkgs/applications/editors/sublime3/default.nix index 8912aca0711d..0b8ecda62302 100644 --- a/pkgs/applications/editors/sublime3/default.nix +++ b/pkgs/applications/editors/sublime3/default.nix @@ -1,6 +1,6 @@ { fetchurl, stdenv, glib, xorg, cairo, gtk2, pango, makeWrapper, openssl, bzip2, pkexecPath ? "/run/wrappers/bin/pkexec", libredirect, - gksuSupport ? false, gksu}: + gksuSupport ? false, gksu, unzip, zip, bash }: assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"; assert gksuSupport -> gksu != null; @@ -33,6 +33,21 @@ in let dontPatchELF = true; buildInputs = [ makeWrapper ]; + # make exec.py in Default.sublime-package use own bash with + # an LD_PRELOAD instead of "/bin/bash" + patchPhase = '' + mkdir Default.sublime-package-fix + ( cd Default.sublime-package-fix + ${unzip}/bin/unzip ../Packages/Default.sublime-package > /dev/null + substituteInPlace "exec.py" --replace \ + "[\"/bin/bash\"" \ + "[\"$out/sublime_bash\"" + ) + ${zip}/bin/zip -j Default.sublime-package.zip Default.sublime-package-fix/* > /dev/null + mv Default.sublime-package.zip Packages/Default.sublime-package + rm -r Default.sublime-package-fix + ''; + buildPhase = '' for i in sublime_text plugin_host crash_reporter; do patchelf \ @@ -52,6 +67,12 @@ in let mkdir -p $out cp -prvd * $out/ + # We can't just call /usr/bin/env bash because a relocation error occurs + # when trying to run a build from within Sublime Text + ln -s ${bash}/bin/bash $out/sublime_bash + wrapProgram $out/sublime_bash \ + --set LD_PRELOAD "${stdenv.cc.cc.lib}/lib${stdenv.lib.optionalString stdenv.is64bit "64"}/libgcc_s.so.1" + wrapProgram $out/sublime_text \ --set LD_PRELOAD "${libredirect}/lib/libredirect.so" \ --set NIX_REDIRECTS ${builtins.concatStringsSep ":" redirects} |