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).
This commit is contained in:
Vladimír Čunát 2016-11-26 10:25:20 +01:00
parent 7a88f314cb
commit 97853c07d7
No known key found for this signature in database
GPG key ID: E747DF1F9575A3AA

View file

@ -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"