guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "guix pull" expiry channels


From: Ludovic Courtès
Subject: Re: "guix pull" expiry channels
Date: Fri, 11 Jun 2021 23:32:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi,

zimoun <zimon.toutoune@gmail.com> skribis:

> I do not know if it is not a bug.  From f8acd1a (pulled April, 21rst), I get:
>
> Updating channel 'guix' from Git repository at
> 'https://git.savannah.gnu.org/git/guix.git'...
> guix pull: error: Git error: failed to resolve path
> '/home/simon/.cache/guix/checkouts/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr27shj7apsnalwq':
> No such file or directory
>
>
> Indeed, after the error, I have this:
>
> $ ls ~/.cache/guix/checkouts/
> f5uvstgmyyeyhl66lla3yxbp26x25xwt7rbwah3kahh724xwzisa  last-expiry-cleanup
>
> Then if I run again "guix pull", it works as expected.
>
> It is hard to reproduce. ;-)  I suspect a bug in
> 'maybe-remove-expired-cache-entries' or 'update-cache-checkout'.

Sounds plausible!

The code in (guix git) determines expiration based on the mtime of
sub-directories in ~/.cache/guix/checkouts.  But that’s bogus, no?

Yes, and the Internet confirms: a directory’s mtime is only changed when
a file inside it is renamed, added, or deleted.)  Oops!  So it would
depend on how frequently you pull, and perhaps on the file system you
use, go figure.

The patch below should fix it.  Will push shortly, thank you!

Ludo’.

diff --git a/guix/git.scm b/guix/git.scm
index 57fa2ca1ee..9c6f326c36 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -424,6 +424,14 @@ it unchanged."
        ;; REPOSITORY as soon as possible.
        (repository-close! repository)
 
+       ;; Update CACHE-DIRECTORY's mtime to so the cache logic sees it.
+       (match (gettimeofday)
+         ((seconds . microseconds)
+          (let ((nanoseconds (* 1000 microseconds)))
+            (utime cache-directory
+                   seconds seconds
+                   nanoseconds nanoseconds))))
+
        ;; When CACHE-DIRECTORY is a sub-directory of the default cache
        ;; directory, remove expired checkouts that are next to it.
        (let ((parent (dirname cache-directory)))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]