From 6e5d8929c06cb645e639022477a14ca65d483e32 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 26 Mar 2025 16:44:06 +0100 Subject: solver3: Correctly deb822-escape error message in evaluation report The error messages are multi-line now, so need correct escaping. LP: #2104276 --- apt-private/private-install.cc | 4 +++- test/integration/test-solver3-evaluation | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index f1211d25e..7103c6dc7 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -128,7 +128,9 @@ static void WriteApportReport(pkgCacheFile &Cache, std::string &title, std::vect { crash << "ErrorMessage:\n"; for (auto &error : errors) - crash << " " << error << "\n"; + { + crash << " " << SubstVar(SubstVar(APT::String::Strip(error), "\n\n", "\n.\n"), "\n", "\n ") << "\n"; + } } std::ifstream toCopy(edspDump.Name()); diff --git a/test/integration/test-solver3-evaluation b/test/integration/test-solver3-evaluation index c01ec9608..71d117f7d 100755 --- a/test/integration/test-solver3-evaluation +++ b/test/integration/test-solver3-evaluation @@ -145,3 +145,38 @@ E: The following information from --solver 3.0 may provide additional context: 2. a:amd64 Depends c but none of the choices are installable: - c:amd64 is not selected for install" apt install -s a c- --solver internal + + +rm rootdir/var/crash/apt-edsp.$(id -u).crash + +testsuccessequal "Reading package lists... +Building dependency tree... +Solving dependencies... +Writing error report... +The following additional packages will be installed: + c +The following NEW packages will be installed: + a c +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst c (3 unstable [all]) +Inst a (3 unstable [all]) +Conf c (3 unstable [all]) +Conf a (3 unstable [all])" aptget install a --solver internal -s -o Dir::Apport=var/crash -o APT::Solver::Install=false + +testsuccess sed -i "s/^Date:.*/Date: Sun Mar 9 00:08:41 2025/" rootdir/var/crash/apt-edsp.$(id -u).crash + +testsuccessequal "ProblemType: AptSolver +Architecture: amd64 +Date: Sun Mar 9 00:08:41 2025 +Package: apt +Title: Failure: The 3.0 solver did not find a result +SourcePackage: apt +ErrorMessage: + Unable to satisfy dependencies. Reached two conflicting decisions: + 1. a:amd64=3 is selected for install + . + 2. a:amd64 Depends c + but none of the choices are installable: + - c:amd64 is not selected for install +AptSolverDump: +$(cat rootdir/var/log/apt/edsp.log.zst | base64 | sed 's#^# #')" cat rootdir/var/crash/apt-edsp.$(id -u).crash -- cgit v1.2.3-70-g09d2