From 529dce6e98c22f00052df231414bca4f86e02094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 17 Oct 2025 15:50:53 +0200 Subject: [PATCH] inferior: Caching works by checking the mtime, not the atime. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mounting file systems with ‘noatime’ is common. Thus, avoid relying on the atime. * guix/inferior.scm (cached-channel-instance): Pass ‘stat:mtime’ to ‘file-expiration-time’. When ‘cached’ exists, call ‘utime’ to update its mtime and atime. Change-Id: Ib9bff45ed402260fdead3c23f09b431fa369e741 --- guix/inferior.scm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/guix/inferior.scm b/guix/inferior.scm index 89f017c6e86e3f2a68e5ea3ef3b4f5fe7301223a..6446deea39ed54177e2ed98fb8edcee8ad68fb47 100644 --- a/guix/inferior.scm +++ b/guix/inferior.scm @@ -952,18 +952,21 @@ X.509 host certificate; otherwise, warn about the problem and keep going." (maybe-remove-expired-cache-entries cache-directory cache-entries #:entry-expiration - (file-expiration-time ttl)) + (file-expiration-time ttl stat:mtime)) ;; Clean the legacy cache directory as well. Remove this call once at least ;; one year has passed. (maybe-remove-expired-cache-entries %legacy-inferior-cache-directory cache-entries #:entry-expiration - (file-expiration-time ttl)) + (file-expiration-time ttl stat:mtime)) (if (file-exists? (cached commits)) - (cached commits) + (let ((now (current-time))) + ;; Update the mtime on CACHED to reflect usage. + (utime cached now now 0 0 AT_SYMLINK_NOFOLLOW) + cached) (run-with-store store (mlet* %store-monad ((instances -> (latest-channel-instances store channels