tag 513315 + patch thanks On Wed, Jan 28, 2009 at 12:04:33PM +0000, Enrico Zini wrote: > Importing "apt" is what makes the problem reappear: apt seems to be > changing the default timeout from None to 2.0: I'll reassign this bug > to python-apt.
Thanks for figuring out which package was causing the problem. python-apt is setting the default timeout so that it will time out if downloading a changelog takes too long. The attached patch modifies it to change the default just as long as necessary. It's racy, but I think it will work in this case. Once python-apt requires Python 2.6, it can use urllib2.urlopen's optional timeout parameter instead. -- Matt http://ftbfs.org/
diff -ru python-apt-0.7.9~exp2~/apt/package.py python-apt-0.7.9~exp2/apt/package.py --- python-apt-0.7.9~exp2~/apt/package.py 2009-01-28 04:11:24.000000000 -0800 +++ python-apt-0.7.9~exp2/apt/package.py 2009-01-28 04:17:38.000000000 -0800 @@ -32,10 +32,6 @@ __all__ = 'BaseDependency', 'Dependency', 'Origin', 'Package', 'Record' -# Set a timeout for the changelog download -socket.setdefaulttimeout(2) - - def _(string): """Return the translation of the string.""" return gettext.dgettext("python-apt", string) @@ -600,7 +596,12 @@ # Check if the download was canceled if cancel_lock and cancel_lock.isSet(): return "" + # FIXME: Once Python 2.6 is required, the timeout can be set using + # urllib2.urlopen's timeout parameter. + timeout = socket.getdefaulttimeout() + socket.setdefaulttimeout(2) changelog_file = urllib2.urlopen(uri) + socket.setdefaulttimeout(timeout) # do only get the lines that are new changelog = "" regexp = "^%s \((.*)\)(.*)$" % (re.escape(src_pkg))