From 6ba632c2a442082f353bf2d7028fda11a888d099 Mon Sep 17 00:00:00 2001 From: Vincenzo Mantova Date: Sat, 13 Mar 2021 18:58:21 +0000 Subject: [PATCH] stdenv: ignore duplicates in addToSearchPath (#113800) --- pkgs/stdenv/generic/setup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 7168ce4084c8..a73474c952e5 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -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 }