Compare commits

...

6 Commits

Author SHA1 Message Date
Théophane Hufschmitt
3272ed0d58 Merge pull request #10328 from NixOS/backport-10325-to-2.21-maintenance
[Backport 2.21-maintenance] build-remote: fix format string shenanigans
2024-03-26 15:04:01 +01:00
K900
fb25bdc7b7 build-remote: fix format string shenanigans
HintFmt(string) invokes the HintFmt("%s", literal) constructor,
which is not what we want here. Add a constructor with a proper name
and call that.

Next step: rename all the other ones to HintFmt::literal(string).

Fixes https://github.com/NixOS/nix/issues/10238

(cherry picked from commit 2d4edb945b)
2024-03-26 13:35:06 +00:00
Robert Hensing
53440f4edf Merge pull request #10309 from NixOS/backport-10293-to-2.21-maintenance
[Backport 2.21-maintenance] EvalCache: Fix missing format string argument
2024-03-24 02:54:31 +01:00
Eelco Dolstra
9e35746360 EvalCache: Fix missing format string argument
Fixes

  terminate called after throwing an instance of 'boost::wrapexcept<boost::io::too_few_args>'
    what():  boost::too_few_args: format-string referred to more arguments than were passed
  Aborted (core dumped)

for type errors in AttrCursor.

(cherry picked from commit bfd36402ac)
2024-03-24 01:28:27 +00:00
Eelco Dolstra
057ffc2e8e Bump version 2024-03-11 21:15:30 +01:00
Eelco Dolstra
34807c8906 Mark official release 2024-03-11 18:34:29 +01:00
5 changed files with 11 additions and 7 deletions

View File

@@ -1 +1 @@
2.21.0
2.21.1

View File

@@ -14,7 +14,7 @@
inherit (nixpkgs) lib;
inherit (lib) fileset;
officialRelease = false;
officialRelease = true;
version = lib.fileContents ./.version + versionSuffix;
versionSuffix =
@@ -165,7 +165,7 @@
nix =
let
officialRelease = false;
officialRelease = true;
versionSuffix =
if officialRelease
then ""
@@ -177,7 +177,7 @@
stdenv
versionSuffix
;
officialRelease = false;
officialRelease = true;
boehmgc = final.boehmgc-nix;
libgit2 = final.libgit2-nix;
busybox-sandbox-shell = final.busybox-sandbox-shell or final.default-busybox-sandbox-shell;

View File

@@ -202,7 +202,7 @@ static int main_build_remote(int argc, char * * argv)
else
drvstr = "<unknown>";
auto error = HintFmt(errorText);
auto error = HintFmt::fromFormatString(errorText);
error
% drvstr
% neededSystem

View File

@@ -581,7 +581,7 @@ std::string AttrCursor::getString()
auto & v = forceValue();
if (v.type() != nString && v.type() != nPath)
root->state.error<TypeError>("'%s' is not a string but %s", getAttrPathStr()).debugThrow();
root->state.error<TypeError>("'%s' is not a string but %s", getAttrPathStr(), showType(v)).debugThrow();
return v.type() == nString ? v.c_str() : v.path().to_string();
}
@@ -630,7 +630,7 @@ string_t AttrCursor::getStringWithContext()
else if (v.type() == nPath)
return {v.path().to_string(), {}};
else
root->state.error<TypeError>("'%s' is not a string but %s", getAttrPathStr()).debugThrow();
root->state.error<TypeError>("'%s' is not a string but %s", getAttrPathStr(), showType(v)).debugThrow();
}
bool AttrCursor::getBool()

View File

@@ -144,6 +144,10 @@ public:
: HintFmt("%s", Uncolored(literal))
{ }
static HintFmt fromFormatString(const std::string & format) {
return HintFmt(boost::format(format));
}
/**
* Interpolate the given arguments into the format string.
*/