diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2017-07-01 11:26:15 +0200 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2017-07-01 11:28:58 +0200 |
commit | 8dddd2b67204c13331beba2299a47eb3a49b1682 (patch) | |
tree | e81f6617372d87ac67fe605398db99c96ab87c9a /pkgs/tools/typesetting/tex/texlive | |
parent | 1551975e64fca2c6975b87cf0b05431a123df6f0 (diff) | |
download | nixlib-8dddd2b67204c13331beba2299a47eb3a49b1682.tar nixlib-8dddd2b67204c13331beba2299a47eb3a49b1682.tar.gz nixlib-8dddd2b67204c13331beba2299a47eb3a49b1682.tar.bz2 nixlib-8dddd2b67204c13331beba2299a47eb3a49b1682.tar.lz nixlib-8dddd2b67204c13331beba2299a47eb3a49b1682.tar.xz nixlib-8dddd2b67204c13331beba2299a47eb3a49b1682.tar.zst nixlib-8dddd2b67204c13331beba2299a47eb3a49b1682.zip |
texlive.combine: fix perl scripts without a shebang
Fixes #24343. These parts of upstream texlive are really ugly. Also improve variable quoting in the code around.
Diffstat (limited to 'pkgs/tools/typesetting/tex/texlive')
-rw-r--r-- | pkgs/tools/typesetting/tex/texlive/combine.nix | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pkgs/tools/typesetting/tex/texlive/combine.nix b/pkgs/tools/typesetting/tex/texlive/combine.nix index c783316c6d55..9af1d6a59ffd 100644 --- a/pkgs/tools/typesetting/tex/texlive/combine.nix +++ b/pkgs/tools/typesetting/tex/texlive/combine.nix @@ -155,18 +155,24 @@ in buildEnv { --prefix PERL5LIB : "$out/share/texmf/scripts/texlive" # avoid using non-nix shebang in $target by calling interpreter - if [[ "$(head -c 2 $target)" = "#!" ]]; then - local cmdline="$(head -n 1 $target | sed 's/^\#\! *//;s/ *$//')" + if [[ "$(head -c 2 "$target")" = "#!" ]]; then + local cmdline="$(head -n 1 "$target" | sed 's/^\#\! *//;s/ *$//')" local relative=`basename "$cmdline" | sed 's/^env //' ` local newInterp=`echo "$relative" | cut -d\ -f1` local params=`echo "$relative" | cut -d\ -f2- -s` - local newPath="$(type -P $newInterp)" + local newPath="$(type -P "$newInterp")" if [[ -z "$newPath" ]]; then echo " Warning: unknown shebang '$cmdline' in '$target'" continue fi echo " and patching shebang '$cmdline'" sed "s|^exec |exec $newPath $params |" -i "$link" + + elif head -n 1 "$target" | grep -q 'exec perl'; then + # see #24343 for details of the problem + echo " and patching weird perl shebang" + sed "s|^exec |exec '${perl}/bin/perl' -w |" -i "$link" + else sed 's|^exec |exec -a "$0" |' -i "$link" echo |