mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
Merge pull request #14328 from cachix/nar-substitutiongone
Fix misleading error messages for missing NARs due to stale cache
This commit is contained in:
commit
d74177dccc
2 changed files with 12 additions and 4 deletions
|
|
@ -268,16 +268,18 @@ Goal::Co PathSubstitutionGoal::tryToRun(
|
||||||
try {
|
try {
|
||||||
promise.get_future().get();
|
promise.get_future().get();
|
||||||
} catch (std::exception & e) {
|
} catch (std::exception & e) {
|
||||||
printError(e.what());
|
|
||||||
|
|
||||||
/* Cause the parent build to fail unless --fallback is given,
|
/* Cause the parent build to fail unless --fallback is given,
|
||||||
or the substitute has disappeared. The latter case behaves
|
or the substitute has disappeared. The latter case behaves
|
||||||
the same as the substitute never having existed in the
|
the same as the substitute never having existed in the
|
||||||
first place. */
|
first place. */
|
||||||
try {
|
try {
|
||||||
throw;
|
throw;
|
||||||
} catch (SubstituteGone &) {
|
} catch (SubstituteGone & sg) {
|
||||||
|
/* Missing NARs are expected when they've been garbage collected.
|
||||||
|
This is not a failure, so log as a warning instead of an error. */
|
||||||
|
logWarning({.msg = sg.info().msg});
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
printError(e.what());
|
||||||
substituterFailed = true;
|
substituterFailed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,13 @@ clearStore
|
||||||
|
|
||||||
mv "$cacheDir/nar" "$cacheDir/nar2"
|
mv "$cacheDir/nar" "$cacheDir/nar2"
|
||||||
|
|
||||||
nix-build --substituters "file://$cacheDir" --no-require-sigs dependencies.nix -o "$TEST_ROOT/result"
|
nix-build --substituters "file://$cacheDir" --no-require-sigs dependencies.nix -o "$TEST_ROOT/result" 2>&1 | tee "$TEST_ROOT/log"
|
||||||
|
|
||||||
|
# Verify that missing NARs produce warnings, not errors
|
||||||
|
# The build should succeed despite the warnings
|
||||||
|
grepQuiet "does not exist in binary cache" "$TEST_ROOT/log"
|
||||||
|
# Ensure the message is not at error level by checking that the command succeeded
|
||||||
|
[ -e "$TEST_ROOT/result" ]
|
||||||
|
|
||||||
mv "$cacheDir/nar2" "$cacheDir/nar"
|
mv "$cacheDir/nar2" "$cacheDir/nar"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue