diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 87465df1482a..19dbdf8848e0 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -661,6 +661,10 @@ substituteStream() { echo "substituteStream(): ERROR: substitution variables must be valid Bash names, \"$varName\" isn't." >&2 return 1 fi + if [ -z ${!varName+x} ]; then + echo "substituteStream(): ERROR: variable \$$varName is unset" >&2 + return 1 + fi pattern="@$varName@" replacement="${!varName}" ;;