Skip to content

Commit

Permalink
writers.makeScriptWriter: fail build if interpreter of interpreter is…
Browse files Browse the repository at this point in the history
… a script
  • Loading branch information
adrian-gierakowski committed Jul 24, 2020
1 parent 194985b commit 6fe292d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pkgs/build-support/writers/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,20 @@ rec {
# arguments to the interpreter are allowed.
if [[ -n "${toString pkgs.stdenvNoCC.isDarwin}" ]] && isScript $interpreter
then
wrapperInterpreter=$(head -1 "$interpreter" | tail -c+3)
wrapperInterpreterLine=$(head -1 "$interpreter" | tail -c+3)
# Get first word from the line (note: xargs echo remove leading spaces)
wrapperInterpreter=$(echo "$wrapperInterpreterLine" | xargs echo | cut -d " " -f1)
if isScript $wrapperInterpreter
then
echo "error: passed interpreter ($interpreter) is a script which has another script ($wrapperInterpreter) as an interpreter, which is not supported."
exit 1
fi
# This should work as long as wrapperInterpreter is a shell, which is
# the case for programs wrapped with makeWrapper, like
# python3.withPackages etc.
interpreterLine="$wrapperInterpreter $interpreter"
interpreterLine="$wrapperInterpreterLine $interpreter"
else
interpreterLine=$interpreter
fi
Expand Down

0 comments on commit 6fe292d

Please sign in to comment.