From 281921a9f8636f21c1ef65cbbc21d603179a01f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Mon, 9 Jan 2023 13:00:21 +0100 Subject: [PATCH] files: avoid surprises when linking files (#3018) --- modules/files.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/files.nix b/modules/files.nix index a7fd67f57a0b..daeeb0b1f993 100644 --- a/modules/files.nix +++ b/modules/files.nix @@ -185,8 +185,9 @@ in $VERBOSE_ECHO "Skipping '$targetPath' as it is identical to '$sourcePath'" else # Place that symlink, --force + # This can still fail if the target is a directory, in which case we bail out. $DRY_RUN_CMD mkdir -p $VERBOSE_ARG "$(dirname "$targetPath")" - $DRY_RUN_CMD ln -nsf $VERBOSE_ARG "$sourcePath" "$targetPath" + $DRY_RUN_CMD ln -Tsf $VERBOSE_ARG "$sourcePath" "$targetPath" || exit 1 fi done '';