forked from lix-project/lix
Merge changes Ie29a8a89,I873eedcf into main
* changes: store: delete obsolete lsof-disabling code store: guess the URL of failing fixed-output derivations
This commit is contained in:
commit
d3286d0990
16
doc/manual/rl-next/fod-failure-includes-url.md
Normal file
16
doc/manual/rl-next/fod-failure-includes-url.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
---
|
||||||
|
synopsis: "Hash mismatch diagnostics for fixed-output derivations include the URL"
|
||||||
|
cls: [1536]
|
||||||
|
credits: [jade]
|
||||||
|
category: Improvements
|
||||||
|
---
|
||||||
|
|
||||||
|
Now, when building fixed-output derivations, Lix will guess the URL that was used in the derivation using the `url` or `urls` properties in the derivation environment.
|
||||||
|
This is a layering violation but making these diagnostics tractable when there are multiple instances of the `AAAA` hash is too significant of an improvement to pass it up.
|
||||||
|
|
||||||
|
```
|
||||||
|
error: hash mismatch in fixed-output derivation '/nix/store/sjfw324j4533lwnpmr5z4icpb85r63ai-x1.drv':
|
||||||
|
likely URL: https://meow.puppy.forge/puppy.tar.gz
|
||||||
|
specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
||||||
|
got: sha256-a1Qvp3FOOkWpL9kFHgugU1ok5UtRPSu+NwCZKbbaEro=
|
||||||
|
```
|
|
@ -433,9 +433,6 @@ I grepped `src/` for `get[eE]nv\("` to find the mentions in Lix code.
|
||||||
- `NIX_PROFILE` - Selects which profile `nix-env` will operate on. Documented elsewhere.
|
- `NIX_PROFILE` - Selects which profile `nix-env` will operate on. Documented elsewhere.
|
||||||
- `NIX_SSHOPTS` - Options passed to `ssh(1)` when using a ssh remote store.
|
- `NIX_SSHOPTS` - Options passed to `ssh(1)` when using a ssh remote store.
|
||||||
Incorrectly documented on `nix-copy-closure` which is *surely* not the only place they are used??
|
Incorrectly documented on `nix-copy-closure` which is *surely* not the only place they are used??
|
||||||
- `_NIX_TEST_NO_LSOF` - Used on non-Linux, non-macOS platforms to disable using `lsof` when finding gc roots.
|
|
||||||
|
|
||||||
Since https://git.lix.systems/lix-project/lix/issues/156 was fixed, this should probably just be removed as it was a bad workaround for a macOS issue.
|
|
||||||
- `_NIX_TEST_GC_SYNC_1` - Path to a pipe that is used to block the GC briefly to validate invariants from the test suite.
|
- `_NIX_TEST_GC_SYNC_1` - Path to a pipe that is used to block the GC briefly to validate invariants from the test suite.
|
||||||
- `_NIX_TEST_GC_SYNC_2` - Path to a pipe that is used to block the GC briefly to validate invariants from the test suite.
|
- `_NIX_TEST_GC_SYNC_2` - Path to a pipe that is used to block the GC briefly to validate invariants from the test suite.
|
||||||
- `_NIX_TEST_FREE_SPACE_FILE` - Path to a file containing a decimal number with the free space that the GC is to believe it has.
|
- `_NIX_TEST_FREE_SPACE_FILE` - Path to a file containing a decimal number with the free space that the GC is to believe it has.
|
||||||
|
|
|
@ -2546,9 +2546,12 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
|
||||||
/* Throw an error after registering the path as
|
/* Throw an error after registering the path as
|
||||||
valid. */
|
valid. */
|
||||||
worker.hashMismatch = true;
|
worker.hashMismatch = true;
|
||||||
|
// XXX: shameless layering violation hack that makes the hash mismatch error at least not utterly worthless
|
||||||
|
auto guessedUrl = getOr(drv->env, "urls", getOr(drv->env, "url", "(unknown)"));
|
||||||
delayedException = std::make_exception_ptr(
|
delayedException = std::make_exception_ptr(
|
||||||
BuildError("hash mismatch in fixed-output derivation '%s':\n specified: %s\n got: %s",
|
BuildError("hash mismatch in fixed-output derivation '%s':\n likely URL: %s\n specified: %s\n got: %s",
|
||||||
worker.store.printStorePath(drvPath),
|
worker.store.printStorePath(drvPath),
|
||||||
|
guessedUrl,
|
||||||
wanted.to_string(SRI, true),
|
wanted.to_string(SRI, true),
|
||||||
got.to_string(SRI, true)));
|
got.to_string(SRI, true)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -321,10 +321,9 @@ Roots LocalStore::findRoots(bool censor)
|
||||||
|
|
||||||
void LocalStore::findPlatformRoots(UncheckedRoots & unchecked)
|
void LocalStore::findPlatformRoots(UncheckedRoots & unchecked)
|
||||||
{
|
{
|
||||||
// lsof is really slow on OS X. This actually causes the gc-concurrent.sh test to fail.
|
// N.B. This is (read: undertested!) fallback code only used for
|
||||||
// See: https://github.com/NixOS/nix/issues/3011
|
// non-Darwin, non-Linux platforms. Both major platforms have
|
||||||
// Because of this we disable lsof when running the tests.
|
// platform-specific code in src/libstore/platform/
|
||||||
if (getEnv("_NIX_TEST_NO_LSOF") != "1") {
|
|
||||||
try {
|
try {
|
||||||
std::regex lsofRegex(R"(^n(/.*)$)");
|
std::regex lsofRegex(R"(^n(/.*)$)");
|
||||||
auto lsofLines =
|
auto lsofLines =
|
||||||
|
@ -338,7 +337,6 @@ void LocalStore::findPlatformRoots(UncheckedRoots & unchecked)
|
||||||
/* lsof not installed, lsof failed */
|
/* lsof not installed, lsof failed */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void LocalStore::findRuntimeRoots(Roots & roots, bool censor)
|
void LocalStore::findRuntimeRoots(Roots & roots, bool censor)
|
||||||
{
|
{
|
||||||
|
|
|
@ -142,6 +142,8 @@ test "$(<<<"$out" grep -E '^error:' | wc -l)" = 2
|
||||||
<<<"$out" grepQuiet -E "hash mismatch in fixed-output derivation '.*-x1\\.drv'"
|
<<<"$out" grepQuiet -E "hash mismatch in fixed-output derivation '.*-x1\\.drv'"
|
||||||
<<<"$out" grepQuiet -vE "hash mismatch in fixed-output derivation '.*-x3\\.drv'"
|
<<<"$out" grepQuiet -vE "hash mismatch in fixed-output derivation '.*-x3\\.drv'"
|
||||||
<<<"$out" grepQuiet -vE "hash mismatch in fixed-output derivation '.*-x2\\.drv'"
|
<<<"$out" grepQuiet -vE "hash mismatch in fixed-output derivation '.*-x2\\.drv'"
|
||||||
|
<<<"$out" grepQuiet -E "likely URL: https://meow.puppy.forge/puppy.tar.gz"
|
||||||
|
<<<"$out" grepQuiet -vE "likely URL: https://kitty.forge/cat.tar.gz"
|
||||||
<<<"$out" grepQuiet -E "error: build of '.*-x[1-4]\\.drv\\^out', '.*-x[1-4]\\.drv\\^out', '.*-x[1-4]\\.drv\\^out', '.*-x[1-4]\\.drv\\^out' failed"
|
<<<"$out" grepQuiet -E "error: build of '.*-x[1-4]\\.drv\\^out', '.*-x[1-4]\\.drv\\^out', '.*-x[1-4]\\.drv\\^out', '.*-x[1-4]\\.drv\\^out' failed"
|
||||||
|
|
||||||
out="$(nix build -f fod-failing.nix -L x1 x2 x3 --keep-going 2>&1)" && status=0 || status=$?
|
out="$(nix build -f fod-failing.nix -L x1 x2 x3 --keep-going 2>&1)" && status=0 || status=$?
|
||||||
|
@ -151,6 +153,9 @@ test "$(<<<"$out" grep -E '^error:' | wc -l)" = 4
|
||||||
<<<"$out" grepQuiet -E "hash mismatch in fixed-output derivation '.*-x1\\.drv'"
|
<<<"$out" grepQuiet -E "hash mismatch in fixed-output derivation '.*-x1\\.drv'"
|
||||||
<<<"$out" grepQuiet -E "hash mismatch in fixed-output derivation '.*-x3\\.drv'"
|
<<<"$out" grepQuiet -E "hash mismatch in fixed-output derivation '.*-x3\\.drv'"
|
||||||
<<<"$out" grepQuiet -E "hash mismatch in fixed-output derivation '.*-x2\\.drv'"
|
<<<"$out" grepQuiet -E "hash mismatch in fixed-output derivation '.*-x2\\.drv'"
|
||||||
|
<<<"$out" grepQuiet -E "likely URL: https://meow.puppy.forge/puppy.tar.gz"
|
||||||
|
<<<"$out" grepQuiet -E "likely URL: https://kitty.forge/cat.tar.gz"
|
||||||
|
<<<"$out" grepQuiet -E "likely URL: \(unknown\)"
|
||||||
<<<"$out" grepQuiet -E "error: build of '.*-x[1-3]\\.drv\\^out', '.*-x[1-3]\\.drv\\^out', '.*-x[1-3]\\.drv\\^out' failed"
|
<<<"$out" grepQuiet -E "error: build of '.*-x[1-3]\\.drv\\^out', '.*-x[1-3]\\.drv\\^out', '.*-x[1-3]\\.drv\\^out' failed"
|
||||||
|
|
||||||
out="$(nix build -f fod-failing.nix -L x4 2>&1)" && status=0 || status=$?
|
out="$(nix build -f fod-failing.nix -L x4 2>&1)" && status=0 || status=$?
|
||||||
|
|
|
@ -6,6 +6,7 @@ rec {
|
||||||
''
|
''
|
||||||
echo $name > $out
|
echo $name > $out
|
||||||
'';
|
'';
|
||||||
|
url = "https://meow.puppy.forge/puppy.tar.gz";
|
||||||
outputHashMode = "recursive";
|
outputHashMode = "recursive";
|
||||||
outputHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
outputHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||||
};
|
};
|
||||||
|
@ -15,6 +16,7 @@ rec {
|
||||||
''
|
''
|
||||||
echo $name > $out
|
echo $name > $out
|
||||||
'';
|
'';
|
||||||
|
urls = "https://kitty.forge/cat.tar.gz";
|
||||||
outputHashMode = "recursive";
|
outputHashMode = "recursive";
|
||||||
outputHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
outputHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue