From e4752118691e41ae8307649d1abfd4739b3e4bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 20 Jul 2018 14:49:34 +0200 Subject: 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. --- tests/store-database.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tests/store-database.scm') diff --git a/tests/store-database.scm b/tests/store-database.scm index fcae66e2de..4d91884250 100644 --- a/tests/store-database.scm +++ b/tests/store-database.scm @@ -32,7 +32,8 @@ (test-begin "store-database") -(test-assert "register-path" +(test-equal "register-path" + '(1 1) (let ((file (string-append (%store-prefix) "/" (make-string 32 #\f) "-fake"))) (when (valid-path? %store file) @@ -50,7 +51,9 @@ (and (valid-path? %store file) (equal? (references %store file) (list ref)) (null? (valid-derivers %store file)) - (null? (referrers %store file)))))) + (null? (referrers %store file)) + (list (stat:mtime (lstat file)) + (stat:mtime (lstat ref))))))) (test-equal "new database" (list 1 2) -- cgit v1.2.3