diff options
author | Guillaume Maudoux <guillaume.maudoux@tweag.io> | 2022-01-11 11:57:45 +0100 |
---|---|---|
committer | Guillaume Maudoux <guillaume.maudoux@tweag.io> | 2022-01-11 11:57:45 +0100 |
commit | e9a4abdb5d6fe8e128372a77d879b0187b1bacfe (patch) | |
tree | 0e1b541da8e5b7d9ebab7fdf94b3f4a209d02393 /src/libstore/local-store.hh | |
parent | c260640dec6e35c714b666a1e7adede5aab6972a (diff) |
Make --repair-path also repair corrupt optimised links
There already existed a smoke test for the link content length,
but it appears that there exists some corruptions pernicious enough
to replace the file content with zeros, and keeping the same length.
--repair-path now goes as far as checking the content of the link,
making it true to its name and actually repairing the path for such
coruption cases.
Diffstat (limited to 'src/libstore/local-store.hh')
-rw-r--r-- | src/libstore/local-store.hh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh index 115ea046a..04698ba07 100644 --- a/src/libstore/local-store.hh +++ b/src/libstore/local-store.hh @@ -172,8 +172,9 @@ public: void optimiseStore() override; - /* Optimise a single store path. */ - void optimisePath(const Path & path); + /* Optimise a single store path. Optionally, test the encountered + symlinks for corruption. */ + void optimisePath(const Path & path, bool repair); bool verifyStore(bool checkContents, RepairFlag repair) override; @@ -253,7 +254,7 @@ private: InodeHash loadInodeHash(); Strings readDirectoryIgnoringInodes(const Path & path, const InodeHash & inodeHash); - void optimisePath_(Activity * act, OptimiseStats & stats, const Path & path, InodeHash & inodeHash); + void optimisePath_(Activity * act, OptimiseStats & stats, const Path & path, InodeHash & inodeHash, bool repair); // Internal versions that are not wrapped in retry_sqlite. bool isValidPath_(State & state, const StorePath & path); |