1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 23:03:53 -04:00

LocalStore::addToStore(): Ignore exceptions from parseDump()

In the "discard" case (i.e. when the store path already exists
locally), when we call parseDump() from a Finally and it throws an
exception (e.g. if the download of the NAR fails), Nix crashes:

   terminate called after throwing an instance of 'nix::SubstituteGone'
     what():  error: file 'nar/06br3254rx4gz4cvjzxlv028jrx80zg5i4jr62vjmn416dqihgr7.nar.xz' does not exist in binary cache 'http://localhost'
   Aborted (core dumped)

(cherry picked from commit a18d8d688a)
This commit is contained in:
Eelco Dolstra 2024-01-18 17:01:45 +01:00 committed by github-actions[bot]
parent 3cb2740721
commit cc94ea5a17

View file

@ -1202,7 +1202,11 @@ void LocalStore::addToStore(const ValidPathInfo & info, Source & source,
Finally cleanup = [&]() {
if (!narRead) {
NullParseSink sink;
parseDump(sink, source);
try {
parseDump(sink, source);
} catch (...) {
ignoreException();
}
}
};