Comment 6 for bug 884625

Revision history for this message
Lincoln Phipps (lincoln-phipps) wrote :

I had this problem with Maverick -> Natty upgrade (the code doesn't see to have changed in Natty -> Oneiric) so it will also fail in other releases but what I did was edit the file /usr/lib/python2.6/dist-packages/apt/progress/text.py (it’s Python) around line 161 onwards (that may also be /usr/lib/python2.7/dist etc and do some sanity checking on the eta before it is used e.g. I did,

if eta < 0:
                end = " %sB/s ~%s" % (apt_pkg.size_to_str(self.current_cps),apt_pkg.time_to_str(0))
            elif eta > (30 * 24 *60 * 60):
                end = " %sB/s >%s" % (apt_pkg.size_to_str(self.current_cps),apt_pkg.time_to_str(30 * 24 *60 * 60))
            else:
                end = " %sB/s %s" % (apt_pkg.size_to_str(self.current_cps),
                                 apt_pkg.time_to_str(eta))

(though you could do other checks) I suspect that to get that specific OverflowError: signed integer is less than minimum error then I think that if the download process resets itself i.e. retrying a file then the file size self.total_bytes is temporarily nonsensical e.g. 0 whilst the program resets the download but it still does the pulse on this but sends a large negative number to apt_pkg.time_to_str().

If you try and pass a large negative number to the apt_pkg.time_to_str() then it either works as nonsense or it fails with the OverflowError: signed integer is less than minimum e.g. here is my test code,

>>> import apt_pkg
>>> apt_pkg.TimeToStr(-2147483648)
'213503982309746d 3h 46min 8s'
>>> apt_pkg.TimeToStr(-2147483649)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: signed integer is less than minimum

So I think you need three conditions, lots of packages to download so that the total to download gets into the billions of bytes, big files to download so that the download process can fail to download the file, and finally a crappy ADSL line or similar.