stdenv: ignore duplicates in addToSearchPath (#113800)

This commit is contained in:
Vincenzo Mantova 2021-03-13 18:58:21 +00:00 committed by GitHub
parent 86d56f10fc
commit 6ba632c2a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,7 +157,8 @@ addToSearchPathWithCustomDelimiter() {
local delimiter="$1"
local varName="$2"
local dir="$3"
if [ -d "$dir" ]; then
if [[ -d "$dir" && "${!varName:+${delimiter}${!varName}${delimiter}}" \
!= *"${delimiter}${dir}${delimiter}"* ]]; then
export "${varName}=${!varName:+${!varName}${delimiter}}${dir}"
fi
}