Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

local-derivation-goal: improve "illegal reference" error #12105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/libstore/unix/build/local-derivation-goal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2927,8 +2927,17 @@ void LocalDerivationGoal::checkOutputs(const std::map<std::string, ValidPathInfo
spec.insert(worker.store.parseStorePath(i));
else if (auto output = get(outputs, i))
spec.insert(output->path);
else
throw BuildError("derivation contains an illegal reference specifier '%s'", i);
else {
std::string allOutputs;
for (auto & o : outputs) {
if (! allOutputs.empty())
allOutputs.append(", ");
allOutputs.append(o.first);
}
Comment on lines +2932 to +2936
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be done using concatStringsSep(", ", outputs).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIU outputs is a const std::map<std::string, ValidPathInfo> & (hence the o.first on concat). Is there a concatStringsSep() that implicitly picks keys or iterators? When trying your change as is it fails the build as:

../unix/build/local-derivation-goal.cc:2931: error: undefined reference to 'std::__cxx11::basic_string<char, std:
:char_traits<char>, std::allocator<char> > nix::concatStringsSep<std::map<std::__cxx11::basic_string<char, std::c
har_traits<char>, std::allocator<char> >, nix::ValidPathInfo, std::less<std::__cxx11::basic_string<char, std::cha
r_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_tra
its<char>, std::allocator<char> > const, nix::ValidPathInfo> > > >(std::basic_string_view<char, std::char_traits<
char> >, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, nix::ValidPath
Info, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator
<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, nix::ValidPathI
nfo> > > const&)'
collect2: error: ld returned 1 exit status

throw BuildError("derivation '%s' output check for '%s' contains an illegal reference specifier '%s',"
" expected store path or output name (one of [%s])",
worker.store.printStorePath(drvPath), outputName, i, allOutputs);
}
}

auto used = recursive
Expand Down
Loading