Skip to content

Commit

Permalink
preserve installed file timestamps throughout kiss
Browse files Browse the repository at this point in the history
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
  • Loading branch information
echawk authored and phoebos committed Dec 16, 2024
1 parent 38e8524 commit 2feaf95
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kiss
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 2feaf95

Please sign in to comment.