treewide: turn nix::warn into a macro
we add two variants: one that just prints a message at the warning level (mirroring the other printer macros), and one that also adds the colored "warning: " prefix the function added. since there are no overriders of this function in tree it looks safe to remove it. Change-Id: I7008fd0f31d59fbc9259472e29359c8df19ff87d
This commit is contained in:
@@ -23,7 +23,7 @@ static int main_nix_copy_closure(AsyncIoRoot & aio, std::string programName, Str
|
||||
printVersion("nix-copy-closure");
|
||||
else if (*arg == "--gzip" || *arg == "--bzip2" || *arg == "--xz") {
|
||||
if (*arg != "--gzip")
|
||||
warn("'%1%' is not implemented, falling back to gzip", *arg);
|
||||
printTaggedWarning("'%1%' is not implemented, falling back to gzip", *arg);
|
||||
gzip = true;
|
||||
} else if (*arg == "--from")
|
||||
toMode = false;
|
||||
|
||||
@@ -317,9 +317,9 @@ std::vector<Match> pickNewestOnly(EvalState & state, std::vector<Match> matches)
|
||||
matches.clear();
|
||||
for (auto & [name, match] : newest) {
|
||||
if (multiple.find(name) != multiple.end())
|
||||
warn(
|
||||
"there are multiple derivations named '%1%'; using the first one",
|
||||
name);
|
||||
printTaggedWarning(
|
||||
"there are multiple derivations named '%1%'; using the first one", name
|
||||
);
|
||||
matches.push_back(match);
|
||||
}
|
||||
|
||||
@@ -845,7 +845,7 @@ static void uninstallDerivations(Globals & globals, Strings & selectors,
|
||||
);
|
||||
}
|
||||
if (split == workingElems.end())
|
||||
warn("selector '%s' matched no installed derivations", selector);
|
||||
printTaggedWarning("selector '%s' matched no installed derivations", selector);
|
||||
for (auto removedElem = split; removedElem != workingElems.end(); removedElem++) {
|
||||
printInfo("uninstalling '%s'", removedElem->queryName(*state));
|
||||
}
|
||||
|
||||
@@ -826,7 +826,7 @@ opVerify(std::shared_ptr<Store> store, AsyncIoRoot & aio, Strings opFlags, Strin
|
||||
else throw UsageError("unknown flag '%1%'", i);
|
||||
|
||||
if (aio.blockOn(store->verifyStore(checkContents, repair))) {
|
||||
warn("not all store errors were fixed");
|
||||
printTaggedWarning("not all store errors were fixed");
|
||||
throw Exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ MixFlakeOptions::MixFlakeOptions()
|
||||
.category = category,
|
||||
.handler = {[&]() {
|
||||
lockFlags.useRegistries = false;
|
||||
warn("'--no-registries' is deprecated; use '--no-use-registries'");
|
||||
printTaggedWarning("'--no-registries' is deprecated; use '--no-use-registries'");
|
||||
}}
|
||||
});
|
||||
|
||||
@@ -344,7 +344,7 @@ void completeFlakeRefWithFragment(
|
||||
}
|
||||
}
|
||||
} catch (Error & e) {
|
||||
warn(e.msg());
|
||||
printTaggedWarning(e.msg());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -244,8 +244,7 @@ void ReadlineLikeInteracter::writeHistory()
|
||||
// them so the user isn't confused why their history is getting eaten.
|
||||
|
||||
std::string_view const errMsg(std::strerror(writeHistErr));
|
||||
warn("ignoring error writing repl history to %s: %s", this->historyFile, errMsg);
|
||||
|
||||
printTaggedWarning("ignoring error writing repl history to %s: %s", this->historyFile, errMsg);
|
||||
}
|
||||
|
||||
ReadlineLikeInteracter::~ReadlineLikeInteracter()
|
||||
|
||||
+1
-1
@@ -2591,7 +2591,7 @@ void Evaluator::maybePrintStats()
|
||||
// Make the final heap size more deterministic.
|
||||
#if HAVE_BOEHMGC
|
||||
if (!fullGC()) {
|
||||
warn("failed to perform a full GC before reporting stats");
|
||||
printTaggedWarning("failed to perform a full GC before reporting stats");
|
||||
}
|
||||
#endif
|
||||
printStatistics();
|
||||
|
||||
@@ -41,14 +41,24 @@ static bool askForSetting(
|
||||
auto reply = logger->ask(fmt("Do you want to allow configuration setting '%s' to be set to '" ANSI_RED "%s" ANSI_NORMAL "'?\nThis may allow the flake to gain root, see the nix.conf manual page (" ANSI_BOLD "y" ANSI_NORMAL "es/" ANSI_BOLD "n" ANSI_NORMAL "o/" ANSI_BOLD "N" ANSI_NORMAL "o to all) ", name, valueS)).value_or('n');
|
||||
|
||||
if (reply == 'N') {
|
||||
warn("Rejecting all untrusted nix.conf entries");
|
||||
warn("you can set '%s' to '%b' to automatically reject configuration options supplied by flakes", "accept-flake-config", false);
|
||||
printTaggedWarning("Rejecting all untrusted nix.conf entries");
|
||||
printTaggedWarning(
|
||||
"you can set '%s' to '%b' to automatically reject configuration options supplied by "
|
||||
"flakes",
|
||||
"accept-flake-config",
|
||||
false
|
||||
);
|
||||
negativeTrustOverride = true;
|
||||
} else {
|
||||
if (std::tolower(reply) == 'y') {
|
||||
trusted = true;
|
||||
} else {
|
||||
warn("you can set '%s' to '%b' to automatically reject configuration options supplied by flakes", "accept-flake-config", false);
|
||||
printTaggedWarning(
|
||||
"you can set '%s' to '%b' to automatically reject configuration options supplied "
|
||||
"by flakes",
|
||||
"accept-flake-config",
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
if (std::tolower(logger->ask(fmt("do you want to permanently (in %s) mark this value as %s? (y/N) ", trustedListPath(), trusted ? "trusted": "untrusted" )).value_or('n')) == 'y') {
|
||||
@@ -117,7 +127,12 @@ void ConfigFile::apply()
|
||||
debug("accepting trusted flake configuration setting '%s'", name);
|
||||
globalConfig.set(name, valueS);
|
||||
} else {
|
||||
warn("ignoring untrusted flake configuration setting '%s', pass '%s' to trust it (may allow the flake to gain root, see the nix.conf manual page)", name, "--accept-flake-config");
|
||||
printTaggedWarning(
|
||||
"ignoring untrusted flake configuration setting '%s', pass '%s' to trust it (may "
|
||||
"allow the flake to gain root, see the nix.conf manual page)",
|
||||
name,
|
||||
"--accept-flake-config"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+36
-11
@@ -555,9 +555,11 @@ LockedFlake lockFlake(
|
||||
auto follow = inputPath2.back();
|
||||
inputPath2.pop_back();
|
||||
if (inputPath2 == inputPathPrefix && !flakeInputs.count(follow))
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"input '%s' has an override for a non-existent input '%s'",
|
||||
printInputPath(inputPathPrefix), follow);
|
||||
printInputPath(inputPathPrefix),
|
||||
follow
|
||||
);
|
||||
}
|
||||
|
||||
/* Go over the flake inputs, resolve/fetch them if
|
||||
@@ -768,12 +770,17 @@ LockedFlake lockFlake(
|
||||
|
||||
for (auto & i : lockFlags.inputOverrides)
|
||||
if (!overridesUsed.count(i.first))
|
||||
warn("the flag '--override-input %s %s' does not match any input",
|
||||
printInputPath(i.first), i.second);
|
||||
printTaggedWarning(
|
||||
"the flag '--override-input %s %s' does not match any input",
|
||||
printInputPath(i.first),
|
||||
i.second
|
||||
);
|
||||
|
||||
for (auto & i : lockFlags.inputUpdates)
|
||||
if (!updatesUsed.count(i))
|
||||
warn("'%s' does not match any input of this flake", printInputPath(i));
|
||||
printTaggedWarning(
|
||||
"'%s' does not match any input of this flake", printInputPath(i)
|
||||
);
|
||||
|
||||
/* Check 'follows' inputs. */
|
||||
newLockFile.check();
|
||||
@@ -791,7 +798,12 @@ LockedFlake lockFlake(
|
||||
if (sourcePath || lockFlags.outputLockFilePath) {
|
||||
if (auto unlockedInput = newLockFile.isUnlocked()) {
|
||||
if (fetchSettings.warnDirty)
|
||||
warn("will not write lock file of flake '%s' because it has an unlocked input ('%s')", topRef, *unlockedInput);
|
||||
printTaggedWarning(
|
||||
"will not write lock file of flake '%s' because it has an unlocked "
|
||||
"input ('%s')",
|
||||
topRef,
|
||||
*unlockedInput
|
||||
);
|
||||
} else {
|
||||
if (!lockFlags.updateLockFile)
|
||||
throw Error("flake '%s' requires lock file changes but they're not allowed due to '--no-update-lock-file'", topRef);
|
||||
@@ -811,11 +823,19 @@ LockedFlake lockFlake(
|
||||
auto s = chomp(diff);
|
||||
if (lockFileExists) {
|
||||
if (s.empty())
|
||||
warn("updating lock file '%s'", outputLockFilePath);
|
||||
printTaggedWarning(
|
||||
"updating lock file '%s'", outputLockFilePath
|
||||
);
|
||||
else
|
||||
warn("updating lock file '%s':\n%s", outputLockFilePath, Uncolored(s));
|
||||
printTaggedWarning(
|
||||
"updating lock file '%s':\n%s",
|
||||
outputLockFilePath,
|
||||
Uncolored(s)
|
||||
);
|
||||
} else
|
||||
warn("creating lock file '%s':\n%s", outputLockFilePath, Uncolored(s));
|
||||
printTaggedWarning(
|
||||
"creating lock file '%s':\n%s", outputLockFilePath, Uncolored(s)
|
||||
);
|
||||
|
||||
std::optional<std::string> commitMessage = std::nullopt;
|
||||
|
||||
@@ -848,7 +868,10 @@ LockedFlake lockFlake(
|
||||
if (lockFlags.commitLockFile &&
|
||||
flake.lockedRef.input.getRev() &&
|
||||
prevLockedRef.input.getRev() != flake.lockedRef.input.getRev())
|
||||
warn("committed new revision '%s'", flake.lockedRef.input.getRev()->gitRev());
|
||||
printTaggedWarning(
|
||||
"committed new revision '%s'",
|
||||
flake.lockedRef.input.getRev()->gitRev()
|
||||
);
|
||||
|
||||
/* Make sure that we picked up the change,
|
||||
i.e. the tree should usually be dirty
|
||||
@@ -861,7 +884,9 @@ LockedFlake lockFlake(
|
||||
} else
|
||||
throw Error("cannot write modified lock file of flake '%s' (use '--no-write-lock-file' to ignore)", topRef);
|
||||
} else {
|
||||
warn("not writing modified lock file of flake '%s':\n%s", topRef, chomp(diff));
|
||||
printTaggedWarning(
|
||||
"not writing modified lock file of flake '%s':\n%s", topRef, chomp(diff)
|
||||
);
|
||||
flake.forceDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
+36
-7
@@ -906,18 +906,47 @@ drvName, Bindings * attrs, Value & v)
|
||||
}
|
||||
|
||||
if (i->name == state.ctx.s.allowedReferences)
|
||||
warn("In a derivation named '%s', 'structuredAttrs' disables the effect of the derivation attribute 'allowedReferences'; use 'outputChecks.<output>.allowedReferences' instead", drvName);
|
||||
printTaggedWarning(
|
||||
"In a derivation named '%s', 'structuredAttrs' disables the effect of "
|
||||
"the derivation attribute 'allowedReferences'; use "
|
||||
"'outputChecks.<output>.allowedReferences' instead",
|
||||
drvName
|
||||
);
|
||||
if (i->name == state.ctx.s.allowedRequisites)
|
||||
warn("In a derivation named '%s', 'structuredAttrs' disables the effect of the derivation attribute 'allowedRequisites'; use 'outputChecks.<output>.allowedRequisites' instead", drvName);
|
||||
printTaggedWarning(
|
||||
"In a derivation named '%s', 'structuredAttrs' disables the effect of "
|
||||
"the derivation attribute 'allowedRequisites'; use "
|
||||
"'outputChecks.<output>.allowedRequisites' instead",
|
||||
drvName
|
||||
);
|
||||
if (i->name == state.ctx.s.disallowedReferences)
|
||||
warn("In a derivation named '%s', 'structuredAttrs' disables the effect of the derivation attribute 'disallowedReferences'; use 'outputChecks.<output>.disallowedReferences' instead", drvName);
|
||||
printTaggedWarning(
|
||||
"In a derivation named '%s', 'structuredAttrs' disables the effect of "
|
||||
"the derivation attribute 'disallowedReferences'; use "
|
||||
"'outputChecks.<output>.disallowedReferences' instead",
|
||||
drvName
|
||||
);
|
||||
if (i->name == state.ctx.s.disallowedRequisites)
|
||||
warn("In a derivation named '%s', 'structuredAttrs' disables the effect of the derivation attribute 'disallowedRequisites'; use 'outputChecks.<output>.disallowedRequisites' instead", drvName);
|
||||
printTaggedWarning(
|
||||
"In a derivation named '%s', 'structuredAttrs' disables the effect of "
|
||||
"the derivation attribute 'disallowedRequisites'; use "
|
||||
"'outputChecks.<output>.disallowedRequisites' instead",
|
||||
drvName
|
||||
);
|
||||
if (i->name == state.ctx.s.maxSize)
|
||||
warn("In a derivation named '%s', 'structuredAttrs' disables the effect of the derivation attribute 'maxSize'; use 'outputChecks.<output>.maxSize' instead", drvName);
|
||||
printTaggedWarning(
|
||||
"In a derivation named '%s', 'structuredAttrs' disables the effect of "
|
||||
"the derivation attribute 'maxSize'; use "
|
||||
"'outputChecks.<output>.maxSize' instead",
|
||||
drvName
|
||||
);
|
||||
if (i->name == state.ctx.s.maxClosureSize)
|
||||
warn("In a derivation named '%s', 'structuredAttrs' disables the effect of the derivation attribute 'maxClosureSize'; use 'outputChecks.<output>.maxClosureSize' instead", drvName);
|
||||
|
||||
printTaggedWarning(
|
||||
"In a derivation named '%s', 'structuredAttrs' disables the effect of "
|
||||
"the derivation attribute 'maxClosureSize'; use "
|
||||
"'outputChecks.<output>.maxClosureSize' instead",
|
||||
drvName
|
||||
);
|
||||
|
||||
} else {
|
||||
auto s = state.coerceToString(noPos, *i->value, context, context_below, StringCoercionMode::ToString).toOwned();
|
||||
|
||||
@@ -45,7 +45,7 @@ struct CacheImpl : Cache
|
||||
try {
|
||||
createDirs(dirOf(dbPath));
|
||||
} catch (SysError const & ex) {
|
||||
warn("ignoring error initializing Lix fetcher cache: %s", ex.what());
|
||||
printTaggedWarning("ignoring error initializing Lix fetcher cache: %s", ex.what());
|
||||
dbPath = ":memory:";
|
||||
}
|
||||
|
||||
|
||||
+25
-8
@@ -134,7 +134,11 @@ std::optional<std::string> readHeadCached(const std::string & actualUrl)
|
||||
// fails, it falls back to continuing with the most recent version.
|
||||
// This function must behave the same way, so we return the expired
|
||||
// cached ref here.
|
||||
warn("could not get HEAD ref for repository '%s'; using expired cached ref '%s'", actualUrl, *cachedRef);
|
||||
printTaggedWarning(
|
||||
"could not get HEAD ref for repository '%s'; using expired cached ref '%s'",
|
||||
actualUrl,
|
||||
*cachedRef
|
||||
);
|
||||
return cachedRef;
|
||||
}
|
||||
|
||||
@@ -225,8 +229,9 @@ try {
|
||||
if (!fetchSettings.allowDirty)
|
||||
throw Error("Git tree '%s' is dirty", workdir);
|
||||
|
||||
if (fetchSettings.warnDirty)
|
||||
warn("Git tree '%s' is dirty", workdir);
|
||||
if (fetchSettings.warnDirty) {
|
||||
printTaggedWarning("Git tree '%s' is dirty", workdir);
|
||||
}
|
||||
|
||||
auto gitOpts = Strings({ "-C", workdir, "--git-dir", gitDir, "ls-files", "-z" });
|
||||
if (submodules)
|
||||
@@ -544,7 +549,9 @@ struct GitInputScheme : InputScheme
|
||||
if (!input.getRef()) {
|
||||
auto head = readHead(actualUrl);
|
||||
if (!head) {
|
||||
warn("could not read HEAD ref from repo at '%s', using 'master'", actualUrl);
|
||||
printTaggedWarning(
|
||||
"could not read HEAD ref from repo at '%s', using 'master'", actualUrl
|
||||
);
|
||||
head = "master";
|
||||
}
|
||||
input.attrs.insert_or_assign("ref", *head);
|
||||
@@ -561,7 +568,9 @@ struct GitInputScheme : InputScheme
|
||||
if (useHeadRef) {
|
||||
auto head = readHeadCached(actualUrl);
|
||||
if (!head) {
|
||||
warn("could not read HEAD ref from repo at '%s', using 'master'", actualUrl);
|
||||
printTaggedWarning(
|
||||
"could not read HEAD ref from repo at '%s', using 'master'", actualUrl
|
||||
);
|
||||
head = "master";
|
||||
}
|
||||
input.attrs.insert_or_assign("ref", *head);
|
||||
@@ -685,13 +694,21 @@ struct GitInputScheme : InputScheme
|
||||
}, true);
|
||||
} catch (Error & e) {
|
||||
if (!pathExists(localRefFile)) throw;
|
||||
warn("could not update local clone of Git repository '%s'; continuing with the most recent version", actualUrl);
|
||||
printTaggedWarning(
|
||||
"could not update local clone of Git repository '%s'; continuing with the "
|
||||
"most recent version",
|
||||
actualUrl
|
||||
);
|
||||
}
|
||||
|
||||
if (!touchCacheFile(localRefFile, now))
|
||||
warn("could not update mtime for file '%s': %s", localRefFile, strerror(errno));
|
||||
printTaggedWarning(
|
||||
"could not update mtime for file '%s': %s", localRefFile, strerror(errno)
|
||||
);
|
||||
if (useHeadRef && !storeCachedHead(actualUrl, *input.getRef()))
|
||||
warn("could not update cached head '%s' for '%s'", *input.getRef(), actualUrl);
|
||||
printTaggedWarning(
|
||||
"could not update cached head '%s' for '%s'", *input.getRef(), actualUrl
|
||||
);
|
||||
}
|
||||
|
||||
if (!input.getRev())
|
||||
|
||||
@@ -200,7 +200,7 @@ struct GitArchiveInputScheme : InputScheme
|
||||
if (hdr)
|
||||
headers.push_back(*hdr);
|
||||
else
|
||||
warn("Unrecognized access token for host '%s'", host);
|
||||
printTaggedWarning("Unrecognized access token for host '%s'", host);
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
@@ -345,7 +345,7 @@ struct GitLabInputScheme : GitArchiveInputScheme
|
||||
return std::make_pair("Authorization", fmt("Bearer %s", token.substr(fldsplit+1)));
|
||||
if ("PAT" == token.substr(0, fldsplit))
|
||||
return std::make_pair("Private-token", token.substr(fldsplit+1));
|
||||
warn("Unrecognized GitLab token type %s", token.substr(0, fldsplit));
|
||||
printTaggedWarning("Unrecognized GitLab token type %s", token.substr(0, fldsplit));
|
||||
return std::make_pair(token.substr(0,fldsplit), token.substr(fldsplit+1));
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ struct MercurialInputScheme : InputScheme
|
||||
throw Error("Mercurial tree '%s' is unclean", actualUrl);
|
||||
|
||||
if (fetchSettings.warnDirty)
|
||||
warn("Mercurial tree '%s' is unclean", actualUrl);
|
||||
printTaggedWarning("Mercurial tree '%s' is unclean", actualUrl);
|
||||
|
||||
input.attrs.insert_or_assign("ref", chomp(runHg({ "branch", "-R", actualUrl })));
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ std::shared_ptr<Registry> Registry::read(
|
||||
|
||||
if (!pathExists(path)) {
|
||||
if (type == RegistryType::Global) {
|
||||
warn("cannot read flake registry '%s': path does not exist", path);
|
||||
printTaggedWarning("cannot read flake registry '%s': path does not exist", path);
|
||||
}
|
||||
return std::make_shared<Registry>(type);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ std::shared_ptr<Registry> Registry::read(
|
||||
throw Error("flake registry '%s' has unsupported version %d", path, version);
|
||||
|
||||
} catch (Error & e) {
|
||||
warn("cannot read flake registry '%s': %s", path, e.what());
|
||||
printTaggedWarning("cannot read flake registry '%s': %s", path, e.what());
|
||||
}
|
||||
|
||||
return registry;
|
||||
@@ -170,7 +170,7 @@ try {
|
||||
*lk = Registry::read(settings.nixDataDir + "/flake-registry.json", Registry::Global);
|
||||
} else {
|
||||
if (!path.starts_with("/")) {
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"config option flake-registry referring to a URL is deprecated and will be "
|
||||
"removed in Lix 3.0; yours is: `%s'",
|
||||
path
|
||||
|
||||
@@ -90,7 +90,7 @@ try {
|
||||
data = TRY_AWAIT(content->drain());
|
||||
} catch (FileTransferError & e) {
|
||||
if (cached) {
|
||||
warn("%s; using cached version", e.msg());
|
||||
printTaggedWarning("%s; using cached version", e.msg());
|
||||
co_return useCached();
|
||||
} else
|
||||
throw;
|
||||
|
||||
@@ -41,8 +41,9 @@ MixCommonArgs::MixCommonArgs(const std::string & programName)
|
||||
try {
|
||||
globalConfig.set(name, value);
|
||||
} catch (UsageError & e) {
|
||||
if (!getRoot().completions)
|
||||
warn(e.what());
|
||||
if (!getRoot().completions) {
|
||||
printTaggedWarning(e.what());
|
||||
}
|
||||
}
|
||||
}},
|
||||
.completer = [](AddCompletions & completions, size_t index, std::string_view prefix) {
|
||||
|
||||
@@ -41,7 +41,7 @@ void printGCWarning()
|
||||
static bool haveWarned = false;
|
||||
if (!haveWarned) {
|
||||
haveWarned = true;
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"you did not specify '--add-root'; "
|
||||
"the result might be removed by the garbage collector"
|
||||
);
|
||||
|
||||
@@ -208,7 +208,7 @@ try {
|
||||
// instead.
|
||||
// NOLINTNEXTLINE(lix-foreign-exceptions): see above
|
||||
} catch (JSON::exception & exc) {
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"Skipping NAR listing for path '%1%' due to serialization failure: %2%",
|
||||
printStorePath(narInfo->path),
|
||||
exc.what()
|
||||
|
||||
@@ -470,7 +470,7 @@ try {
|
||||
auto nixBuildsTmp = createTempDir(
|
||||
globalTmp, fmt("nix-builds-%s", geteuid()), false, false, toplevelDirMode
|
||||
);
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"Failed to use the system-wide build directory '%s', falling back to a temporary "
|
||||
"directory inside '%s'",
|
||||
settings.buildDir.get(),
|
||||
@@ -949,7 +949,7 @@ void LocalDerivationGoal::setupConfiguredCertificateAuthority()
|
||||
if (std::find(impureVars.begin(), impureVars.end(), "NIX_SSL_CERT_FILE") != impureVars.end()
|
||||
&& env["NIX_SSL_CERT_FILE"] != settings.caFile)
|
||||
{
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"'NIX_SSL_CERT_FILE' is an impure environment variable of this "
|
||||
"derivation but a *DIFFERENT* `ssl-cert-file` was set in the settings "
|
||||
"which takes precedence.\n"
|
||||
@@ -975,7 +975,7 @@ void LocalDerivationGoal::setupConfiguredCertificateAuthority()
|
||||
} else if (pathExists(settings.caFile)) {
|
||||
// The path exist but we were not able to access it. This is not a fatal
|
||||
// error, warn about this so the user can remediate.
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"Configured certificate authority '%1' exists but is inaccessible, it "
|
||||
"will not be copied in the sandbox. TLS operations inside the sandbox may "
|
||||
"be non-functional.",
|
||||
@@ -1242,7 +1242,7 @@ void LocalDerivationGoal::runChild()
|
||||
} else if (pathExists(path)) {
|
||||
// The path exist but we were not able to access it. This is not a fatal
|
||||
// error, warn about this so the user can remediate.
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"'%1%' exists but is inaccessible, it will not be copied in the "
|
||||
"sandbox",
|
||||
path
|
||||
@@ -1255,7 +1255,7 @@ void LocalDerivationGoal::runChild()
|
||||
} else if (pathExists("/etc/resolv.conf")) {
|
||||
// The path exist but we were not able to access it. This is not a fatal error,
|
||||
// warn about this so the user can remediate.
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"'/etc/resolv.conf' exists but is inaccessible, it will not be rewritten "
|
||||
"inside the sandbox; DNS operations inside the sandbox may be "
|
||||
"non-functional."
|
||||
@@ -2461,22 +2461,40 @@ try {
|
||||
|
||||
if (auto structuredAttrs = parsedDrv->getStructuredAttrs()) {
|
||||
if (get(*structuredAttrs, "allowedReferences")){
|
||||
warn("'structuredAttrs' disables the effect of the top-level attribute 'allowedReferences'; use 'outputChecks' instead");
|
||||
printTaggedWarning(
|
||||
"'structuredAttrs' disables the effect of the top-level attribute "
|
||||
"'allowedReferences'; use 'outputChecks' instead"
|
||||
);
|
||||
}
|
||||
if (get(*structuredAttrs, "allowedRequisites")){
|
||||
warn("'structuredAttrs' disables the effect of the top-level attribute 'allowedRequisites'; use 'outputChecks' instead");
|
||||
printTaggedWarning(
|
||||
"'structuredAttrs' disables the effect of the top-level attribute "
|
||||
"'allowedRequisites'; use 'outputChecks' instead"
|
||||
);
|
||||
}
|
||||
if (get(*structuredAttrs, "disallowedRequisites")){
|
||||
warn("'structuredAttrs' disables the effect of the top-level attribute 'disallowedRequisites'; use 'outputChecks' instead");
|
||||
printTaggedWarning(
|
||||
"'structuredAttrs' disables the effect of the top-level attribute "
|
||||
"'disallowedRequisites'; use 'outputChecks' instead"
|
||||
);
|
||||
}
|
||||
if (get(*structuredAttrs, "disallowedReferences")){
|
||||
warn("'structuredAttrs' disables the effect of the top-level attribute 'disallowedReferences'; use 'outputChecks' instead");
|
||||
printTaggedWarning(
|
||||
"'structuredAttrs' disables the effect of the top-level attribute "
|
||||
"'disallowedReferences'; use 'outputChecks' instead"
|
||||
);
|
||||
}
|
||||
if (get(*structuredAttrs, "maxSize")){
|
||||
warn("'structuredAttrs' disables the effect of the top-level attribute 'maxSize'; use 'outputChecks' instead");
|
||||
printTaggedWarning(
|
||||
"'structuredAttrs' disables the effect of the top-level attribute 'maxSize'; "
|
||||
"use 'outputChecks' instead"
|
||||
);
|
||||
}
|
||||
if (get(*structuredAttrs, "maxClosureSize")){
|
||||
warn("'structuredAttrs' disables the effect of the top-level attribute 'maxClosureSize'; use 'outputChecks' instead");
|
||||
printTaggedWarning(
|
||||
"'structuredAttrs' disables the effect of the top-level attribute "
|
||||
"'maxClosureSize'; use 'outputChecks' instead"
|
||||
);
|
||||
}
|
||||
if (auto outputChecks = get(*structuredAttrs, "outputChecks")) {
|
||||
if (auto output = get(*outputChecks, outputName)) {
|
||||
|
||||
@@ -153,8 +153,12 @@ try {
|
||||
only after we've downloaded the path. */
|
||||
if (!sub->config().isTrusted && worker.store.pathInfoIsUntrusted(*info))
|
||||
{
|
||||
warn("ignoring substitute for '%s' from '%s', as it's not signed by any of the keys in 'trusted-public-keys'",
|
||||
worker.store.printStorePath(storePath), sub->getUri());
|
||||
printTaggedWarning(
|
||||
"ignoring substitute for '%s' from '%s', as it's not signed by any of the keys in "
|
||||
"'trusted-public-keys'",
|
||||
worker.store.printStorePath(storePath),
|
||||
sub->getUri()
|
||||
);
|
||||
co_return co_await tryNext();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,9 @@ static void createLinks(State & state, const Path & srcDir, const Path & dstDir,
|
||||
srcFiles = readDirectory(srcDir);
|
||||
} catch (SysError & e) {
|
||||
if (e.errNo == ENOTDIR) {
|
||||
warn("not including '%s' in the user environment because it's not a directory", srcDir);
|
||||
printTaggedWarning(
|
||||
"not including '%s' in the user environment because it's not a directory", srcDir
|
||||
);
|
||||
return;
|
||||
}
|
||||
throw;
|
||||
@@ -42,7 +44,7 @@ static void createLinks(State & state, const Path & srcDir, const Path & dstDir,
|
||||
throw SysError("getting status of '%1%'", srcFile);
|
||||
} catch (SysError & e) {
|
||||
if (e.errNo == ENOENT || e.errNo == ENOTDIR) {
|
||||
warn("skipping dangling symlink '%s'", dstFile);
|
||||
printTaggedWarning("skipping dangling symlink '%s'", dstFile);
|
||||
continue;
|
||||
}
|
||||
throw;
|
||||
|
||||
+17
-6
@@ -200,8 +200,12 @@ struct ClientSettings
|
||||
else if (!s.ends_with("/") && trusted.count(s + "/"))
|
||||
subs.push_back(s + "/");
|
||||
else
|
||||
warn("ignoring untrusted substituter '%s', you are not a trusted user.\n"
|
||||
"Run `man nix.conf` for more information on the `substituters` configuration option.", s);
|
||||
printTaggedWarning(
|
||||
"ignoring untrusted substituter '%s', you are not a trusted user.\n"
|
||||
"Run `man nix.conf` for more information on the `substituters` "
|
||||
"configuration option.",
|
||||
s
|
||||
);
|
||||
res.override(subs);
|
||||
return true;
|
||||
};
|
||||
@@ -217,8 +221,11 @@ struct ClientSettings
|
||||
debug("Ignoring the client-specified experimental features");
|
||||
} else if (name == settings.pluginFiles.name) {
|
||||
if (tokenizeString<Paths>(value) != settings.pluginFiles.get())
|
||||
warn("Ignoring the client-specified plugin-files.\n"
|
||||
"The client specifying plugins to the daemon never made sense, and was removed in Nix.");
|
||||
printTaggedWarning(
|
||||
"Ignoring the client-specified plugin-files.\n"
|
||||
"The client specifying plugins to the daemon never made sense, and was "
|
||||
"removed in Nix."
|
||||
);
|
||||
} else if (trusted || name == settings.buildTimeout.name
|
||||
|| name == settings.maxSilentTime.name
|
||||
|| name == settings.pollInterval.name
|
||||
@@ -230,9 +237,13 @@ struct ClientSettings
|
||||
} else if (setSubstituters(settings.substituters))
|
||||
;
|
||||
else
|
||||
warn("Ignoring the client-specified setting '%s', because it is a restricted setting and you are not a trusted user", name);
|
||||
printTaggedWarning(
|
||||
"Ignoring the client-specified setting '%s', because it is a restricted "
|
||||
"setting and you are not a trusted user",
|
||||
name
|
||||
);
|
||||
} catch (UsageError & e) {
|
||||
warn(e.what());
|
||||
printTaggedWarning(e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1037,7 +1037,7 @@ struct curlFileTransfer : public FileTransfer
|
||||
)
|
||||
try {
|
||||
if (totalReceived) {
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"%s; retrying from offset %d in %d ms (attempt %d/%d)",
|
||||
context,
|
||||
totalReceived,
|
||||
@@ -1046,7 +1046,9 @@ struct curlFileTransfer : public FileTransfer
|
||||
tries
|
||||
);
|
||||
} else {
|
||||
warn("%s; retrying in %d ms (attempt %d/%d)", context, waitTime, attempt, tries);
|
||||
printTaggedWarning(
|
||||
"%s; retrying in %d ms (attempt %d/%d)", context, waitTime, attempt, tries
|
||||
);
|
||||
}
|
||||
|
||||
co_await AIO().provider.getTimer().afterDelay(waitTime.count() * kj::MILLISECONDS);
|
||||
|
||||
@@ -386,7 +386,9 @@ void initPlugins()
|
||||
// inaccessible, since it is *already* the case that plugins
|
||||
// are not guaranteed to load due to version mismatches etc
|
||||
// causing dlopen failures.
|
||||
warn("could not access plugin file '%s', skipping it: %s", pluginFile, e.msg());
|
||||
printTaggedWarning(
|
||||
"could not access plugin file '%s', skipping it: %s", pluginFile, e.msg()
|
||||
);
|
||||
continue;
|
||||
}
|
||||
pluginFiles.emplace_back(pluginFile);
|
||||
@@ -397,7 +399,9 @@ void initPlugins()
|
||||
void *handle =
|
||||
dlopen(file.c_str(), RTLD_LAZY | RTLD_LOCAL);
|
||||
if (!handle) {
|
||||
warn("could not dynamically open plugin file '%s', skipping it: %s", file, dlerror());
|
||||
printTaggedWarning(
|
||||
"could not dynamically open plugin file '%s', skipping it: %s", file, dlerror()
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -447,8 +451,7 @@ static void preloadNSS()
|
||||
*
|
||||
* All other platforms are unaffected.
|
||||
*/
|
||||
if (!dlopen(LIBNSS_DNS_SO, RTLD_NOW))
|
||||
warn("unable to load nss_dns backend");
|
||||
if (!dlopen(LIBNSS_DNS_SO, RTLD_NOW)) printTaggedWarning("unable to load nss_dns backend");
|
||||
// FIXME: get hosts entry from nsswitch.conf.
|
||||
__nss_configure_lookup("hosts", "files dns");
|
||||
#endif
|
||||
|
||||
@@ -1576,7 +1576,7 @@ try {
|
||||
if (TRY_AWAIT(isValidPath(i)))
|
||||
logError(caught->info());
|
||||
else
|
||||
warn(caught->msg());
|
||||
printTaggedWarning(caught->msg());
|
||||
errors = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats,
|
||||
NixOS (example: $fontconfig/var/cache being modified). Skip
|
||||
those files. FIXME: check the modification time. */
|
||||
if (S_ISREG(st.st_mode) && (st.st_mode & S_IWUSR)) {
|
||||
warn("skipping suspicious writable file '%1%'", path);
|
||||
printTaggedWarning("skipping suspicious writable file '%1%'", path);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -162,9 +162,11 @@ void LocalStore::optimisePath_(Activity * act, OptimiseStats & stats,
|
||||
|| (repair && hash != hashPath(HashType::SHA256, linkPath).first))
|
||||
{
|
||||
// XXX: Consider overwriting linkPath with our valid version.
|
||||
warn("removing corrupted link '%s'", linkPath);
|
||||
warn("There may be more corrupted paths."
|
||||
"\nYou should run `nix-store --verify --check-contents --repair` to fix them all");
|
||||
printTaggedWarning("removing corrupted link '%s'", linkPath);
|
||||
printTaggedWarning(
|
||||
"There may be more corrupted paths."
|
||||
"\nYou should run `nix-store --verify --check-contents --repair` to fix them all"
|
||||
);
|
||||
if (unlink(linkPath.c_str()) == -1 && errno != ENOENT)
|
||||
throw SysError("cannot unlink '%1%'", linkPath);
|
||||
stLinkOpt.reset();
|
||||
|
||||
@@ -1383,7 +1383,11 @@ openFromNonUri(const std::string & uri, const StoreConfig::Params & params, Allo
|
||||
} catch (Error & e) {
|
||||
return LocalStore::makeLocalStore(params);
|
||||
}
|
||||
warn("'%s' does not exist, so Lix will use '%s' as a chroot store", stateDir, chrootStore);
|
||||
printTaggedWarning(
|
||||
"'%s' does not exist, so Lix will use '%s' as a chroot store",
|
||||
stateDir,
|
||||
chrootStore
|
||||
);
|
||||
} else
|
||||
debug("'%s' does not exist, so Lix will use '%s' as a chroot store", stateDir, chrootStore);
|
||||
StoreConfig::Params chrootStoreParams;
|
||||
|
||||
@@ -351,7 +351,7 @@ void AutoDestroyCgroup::destroy()
|
||||
[&, this](const Path & aliveCgroup) {
|
||||
auto maybeStats = destroyCgroup(name_, aliveCgroup);
|
||||
if (!maybeStats) {
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"cgroup '%s' was destroyed unexpectedly (something else removed the "
|
||||
"cgroup).",
|
||||
aliveCgroup
|
||||
@@ -390,7 +390,7 @@ void AutoDestroyCgroup::cleansePreviousInstancesAndRecordOurself(
|
||||
|
||||
if (pathExists(cgroupFile)) {
|
||||
auto prevCgroup = readFile(cgroupFile);
|
||||
warn("destroying past cgroup '%s' found in the state directory", name_);
|
||||
printTaggedWarning("destroying past cgroup '%s' found in the state directory", name_);
|
||||
destroyCgroup(fmt("past %s", name_), prevCgroup);
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,9 @@ struct NoneSink : CompressionSink
|
||||
NoneSink(Sink & nextSink, int level = COMPRESSION_LEVEL_DEFAULT) : nextSink(nextSink)
|
||||
{
|
||||
if (level != COMPRESSION_LEVEL_DEFAULT)
|
||||
warn("requested compression level '%d' not supported by compression method 'none'", level);
|
||||
printTaggedWarning(
|
||||
"requested compression level '%d' not supported by compression method 'none'", level
|
||||
);
|
||||
}
|
||||
void finish() override { flush(); }
|
||||
void writeUnbuffered(std::string_view data) override { nextSink(data); }
|
||||
|
||||
@@ -74,15 +74,17 @@ void BaseSetting<T>::set(const std::string & str, bool append, const ApplyConfig
|
||||
if (experimentalFeatureSettings.isEnabled(experimentalFeature)) {
|
||||
auto parsed = parse(str, options);
|
||||
if (deprecated && (append || parsed != value)) {
|
||||
warn("deprecated setting '%s' found (set to '%s')", name, str);
|
||||
printTaggedWarning("deprecated setting '%s' found (set to '%s')", name, str);
|
||||
}
|
||||
overridden = true;
|
||||
appendOrSet(std::move(parsed), append, options);
|
||||
} else {
|
||||
assert(experimentalFeature);
|
||||
warn("Ignoring setting '%s' because experimental feature '%s' is not enabled",
|
||||
printTaggedWarning(
|
||||
"Ignoring setting '%s' because experimental feature '%s' is not enabled",
|
||||
name,
|
||||
showExperimentalFeature(*experimentalFeature));
|
||||
showExperimentalFeature(*experimentalFeature)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,11 @@ void Config::addSetting(AbstractSetting * setting)
|
||||
for (auto & alias : setting->aliases) {
|
||||
if (auto i = unknownSettings.find(alias); i != unknownSettings.end()) {
|
||||
if (set)
|
||||
warn("setting '%s' is set, but it's an alias of '%s' which is also set",
|
||||
alias, setting->name);
|
||||
printTaggedWarning(
|
||||
"setting '%s' is set, but it's an alias of '%s' which is also set",
|
||||
alias,
|
||||
setting->name
|
||||
);
|
||||
else {
|
||||
setting->set(std::move(i->second));
|
||||
unknownSettings.erase(i);
|
||||
@@ -70,7 +73,7 @@ AbstractConfig::AbstractConfig(StringMap initials)
|
||||
void AbstractConfig::warnUnknownSettings()
|
||||
{
|
||||
for (const auto & s : unknownSettings)
|
||||
warn("unknown setting '%s'", s.first);
|
||||
printTaggedWarning("unknown setting '%s'", s.first);
|
||||
}
|
||||
|
||||
void AbstractConfig::reapplyUnknownSettings()
|
||||
@@ -349,7 +352,7 @@ template<> ExperimentalFeatures BaseSetting<ExperimentalFeatures>::parse(const s
|
||||
if (auto thisXpFeature = parseExperimentalFeature(s); thisXpFeature) {
|
||||
res = res | thisXpFeature.value();
|
||||
} else
|
||||
warn("unknown experimental feature '%s'", s);
|
||||
printTaggedWarning("unknown experimental feature '%s'", s);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -378,7 +381,7 @@ template<> DeprecatedFeatures BaseSetting<DeprecatedFeatures>::parse(const std::
|
||||
if (auto thisDpFeature = parseDeprecatedFeature(s); thisDpFeature)
|
||||
res = res | thisDpFeature.value();
|
||||
else
|
||||
warn("unknown deprecated feature '%s'", s);
|
||||
printTaggedWarning("unknown deprecated feature '%s'", s);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -794,7 +794,7 @@ void moveFile(const Path & oldName, const Path & newName)
|
||||
auto tempCopyTarget = temp / "copy-target";
|
||||
if (e.code().value() == EXDEV) {
|
||||
fs::remove(newPath);
|
||||
warn("Can’t rename %s as %s, copying instead", oldName, newName);
|
||||
printTaggedWarning("Can’t rename %s as %s, copying instead", oldName, newName);
|
||||
copy(fs::directory_entry(oldPath), tempCopyTarget, { .deleteAfter = true });
|
||||
renameFile(tempCopyTarget, newPath);
|
||||
}
|
||||
|
||||
+1
-1
@@ -265,7 +265,7 @@ Hash newHashAllowEmpty(std::string_view hashStr, std::optional<HashType> ht)
|
||||
if (!ht)
|
||||
throw BadHash("empty hash requires explicit hash type");
|
||||
Hash h(*ht);
|
||||
warn("found empty hash, assuming '%s'", h.to_string(Base::SRI, true));
|
||||
printTaggedWarning("found empty hash, assuming '%s'", h.to_string(Base::SRI, true));
|
||||
return h;
|
||||
} else
|
||||
return Hash::parseAny(hashStr, ht);
|
||||
|
||||
@@ -305,10 +305,8 @@ bool handleJSONLogMessage(JSON & json,
|
||||
|
||||
return true;
|
||||
} catch (JSON::exception &e) { // NOLINT(lix-foreign-exceptions)
|
||||
warn(
|
||||
"Unable to handle a JSON message from %s: %s",
|
||||
Uncolored(source),
|
||||
e.what()
|
||||
printTaggedWarning(
|
||||
"Unable to handle a JSON message from %s: %s", Uncolored(source), e.what()
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
+3
-10
@@ -266,6 +266,7 @@ extern Verbosity verbosity;
|
||||
} while (0)
|
||||
#define printMsg(level, args...) printMsgUsing(::nix::logger, level, args)
|
||||
|
||||
#define printWarning(args...) printMsg(::nix::lvlWarn, args)
|
||||
#define printError(args...) printMsg(::nix::lvlError, args)
|
||||
#define notice(args...) printMsg(::nix::lvlNotice, args)
|
||||
#define printInfo(args...) printMsg(::nix::lvlInfo, args)
|
||||
@@ -273,16 +274,8 @@ extern Verbosity verbosity;
|
||||
#define debug(args...) printMsg(::nix::lvlDebug, args)
|
||||
#define vomit(args...) printMsg(::nix::lvlVomit, args)
|
||||
|
||||
/**
|
||||
* if verbosity >= lvlWarn, print a message with a yellow 'warning:' prefix.
|
||||
*/
|
||||
template<typename... Args>
|
||||
inline void warn(const std::string & fs, const Args &... args)
|
||||
{
|
||||
logger->log(
|
||||
lvlWarn, fmt(ANSI_WARNING "warning:" ANSI_NORMAL " %1%", HintFmt(fs, args...).str())
|
||||
);
|
||||
}
|
||||
#define printTaggedWarning(args...) \
|
||||
printWarning(ANSI_WARNING "warning:" ANSI_NORMAL " %1%", ::nix::HintFmt(args).str())
|
||||
|
||||
void writeLogsToStderr(std::string_view s);
|
||||
|
||||
|
||||
@@ -71,21 +71,29 @@ void unshareFilesystem()
|
||||
static void diagnoseUserNamespaces()
|
||||
{
|
||||
if (!pathExists("/proc/self/ns/user")) {
|
||||
warn("'/proc/self/ns/user' does not exist; your kernel was likely built without CONFIG_USER_NS=y");
|
||||
printTaggedWarning(
|
||||
"'/proc/self/ns/user' does not exist; your kernel was likely built without "
|
||||
"CONFIG_USER_NS=y"
|
||||
);
|
||||
}
|
||||
|
||||
Path maxUserNamespaces = "/proc/sys/user/max_user_namespaces";
|
||||
if (!pathExists(maxUserNamespaces) ||
|
||||
trim(readFile(maxUserNamespaces)) == "0")
|
||||
{
|
||||
warn("user namespaces appear to be disabled; check '/proc/sys/user/max_user_namespaces'");
|
||||
printTaggedWarning(
|
||||
"user namespaces appear to be disabled; check '/proc/sys/user/max_user_namespaces'"
|
||||
);
|
||||
}
|
||||
|
||||
Path procSysKernelUnprivilegedUsernsClone = "/proc/sys/kernel/unprivileged_userns_clone";
|
||||
if (pathExists(procSysKernelUnprivilegedUsernsClone)
|
||||
&& trim(readFile(procSysKernelUnprivilegedUsernsClone)) == "0")
|
||||
{
|
||||
warn("user namespaces appear to be disabled for unprivileged users; check '/proc/sys/kernel/unprivileged_userns_clone'");
|
||||
printTaggedWarning(
|
||||
"user namespaces appear to be disabled for unprivileged users; check "
|
||||
"'/proc/sys/kernel/unprivileged_userns_clone'"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +107,7 @@ bool userNamespacesSupported()
|
||||
auto r = pid.wait();
|
||||
assert(!r);
|
||||
} catch (SysError & e) {
|
||||
warn("user namespaces do not work on this system: %s", e.msg());
|
||||
printTaggedWarning("user namespaces do not work on this system: %s", e.msg());
|
||||
diagnoseUserNamespaces();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ static void extract_archive(TarArchive & archive, const Path & destDir)
|
||||
if (!name)
|
||||
throw Error("cannot get archive member name: %s", archive_error_string(archive.archive));
|
||||
if (r == ARCHIVE_WARN)
|
||||
warn(archive_error_string(archive.archive));
|
||||
printTaggedWarning(archive_error_string(archive.archive));
|
||||
else
|
||||
archive.check(r);
|
||||
|
||||
|
||||
+12
-2
@@ -41,7 +41,12 @@ Path getHome()
|
||||
int result = stat(homeDir->c_str(), &st);
|
||||
if (result != 0) {
|
||||
if (errno != ENOENT) {
|
||||
warn("couldn't stat $HOME ('%s') for reason other than not existing ('%d'), falling back to the one defined in the 'passwd' file", *homeDir, errno);
|
||||
printTaggedWarning(
|
||||
"couldn't stat $HOME ('%s') for reason other than not existing ('%d'), "
|
||||
"falling back to the one defined in the 'passwd' file",
|
||||
*homeDir,
|
||||
errno
|
||||
);
|
||||
homeDir.reset();
|
||||
}
|
||||
} else if (st.st_uid != geteuid()) {
|
||||
@@ -51,7 +56,12 @@ Path getHome()
|
||||
if (!homeDir) {
|
||||
homeDir = getHomeOf(geteuid());
|
||||
if (unownedUserHomeDir.has_value() && unownedUserHomeDir != homeDir) {
|
||||
warn("$HOME ('%s') is not owned by you, falling back to the one defined in the 'passwd' file ('%s')", *unownedUserHomeDir, *homeDir);
|
||||
printTaggedWarning(
|
||||
"$HOME ('%s') is not owned by you, falling back to the one defined in the "
|
||||
"'passwd' file ('%s')",
|
||||
*unownedUserHomeDir,
|
||||
*homeDir
|
||||
);
|
||||
}
|
||||
}
|
||||
return *homeDir;
|
||||
|
||||
+5
-1
@@ -367,7 +367,11 @@ struct Common : InstallableCommand, MixProfile
|
||||
for (auto & path: builtPaths) {
|
||||
auto from = store->printStorePath(path);
|
||||
if (script.find(from) == std::string::npos)
|
||||
warn("'%s' (path '%s') is not used by this build environment", installable->what(), from);
|
||||
printTaggedWarning(
|
||||
"'%s' (path '%s') is not used by this build environment",
|
||||
installable->what(),
|
||||
from
|
||||
);
|
||||
else {
|
||||
printInfo("redirecting '%s' to '%s'", from, dir);
|
||||
rewrites.insert({from, dir});
|
||||
|
||||
+16
-8
@@ -94,7 +94,11 @@ public:
|
||||
for (const auto & inputToUpdate : inputsToUpdate) {
|
||||
auto inputPath = flake::parseInputPath(inputToUpdate);
|
||||
if (lockFlags.inputUpdates.contains(inputPath))
|
||||
warn("Input '%s' was specified multiple times. You may have done this by accident.", inputToUpdate);
|
||||
printTaggedWarning(
|
||||
"Input '%s' was specified multiple times. You may have done this by "
|
||||
"accident.",
|
||||
inputToUpdate
|
||||
);
|
||||
lockFlags.inputUpdates.insert(inputPath);
|
||||
}
|
||||
}},
|
||||
@@ -320,7 +324,7 @@ struct CmdFlakeInfo : CmdFlakeMetadata
|
||||
{
|
||||
void run(nix::ref<nix::Store> store) override
|
||||
{
|
||||
warn("'nix flake info' is a deprecated alias for 'nix flake metadata'");
|
||||
printTaggedWarning("'nix flake info' is a deprecated alias for 'nix flake metadata'");
|
||||
CmdFlakeMetadata::run(store);
|
||||
}
|
||||
};
|
||||
@@ -605,7 +609,11 @@ struct CmdFlakeCheck : FlakeCommand
|
||||
name == "nixosModule" ? "nixosModules.default" :
|
||||
"";
|
||||
if (replacement != "")
|
||||
warn("flake output attribute '%s' is deprecated; use '%s' instead", name, replacement);
|
||||
printTaggedWarning(
|
||||
"flake output attribute '%s' is deprecated; use '%s' instead",
|
||||
name,
|
||||
replacement
|
||||
);
|
||||
|
||||
if (name == "checks") {
|
||||
state->forceAttrs(vOutput, pos, "");
|
||||
@@ -804,7 +812,7 @@ struct CmdFlakeCheck : FlakeCommand
|
||||
;
|
||||
|
||||
else
|
||||
warn("unknown flake output '%s'", name);
|
||||
printTaggedWarning("unknown flake output '%s'", name);
|
||||
|
||||
} catch (Error & e) {
|
||||
e.addTrace(resolve(pos), HintFmt("while checking flake output '%s'", name));
|
||||
@@ -823,7 +831,7 @@ struct CmdFlakeCheck : FlakeCommand
|
||||
throw Error("some errors were encountered during the evaluation");
|
||||
|
||||
if (!omittedSystems.empty()) {
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"The check omitted these incompatible systems: %s\n"
|
||||
"Use '--all-systems' to check all.",
|
||||
concatStringsSep(", ", omittedSystems)
|
||||
@@ -1340,7 +1348,7 @@ struct CmdFlakeShow : FlakeCommand, MixJSON
|
||||
if (!json)
|
||||
logger->cout(fmt("%s " ANSI_WARNING "omitted" ANSI_NORMAL " (use '--all-systems' to show)", headerPrefix));
|
||||
else {
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"%s omitted (use '--all-systems' to show)",
|
||||
concatStringsSep(".", attrPath)
|
||||
);
|
||||
@@ -1367,7 +1375,7 @@ struct CmdFlakeShow : FlakeCommand, MixJSON
|
||||
if (!json)
|
||||
logger->cout(fmt("%s " ANSI_WARNING "omitted" ANSI_NORMAL " (use '--legacy' to show)", headerPrefix));
|
||||
else {
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"%s omitted (use '--legacy' to show)",
|
||||
concatStringsSep(".", attrPath)
|
||||
);
|
||||
@@ -1376,7 +1384,7 @@ struct CmdFlakeShow : FlakeCommand, MixJSON
|
||||
if (!json)
|
||||
logger->cout(fmt("%s " ANSI_WARNING "omitted" ANSI_NORMAL " (use '--all-systems' to show)", headerPrefix));
|
||||
else {
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"%s omitted (use '--all-systems' to show)",
|
||||
concatStringsSep(".", attrPath)
|
||||
);
|
||||
|
||||
+1
-1
@@ -145,7 +145,7 @@ struct CmdLsStore : StoreCommand, MixLs
|
||||
}
|
||||
} catch (NoSuchBinaryCacheFile &) {
|
||||
} catch (Error & e) {
|
||||
warn(
|
||||
printTaggedWarning(
|
||||
"nar listing for %s on %s is bad (falling back to full nar download): %s",
|
||||
path,
|
||||
store->getUri(),
|
||||
|
||||
+6
-3
@@ -292,8 +292,9 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs, virtual RootArgs
|
||||
auto arg = *pos;
|
||||
auto i = aliases.find(arg);
|
||||
if (i == aliases.end()) return pos;
|
||||
warn("'%s' is a deprecated alias for '%s'",
|
||||
arg, concatStringsSep(" ", i->second));
|
||||
printTaggedWarning(
|
||||
"'%s' is a deprecated alias for '%s'", arg, concatStringsSep(" ", i->second)
|
||||
);
|
||||
pos = args.erase(pos);
|
||||
for (auto j = i->second.rbegin(); j != i->second.rend(); ++j)
|
||||
pos = args.insert(pos, *j);
|
||||
@@ -608,7 +609,9 @@ void mainWrapped(AsyncIoRoot & aio, int argc, char * * argv)
|
||||
args.command->second->experimentalFeature());
|
||||
|
||||
if (args.useNet && !haveInternet()) {
|
||||
warn("you don't have Internet access; disabling some network-dependent features");
|
||||
printTaggedWarning(
|
||||
"you don't have Internet access; disabling some network-dependent features"
|
||||
);
|
||||
args.useNet = false;
|
||||
}
|
||||
|
||||
|
||||
+13
-11
@@ -264,12 +264,12 @@ struct CmdProfileRemove : virtual EvalCommand, MixDefaultProfile, MixProfileElem
|
||||
if (removedCount == 0) {
|
||||
for (auto matcher: matchers) {
|
||||
if (const Path * path = std::get_if<Path>(&matcher)) {
|
||||
warn("'%s' does not match any paths", *path);
|
||||
printTaggedWarning("'%s' does not match any paths", *path);
|
||||
} else if (const RegexPattern * regex = std::get_if<RegexPattern>(&matcher)){
|
||||
warn("'%s' does not match any packages", regex->pattern);
|
||||
printTaggedWarning("'%s' does not match any packages", regex->pattern);
|
||||
}
|
||||
}
|
||||
warn ("Use 'nix profile list' to see the current profile.");
|
||||
printTaggedWarning("Use 'nix profile list' to see the current profile.");
|
||||
}
|
||||
updateProfile(aio().blockOn(newManifest.build(store)));
|
||||
}
|
||||
@@ -310,16 +310,18 @@ struct CmdProfileUpgrade : virtual SourceExprCommand, MixDefaultProfile, MixProf
|
||||
matchedCount += 1;
|
||||
|
||||
if (!element.source) {
|
||||
warn(
|
||||
"Found package '%s', but it was not installed from a flake, so it can't be checked for upgrades",
|
||||
printTaggedWarning(
|
||||
"Found package '%s', but it was not installed from a flake, so it can't be "
|
||||
"checked for upgrades",
|
||||
element.identifier()
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (element.source->originalRef.input.isLocked()) {
|
||||
warn(
|
||||
"Found package '%s', but it was installed from a locked flake reference so it can't be upgraded",
|
||||
printTaggedWarning(
|
||||
"Found package '%s', but it was installed from a locked flake reference so it "
|
||||
"can't be upgraded",
|
||||
element.identifier()
|
||||
);
|
||||
continue;
|
||||
@@ -383,15 +385,15 @@ struct CmdProfileUpgrade : virtual SourceExprCommand, MixDefaultProfile, MixProf
|
||||
if (matchedCount == 0) {
|
||||
for (auto & matcher : matchers) {
|
||||
if (const Path * path = std::get_if<Path>(&matcher)){
|
||||
warn("'%s' does not match any paths", *path);
|
||||
printTaggedWarning("'%s' does not match any paths", *path);
|
||||
} else if (const RegexPattern * regex = std::get_if<RegexPattern>(&matcher)) {
|
||||
warn("'%s' does not match any packages", regex->pattern);
|
||||
printTaggedWarning("'%s' does not match any packages", regex->pattern);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
warn("Found some packages but none of them could be upgraded");
|
||||
printTaggedWarning("Found some packages but none of them could be upgraded");
|
||||
}
|
||||
warn ("Use 'nix profile list' to see the current profile.");
|
||||
printTaggedWarning("Use 'nix profile list' to see the current profile.");
|
||||
}
|
||||
|
||||
auto builtPaths = builtPathsPerInstallable(
|
||||
|
||||
@@ -89,7 +89,7 @@ struct CmdUpgradeNix : MixDryRun, EvalCommand
|
||||
|
||||
if (dryRun) {
|
||||
logger->pause();
|
||||
warn("would upgrade to version %s", version);
|
||||
printTaggedWarning("would upgrade to version %s", version);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user