database: Reset timestamps to one second after the Epoch.
authorLudovic Courtès <ludo@gnu.org>
Fri, 20 Jul 2018 12:49:34 +0000 (14:49 +0200)
committerLudovic Courtès <ludo@gnu.org>
Fri, 20 Jul 2018 13:01:33 +0000 (15:01 +0200)
commite4752118691e41ae8307649d1abfd4739b3e4bfa
treeeb1c1d4b794e3e00dad9ce0f10d959d12b870bcd
parent4f89a8eec69491b925f084381ea4de37527c9310
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.
guix/store/database.scm
tests/store-database.scm