summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-07-14 11:22:41 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2009-07-14 11:22:41 +0200
commit217d575b5713f4d9275177b58a36c581a7880c03 (patch)
treea935fec12d3add2ba34c40d8bae17211afe158e6
parent38f5cfd8381dbdc761ba4758fb9c22c2e95498d6 (diff)
* apt-pkg/acquire-worker.cc:
- show error details of failed methods * apt-pkg/contrib/fileutl.cc: - if a process aborts with signal, show signal number * methods/http.cc: - ignore SIGPIPE, we deal with EPIPE from write in HttpMethod::ServerDie() (LP: #385144)
-rw-r--r--apt-pkg/acquire-worker.cc7
-rw-r--r--apt-pkg/contrib/fileutl.cc7
-rw-r--r--debian/changelog12
-rw-r--r--methods/http_main.cc5
4 files changed, 24 insertions, 7 deletions
diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc
index 78c68737c..4f0b52af9 100644
--- a/apt-pkg/acquire-worker.cc
+++ b/apt-pkg/acquire-worker.cc
@@ -527,10 +527,6 @@ bool pkgAcquire::Worker::OutFdReady()
if (Res <= 0)
return MethodFailure();
-
- // Hmm.. this should never happen.
- if (Res < 0)
- return true;
OutQueue.erase(0,Res);
if (OutQueue.empty() == true)
@@ -558,7 +554,8 @@ bool pkgAcquire::Worker::MethodFailure()
{
_error->Error("Method %s has died unexpectedly!",Access.c_str());
- ExecWait(Process,Access.c_str(),true);
+ // do not reap the child here to show meaningfull error to the user
+ ExecWait(Process,Access.c_str(),false);
Process = -1;
close(InFd);
close(OutFd);
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index a5976cf3a..a7de09c44 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -450,8 +450,11 @@ bool ExecWait(pid_t Pid,const char *Name,bool Reap)
{
if (Reap == true)
return false;
- if (WIFSIGNALED(Status) != 0 && WTERMSIG(Status) == SIGSEGV)
- return _error->Error(_("Sub-process %s received a segmentation fault."),Name);
+ if (WIFSIGNALED(Status) != 0)
+ if( WTERMSIG(Status) == SIGSEGV)
+ return _error->Error(_("Sub-process %s received a segmentation fault."),Name);
+ else
+ return _error->Error(_("Sub-process %s received signal %u."),Name, WTERMSIG(Status));
if (WIFEXITED(Status) != 0)
return _error->Error(_("Sub-process %s returned an error code (%u)"),Name,WEXITSTATUS(Status));
diff --git a/debian/changelog b/debian/changelog
index 2db8ae677..d6e6a5997 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+apt (0.7.21ubuntu2~ppa1) karmic; urgency=low
+
+ * apt-pkg/acquire-worker.cc:
+ - show error details of failed methods
+ * apt-pkg/contrib/fileutl.cc:
+ - if a process aborts with signal, show signal number
+ * methods/http.cc:
+ - ignore SIGPIPE, we deal with EPIPE from write in
+ HttpMethod::ServerDie() (LP: #385144)
+
+ -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 02 Jul 2009 14:11:35 +0200
+
apt (0.7.21ubuntu1) karmic; urgency=low
* merged from the debian-sid bzr branch
diff --git a/methods/http_main.cc b/methods/http_main.cc
index 2c46ab19d..7815c2fc1 100644
--- a/methods/http_main.cc
+++ b/methods/http_main.cc
@@ -1,5 +1,6 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/acquire-method.h>
+#include <signal.h>
#include "connect.h"
#include "rfc2553emu.h"
@@ -10,6 +11,10 @@ int main()
{
setlocale(LC_ALL, "");
+ // ignore SIGPIPE, this can happen on write() if the socket
+ // closes the connection (this is dealt with via ServerDie())
+ signal(SIGPIPE, SIG_IGN);
+
HttpMethod Mth;
return Mth.Loop();
}