about summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2016-11-26 10:25:20 +0100
committerVladimír Čunát <vcunat@gmail.com>2016-11-26 12:32:15 +0100
commit97853c07d73be7f2717bebe3d2ff038b72aeb1e9 (patch)
treed8d67f1d703c75bf9769e657647839dc01fa9780 /pkgs/build-support/setup-hooks
parent7a88f314cb1ebea9cb05ba8bdb3866c8d4d6a6b8 (diff)
downloadnixlib-97853c07d73be7f2717bebe3d2ff038b72aeb1e9.tar
nixlib-97853c07d73be7f2717bebe3d2ff038b72aeb1e9.tar.gz
nixlib-97853c07d73be7f2717bebe3d2ff038b72aeb1e9.tar.bz2
nixlib-97853c07d73be7f2717bebe3d2ff038b72aeb1e9.tar.lz
nixlib-97853c07d73be7f2717bebe3d2ff038b72aeb1e9.tar.xz
nixlib-97853c07d73be7f2717bebe3d2ff038b72aeb1e9.tar.zst
nixlib-97853c07d73be7f2717bebe3d2ff038b72aeb1e9.zip
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).
Diffstat (limited to 'pkgs/build-support/setup-hooks')
-rw-r--r--pkgs/build-support/setup-hooks/multiple-outputs.sh3
1 files changed, 2 insertions, 1 deletions
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"