From b5fba97ec8e957e1b6ca75b9df9a9f380d22178e Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 14 Jul 2021 10:33:45 +0300 Subject: [PATCH] kiss: fix errors with circular symbolic links. Fixes #232 --- kiss | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/kiss b/kiss index 1363750..84660a6 100755 --- a/kiss +++ b/kiss @@ -1102,7 +1102,14 @@ pkg_install_files() { *) # Skip directories as they're likely symlinks in this case. # Pure directories in manifests have a suffix of '/'. - [ -d "$_file" ] || test "$1" "$_file" || { + [ -d "$_file" ] || test "$1" "$_file" || + + if [ -h "$_file" ]; then + # Copy the file to the destination directory overwriting + # any existing file. + cp -fP "$2$file" "${_file%/*}/." + + else # Construct a temporary filename which is a) unique and # b) identifiable as related to the package manager. __tmp=${_file%/*}/__kiss-tmp-$pkg_name-${file##*/}-$pid @@ -1115,8 +1122,7 @@ pkg_install_files() { # destination. The running processes will either get # the old file or the new one. mv -f "$__tmp" "$_file" - - } || return 1 + fi esac done }