From 6555df6209c29f5fde8d7baceba23b55f4aabb1c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 16 Jul 2021 10:20:20 +0300 Subject: [PATCH] kiss: Fix bug with strict cache removal Turns out nested package manager processes would wipe the cache earlier than expected when installing packages. As all these nested processes are involved in is installation, this changes pkg_clean to have them only wipe tar_dir (the only directory they use). --- kiss | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/kiss b/kiss index 35bb5b1..7b8011d 100755 --- a/kiss +++ b/kiss @@ -1675,9 +1675,20 @@ pkg_update() { pkg_clean() { # Clean up on exit or error. This removes everything related to the build. - # This only runs inside the top-level KISS process. - case ${KISS_DEBUG:-0}-${KISS_LVL:-0} in 0-0) - rm -rf "$tmp_dir" + case ${KISS_DEBUG:-0}-${KISS_LVL:-0} in + 0-0) + # If we are exiting the top-level package manager process, wipe + # the entire temporary directory. + rm -rf "$tmp_dir" + ;; + + 0-*) + # If we are exiting a nested package manager process, wipe only + # the tar temporary directory. Files in this directory may not + # be owned by user of the top-level process and therefore cannot + # be removed. + rm -rf "$tar_dir" + ;; esac }