diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-07-29 21:51:43 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2016-07-29 22:09:06 +0200 |
commit | b60c8a89c281f2bb945d426d2215cbf8f5760738 (patch) | |
tree | ce1af387743aa9c849c063bfae675fdec50ef36c | |
parent | 02c38073af51802c02bb104d4450e0e112d641ad (diff) | |
download | apt-b60c8a89c281f2bb945d426d2215cbf8f5760738.tar.gz |
edsp: try to read responses even if writing failed
If a solver/planner exits before apt is done writing we will generate
write errors. Solvers like 'dump' can be pretty quick in failing but
produce a valid EDSP error report apt should read, parse and display
instead of just discarding even through we had write errors.
-rw-r--r-- | apt-pkg/edsp.cc | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index 740eb0a0d..f56625feb 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -1061,20 +1061,21 @@ bool EDSP::ResolveExternal(const char* const solver, pkgDepCache &Cache, return _error->Errno("ResolveExternal", "Opening solver %s stdin on fd %d for writing failed", solver, solver_in); bool Okay = output.Failed() == false; - if (Progress != NULL) + if (Okay && Progress != NULL) Progress->OverallProgress(0, 100, 5, _("Execute external solver")); Okay &= EDSP::WriteRequest(Cache, output, flags, Progress); - if (Progress != NULL) + if (Okay && Progress != NULL) Progress->OverallProgress(5, 100, 20, _("Execute external solver")); Okay &= EDSP::WriteScenario(Cache, output, Progress); output.Close(); - if (Progress != NULL) + if (Okay && Progress != NULL) Progress->OverallProgress(25, 100, 75, _("Execute external solver")); if (Okay && EDSP::ReadResponse(solver_out, Cache, Progress) == false) return false; - return ExecWait(solver_pid, solver); + bool const waited = ExecWait(solver_pid, solver); + return Okay && waited; } bool EDSP::ResolveExternal(const char* const solver, pkgDepCache &Cache, bool const upgrade, bool const distUpgrade, @@ -1118,28 +1119,32 @@ bool EIPP::OrderInstall(char const * const solver, pkgPackageManager * const PM, return _error->Errno("EIPP::OrderInstall", "Opening planner %s stdin on fd %d for writing failed", solver, solver_in); bool Okay = output.Failed() == false; - if (Progress != NULL) + if (Okay && Progress != NULL) Progress->OverallProgress(0, 100, 5, _("Execute external planner")); Okay &= EIPP::WriteRequest(PM->Cache, output, flags, Progress); - if (Progress != NULL) + if (Okay && Progress != NULL) Progress->OverallProgress(5, 100, 20, _("Execute external planner")); Okay &= EIPP::WriteScenario(PM->Cache, output, Progress); output.Close(); - if (Progress != NULL) - Progress->OverallProgress(25, 100, 75, _("Execute external planner")); - - // we don't tell the external planners about boring things - for (auto Pkg = PM->Cache.PkgBegin(); Pkg.end() == false; ++Pkg) + if (Okay) { - if (Pkg->CurrentState == pkgCache::State::ConfigFiles && PM->Cache[Pkg].Purge() == true) - PM->Remove(Pkg, true); + if (Progress != nullptr) + Progress->OverallProgress(25, 100, 75, _("Execute external planner")); + + // we don't tell the external planners about boring things + for (auto Pkg = PM->Cache.PkgBegin(); Pkg.end() == false; ++Pkg) + { + if (Pkg->CurrentState == pkgCache::State::ConfigFiles && PM->Cache[Pkg].Purge() == true) + PM->Remove(Pkg, true); + } } - if (Okay && EIPP::ReadResponse(solver_out, PM, Progress) == false) + if (EIPP::ReadResponse(solver_out, PM, Progress) == false) return false; - return ExecWait(solver_pid, solver); + bool const waited = ExecWait(solver_pid, solver); + return Okay && waited; } /*}}}*/ bool EIPP::WriteRequest(pkgDepCache &Cache, FileFd &output, /*{{{*/ |