summaryrefslogtreecommitdiff
path: root/guix/store
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-07-20 14:49:34 +0200
committerLudovic Courtès <ludo@gnu.org>2018-07-20 15:01:33 +0200
commite4752118691e41ae8307649d1abfd4739b3e4bfa (patch)
treeeb1c1d4b794e3e00dad9ce0f10d959d12b870bcd /guix/store
parent4f89a8eec69491b925f084381ea4de37527c9310 (diff)
database: Reset timestamps to one second after the Epoch.
Previously, store items registered in the database by this code (for instance, store items retrieved by 'guix offload' and passed to 'restore-file-set') would have an mtime of 0 instead of 1. This would cause problems for things like .go files: Guile would consider them to be older than the corresponding .scm file, and consequently it would ignore them and possibly use another (incorrect) .go file. Reported by Ricardo Wurmus. * guix/store/database.scm (reset-timestamps): Pass 1, not 0, to 'utime'. * tests/store-database.scm ("register-path"): Check the mtime of FILE and REF.
Diffstat (limited to 'guix/store')
-rw-r--r--guix/store/database.scm8
1 files changed, 5 insertions, 3 deletions
diff --git a/guix/store/database.scm b/guix/store/database.scm
index 8f35b63e37..0879a95d0b 100644
--- a/guix/store/database.scm
+++ b/guix/store/database.scm
@@ -190,12 +190,14 @@ Every store item in REFERENCES must already be registered."
(define (reset-timestamps file)
"Reset the modification time on FILE and on all the files it contains, if
it's a directory. While at it, canonicalize file permissions."
+ ;; Note: We're resetting to one second after the Epoch like 'guix-daemon'
+ ;; has always done.
(let loop ((file file)
(type (stat:type (lstat file))))
(case type
((directory)
(chmod file #o555)
- (utime file 0 0 0 0)
+ (utime file 1 1 0 0)
(let ((parent file))
(for-each (match-lambda
(("." . _) #f)
@@ -209,10 +211,10 @@ it's a directory. While at it, canonicalize file permissions."
(type type))))))
(scandir* parent))))
((symlink)
- (utime file 0 0 0 0 AT_SYMLINK_NOFOLLOW))
+ (utime file 1 1 0 0 AT_SYMLINK_NOFOLLOW))
(else
(chmod file (if (executable-file? file) #o555 #o444))
- (utime file 0 0 0 0)))))
+ (utime file 1 1 0 0)))))
(define* (register-path path
#:key (references '()) deriver prefix