From 2feaf952614cbe5d5f04e5c64a4ad881b7da28df Mon Sep 17 00:00:00 2001 From: Ethan Date: Mon, 12 Feb 2024 16:03:26 -0600 Subject: [PATCH] preserve installed file timestamps throughout kiss install_files(): preserve the timestamps This patch fixes packages which rely on using the timestamp of their installed files to determine "newness", where if a file is newer, they will automatically recompile it. This patch prevents those recompilations, since the timestamps are now at their expected value. We only run `touch` on non-symlink files, since if we run touch on symlinks, we can run into file resolution errors, which will abort the installation of packages and result in a dirty filesystem. pkg_swap(): also preserve timestamps --- kiss | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kiss b/kiss index 0d7b69a..0706064 100755 --- a/kiss +++ b/kiss @@ -1355,8 +1355,9 @@ pkg_swap() { log "Swapping '$2' from '$_owns' to '$1'" # Convert the current owner to an alternative and rewrite its manifest - # file to reflect this. + # file to reflect this. Also ensure that timestamps are preserved. cp -Pf "$KISS_ROOT$2" "$sys_ch/$_owns>${_fnr#*>}" + ! [ -h "$KISS_ROOT$2" ] && touch -r "$KISS_ROOT$2" "$sys_ch/$_owns>${_fnr#*>}" pkg_manifest_replace "$_owns" "$2" "/$cho_db/$_owns>${_fnr#*>}" fi @@ -1438,6 +1439,9 @@ pkg_install_files() { # temporary name created above. cp -fP "$2$file" "$__tmp" && + # Ensure timestamps are preserved. + if ! [ -h "$2$file" ]; then touch -r "$2$file" "$__tmp"; fi && + # Atomically move the temporary file to its final # destination. The running processes will either get # the old file or the new one.