daemon: optimizePath: Detect some .links corruptions.
authorEelco Dolstra <eelco.dolstra@logicblox.com>
Mon, 9 Nov 2015 19:48:09 +0000 (20:48 +0100)
committerLudovic Courtès <ludo@gnu.org>
Wed, 2 Dec 2015 17:37:59 +0000 (19:37 +0200)
commite134baae774eaa78e7ae8c3d87db50170f023536
treef1f22ba0333c47863dbb3f2c427fd37a6c310555
parent14fb686a21d786afa699a38d20929a88be6e541d
daemon: optimizePath: Detect some .links corruptions.

If automatic store optimisation is enabled, and a hard-linked file in
the store gets corrupted, then the corresponding .links entry will
also be corrupted. In that case, trying to repair with --repair or
--repair-path won't work, because the new "good" file will be replaced
by a hard link to the corrupted file. We can catch most of these cases
by doing a sanity-check on the file sizes.
nix/libstore/optimise-store.cc