From f3d2a16eff5c88d35c774315f08e260697b646f1 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 25 Mar 2024 12:43:30 +0100 Subject: [PATCH] Fix evalState::rootFS paths' to_string() This showPath is getting a little too ad hoc, but it works for now. --- src/libexpr/eval.cc | 1 + src/libutil/source-accessor.cc | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 8020b3b31..0e7937d17 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -315,6 +315,7 @@ EvalState::EvalState( { corepkgsFS->setPathDisplay(""); internalFS->setPathDisplay("«nix-internal»", ""); + rootFS->setPathDisplay("/", ""); countCalls = getEnv("NIX_COUNT_CALLS").value_or("0") != "0"; diff --git a/src/libutil/source-accessor.cc b/src/libutil/source-accessor.cc index 484190c9b..422b3f3eb 100644 --- a/src/libutil/source-accessor.cc +++ b/src/libutil/source-accessor.cc @@ -64,7 +64,9 @@ void SourceAccessor::setPathDisplay(std::string displayPrefix, std::string displ std::string SourceAccessor::showPath(const CanonPath & path) { - return displayPrefix + (displayPrefix.empty() ? "" : ":") + path.rel() + displaySuffix; + return displayPrefix + + ((displayPrefix.empty() || displayPrefix.ends_with("/")) ? "" : ":") + path.rel() + + displaySuffix; } CanonPath SourceAccessor::resolveSymlinks(