From d0643f993d3c6c42ea10d5ce3a02d964b7693a7f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 28 Dec 2025 21:42:32 +0100 Subject: solver3: Re-use existing error message code in Solve() We can just re-use Enqueue() here to produce our conflict message why am I being silly and duplicate this. --- apt-pkg/solver3.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc index eb142435b..54f31a797 100644 --- a/apt-pkg/solver3.cc +++ b/apt-pkg/solver3.cc @@ -623,13 +623,10 @@ bool Solver::Solve() } if (not foundSolution && not item.clause->optional) { - std::ostringstream err; - - err << "Unable to satisfy dependencies. Reached two conflicting assignments:" << "\n"; - std::unordered_set seen; - err << "1. " << LongWhyStr(item.clause->reason, true, (*this)[item.clause->reason].reason, " ", seen).substr(3) << "\n"; - err << "2. " << LongWhyStr(item.clause->reason, false, item.clause, " ", seen).substr(3); - _error->Error("%s", err.str().c_str()); + // Enqueue produces the right error message for us here, given that reason has been assigned true already... + assert(value(item.clause->reason) == LiftedBool::True); + bool res = Enqueue(~item.clause->reason, item.clause); + assert(not res); if (not Pop()) return false; } -- cgit v1.2.3-70-g09d2