aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libstore/build.cc14
-rw-r--r--src/libstore/store-api.cc6
-rw-r--r--src/libutil/error.cc2
-rw-r--r--src/libutil/serialise.cc5
-rwxr-xr-xsrc/nix-build/nix-build.cc9
-rw-r--r--src/nix-store/nix-store.cc5
6 files changed, 31 insertions, 10 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index f8cc1ce36..a7d6e53b0 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -3647,7 +3647,11 @@ void DerivationGoal::registerOutputs()
/* Apply hash rewriting if necessary. */
bool rewritten = false;
if (!outputRewrites.empty()) {
- printError("warning: rewriting hashes in '%1%'; cross fingers", path);
+ logWarning(
+ ErrorInfo {
+ .name = "Rewriting hashes",
+ .hint = hintfmt("rewriting hashes in '%1%'; cross fingers", path)
+ });
/* Canonicalise first. This ensures that the path we're
rewriting doesn't contain a hard link to /etc/shadow or
@@ -4414,8 +4418,12 @@ void SubstitutionGoal::tryNext()
&& !sub->isTrusted
&& !info->checkSignatures(worker.store, worker.store.getPublicKeys()))
{
- printError("warning: substituter '%s' does not have a valid signature for path '%s'",
- sub->getUri(), worker.store.printStorePath(storePath));
+ logWarning(
+ ErrorInfo {
+ .name = "Invalid path signature",
+ .hint = hintfmt("substituter '%s' does not have a valid signature for path '%s'",
+ sub->getUri(), worker.store.printStorePath(storePath))
+ });
tryNext();
return;
}
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 542e5c552..d1281d130 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -769,7 +769,11 @@ void ValidPathInfo::sign(const Store & store, const SecretKey & secretKey)
bool ValidPathInfo::isContentAddressed(const Store & store) const
{
auto warn = [&]() {
- printError("warning: path '%s' claims to be content-addressed but isn't", store.printStorePath(path));
+ logWarning(
+ ErrorInfo{
+ .name = "Path not content-addressed",
+ .hint = hintfmt("path '%s' claims to be content-addressed but isn't", store.printStorePath(path))
+ });
};
if (hasPrefix(ca, "text:")) {
diff --git a/src/libutil/error.cc b/src/libutil/error.cc
index ce5dde6c3..e4f45a2d3 100644
--- a/src/libutil/error.cc
+++ b/src/libutil/error.cc
@@ -161,7 +161,7 @@ std::ostream& operator<<(std::ostream &out, const ErrorInfo &einfo)
einfo.programName.value_or(""))
<< std::endl;
- // filename.
+ // filename, line, column.
if (einfo.nixCode.has_value()) {
if (einfo.nixCode->errPos.file != "") {
out << fmt("%1%in file: " ANSI_BLUE "%2% %3%" ANSI_NORMAL,
diff --git a/src/libutil/serialise.cc b/src/libutil/serialise.cc
index 8201549fd..35f7ee917 100644
--- a/src/libutil/serialise.cc
+++ b/src/libutil/serialise.cc
@@ -52,7 +52,10 @@ size_t threshold = 256 * 1024 * 1024;
static void warnLargeDump()
{
- printError("warning: dumping very large path (> 256 MiB); this may run out of memory");
+ logWarning(ErrorInfo {
+ .name = "Large path",
+ .description = "dumping very large path (> 256 MiB); this may run out of memory"
+ });
}
diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc
index 3c2f4f00c..03200d050 100755
--- a/src/nix-build/nix-build.cc
+++ b/src/nix-build/nix-build.cc
@@ -368,9 +368,12 @@ static void _main(int argc, char * * argv)
shell = drv->queryOutPath() + "/bin/bash";
} catch (Error & e) {
- // TODO: append error msg; warn()?
- logError(e.info());
- printError("warning: %s; will use bash from your environment", e.what());
+ logWarning(
+ ErrorInfo {
+ .name = "bashInteractive",
+ .hint = hintfmt("%s; will use bash from your environment",
+ (e.info().hint ? e.info().hint->str() : ""))
+ });
shell = "bash";
}
}
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index 57063d42f..9b5cceccf 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -704,7 +704,10 @@ static void opVerify(Strings opFlags, Strings opArgs)
else throw UsageError("unknown flag '%1%'", i);
if (store->verifyStore(checkContents, repair)) {
- printError("warning: not all errors were fixed");
+ logWarning(ErrorInfo {
+ .name = "Store consistency",
+ .description = "not all errors were fixed"
+ });
throw Exit(1);
}
}