Bug#703603: apt: gai_strerror is not always specific enough for "Something wicked happened" errors
Package: apt
Version: 0.9.7.7
Severity: normal
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch raring
If gai_strerror returns EAI_SYSTEM, then the documentation indicates
that the caller should check errno for details. apt doesn't do this,
and just prints something like "Something wicked happened resolving
'security.ubuntu.com:http' (-11 - System error)", which is rather less
helpful than it might be and makes it difficult to debug problems after
the fact. Could you apply something like the following patch to provide
more helpful output?
=== modified file 'methods/connect.cc'
--- methods/connect.cc 2011-09-19 17:14:19 +0000
+++ methods/connect.cc 2013-03-21 10:06:07 +0000
@@ -197,6 +197,9 @@ bool Connect(std::string Host,int Port,c
return _error->Error(_("Temporary failure resolving '%s'"),
Host.c_str());
}
+ if (Res == EAI_SYSTEM)
+ return _error->Error(_("System error resolving '%s:%s' (%s)"),
+ Host.c_str(),ServStr,strerror(errno));
return _error->Error(_("Something wicked happened resolving '%s:%s' (%i - %s)"),
Host.c_str(),ServStr,Res,gai_strerror(Res));
}
Thanks,
--
Colin Watson [cjwatson@ubuntu.com]
Reply to: