From b1165a67b1f47f64082fce9a4af80838a2f5e55c Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 15 Jul 2017 10:59:11 +0200 Subject: ignore SIGPIPE in dump solver if forwarding Our test-external-dependency-solver-protocol test sometimes fails on the immediately 'crashing' solver exit1withoutmsg with the message that it got SIGPIPE from the solver. That isn't really possible as the solver produces no output, but on inspection its not this solver getting the signal but the wrapping provided by the dump-solver as the wrapped solver instantly exits. Simply ignoring the signal helps in perhaps extracting the last words of another solver (as this one has none), but at the very least we get the exit code of the wrapped solver we interested in as output. --- cmdline/apt-dump-solver.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-dump-solver.cc b/cmdline/apt-dump-solver.cc index e94021fcf..24a9f23eb 100644 --- a/cmdline/apt-dump-solver.cc +++ b/cmdline/apt-dump-solver.cc @@ -99,6 +99,7 @@ int main(int argc,const char *argv[]) /*{{{*/ FileFd forward; if (is_forwarding_dumper) { + signal(SIGPIPE, SIG_IGN); int external[] = {-1, -1}; if (pipe(external) != 0) return 250; @@ -154,13 +155,6 @@ int main(int argc,const char *argv[]) /*{{{*/ forward.Close(); dump.Close(); - if (_error->PendingError()) - { - std::ostringstream out; - out << "Writing EDSP solver input to file '" << filename << "' failed due to write errors!\n"; - return WriteError("ERR_WRITE_ERROR", out, stdoutfd, Solver); - } - if (is_forwarding_dumper) { // Wait and collect the error code @@ -179,6 +173,12 @@ int main(int argc,const char *argv[]) /*{{{*/ else return 255; } + else if (_error->PendingError()) + { + std::ostringstream out; + out << "Writing EDSP solver input to file '" << filename << "' failed due to write errors!\n"; + return WriteError("ERR_WRITE_ERROR", out, stdoutfd, Solver); + } else EDSP::WriteError("ERR_JUST_DUMPING", "I am too dumb, i can just dump!\nPlease use one of my friends instead!", stdoutfd); return 0; -- cgit v1.2.3