dropEmptyInitThenConcatStringsSep -> concatStringSep: output name empty not feasible

I don't think it's completely impossible, but I can't construct
one easily as derivationStrict seems to (re)tokenize the outputs
attribute, dropping the empty output.

It's not a scenario we have to account for here.
This commit is contained in:
Robert Hensing 2024-07-13 01:00:06 +02:00
parent d3e49ac881
commit 49d100ba8b
3 changed files with 7 additions and 4 deletions

View file

@ -1505,7 +1505,7 @@ std::pair<bool, SingleDrvOutputs> DerivationGoal::checkPathValidity()
if (!wantedOutputsLeft.empty())
throw Error("derivation '%s' does not have wanted outputs %s",
worker.store.printStorePath(drvPath),
dropEmptyInitThenConcatStringsSep(", ", quoteStrings(wantedOutputsLeft)));
concatStringsSep(", ", quoteStrings(wantedOutputsLeft)));
bool allValid = true;
for (auto & [_, status] : initialOutputs) {

View file

@ -5,6 +5,7 @@
#include "regex-combinators.hh"
#include "outputs-spec.hh"
#include "path-regex.hh"
#include "strings-inline.hh"
namespace nix {
@ -83,7 +84,7 @@ std::string OutputsSpec::to_string() const
return "*";
},
[&](const OutputsSpec::Names & outputNames) -> std::string {
return dropEmptyInitThenConcatStringsSep(",", outputNames);
return concatStringsSep(",", outputNames);
},
}, raw);
}

View file

@ -1,7 +1,9 @@
#include <regex>
#include "path-with-outputs.hh"
#include "store-api.hh"
#include "strings.hh"
#include <regex>
namespace nix {
@ -9,7 +11,7 @@ std::string StorePathWithOutputs::to_string(const StoreDirConfig & store) const
{
return outputs.empty()
? store.printStorePath(path)
: store.printStorePath(path) + "!" + dropEmptyInitThenConcatStringsSep(",", outputs);
: store.printStorePath(path) + "!" + concatStringsSep(",", outputs);
}