From 97853c07d73be7f2717bebe3d2ff038b72aeb1e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sat, 26 Nov 2016 10:25:20 +0100 Subject: [PATCH] stdenv moveToOutput: move even broken symlinks I believe this reduces surprises and is actually simpler semantically. This is important e.g. for relative symlinks when moving both source and target - now the order of moving won't matter. Fixes #20723 (a particular instance of the surprise). --- pkgs/build-support/setup-hooks/multiple-outputs.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/setup-hooks/multiple-outputs.sh b/pkgs/build-support/setup-hooks/multiple-outputs.sh index ae491e8a7ef1..eafc770a8e17 100644 --- a/pkgs/build-support/setup-hooks/multiple-outputs.sh +++ b/pkgs/build-support/setup-hooks/multiple-outputs.sh @@ -98,7 +98,8 @@ moveToOutput() { if [ "${!output}" = "$dstOut" ]; then continue; fi local srcPath for srcPath in "${!output}"/$patt; do - if [ ! -e "$srcPath" ]; then continue; fi + # apply to existing files/dirs, *including* broken symlinks + if [ ! -e "$srcPath" ] && [ ! -L "$srcPath" ]; then continue; fi if [ "$dstOut" = REMOVE ]; then echo "Removing $srcPath"