guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 529dce6e98c22f00052df231414bca4f86e02094
Author: Ludovic Courtès <[email protected]>
AuthorDate: Fri Oct 17 15:50:53 2025 +0200

    inferior: Caching works by checking the mtime, not the atime.
    
    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 89f017c6e8..6446deea39 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

Reply via email to