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:
jade
2024-07-01 16:11:32 +00:00
committed by Gerrit Code Review
6 changed files with 40 additions and 19 deletions
+4 -1
View File
@@ -2546,9 +2546,12 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
/* Throw an error after registering the path as
valid. */
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(
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),
guessedUrl,
wanted.to_string(SRI, true),
got.to_string(SRI, true)));
}
+13 -15
View File
@@ -321,22 +321,20 @@ Roots LocalStore::findRoots(bool censor)
void LocalStore::findPlatformRoots(UncheckedRoots & unchecked)
{
// lsof is really slow on OS X. This actually causes the gc-concurrent.sh test to fail.
// See: https://github.com/NixOS/nix/issues/3011
// Because of this we disable lsof when running the tests.
if (getEnv("_NIX_TEST_NO_LSOF") != "1") {
try {
std::regex lsofRegex(R"(^n(/.*)$)");
auto lsofLines =
tokenizeString<std::vector<std::string>>(runProgram(LSOF, true, { "-n", "-w", "-F", "n" }), "\n");
for (const auto & line : lsofLines) {
std::smatch match;
if (std::regex_match(line, match, lsofRegex))
unchecked[match[1]].emplace("{lsof}");
}
} catch (ExecError & e) {
/* lsof not installed, lsof failed */
// N.B. This is (read: undertested!) fallback code only used for
// non-Darwin, non-Linux platforms. Both major platforms have
// platform-specific code in src/libstore/platform/
try {
std::regex lsofRegex(R"(^n(/.*)$)");
auto lsofLines =
tokenizeString<std::vector<std::string>>(runProgram(LSOF, true, { "-n", "-w", "-F", "n" }), "\n");
for (const auto & line : lsofLines) {
std::smatch match;
if (std::regex_match(line, match, lsofRegex))
unchecked[match[1]].emplace("{lsof}");
}
} catch (ExecError & e) {
/* lsof not installed, lsof failed */
}
}