Progress bar refers to "1 minutes" or "1 hours"

Bug #87914 reported by Buttay on 2007-02-25
12
Affects Status Importance Assigned to Milestone
update-manager (Ubuntu)
Low
Michael Vogt

Bug Description

Occurs in: Ubuntu 6.06, 6.10, 7.04

At the stage "Fetching and installing the upgrades", the progress bar indicates "About 1 hours 3 minutes remaining". There is a typo, as hour shouldn't be plural. The same problem occurs with "1 minutes".

Chris Malton (chrism-cjsoftuk) wrote :

Still applies in Edgy -> Feisty

Changed in update-manager:
status: Unconfirmed → Confirmed
description: updated
Brian Murray (brian-murray) wrote :

I also noticed this when upgrading from Feisty to Gutsy.

Changed in update-manager:
importance: Undecided → Low
Roberto Sarrionandia (rbs-tito) wrote :

It's in the Hardy Alpha too.

I'll take a look at it.

Changed in update-manager:
assignee: nobody → rbs-tito
Roberto Sarrionandia (rbs-tito) wrote :

This patch should fix it... hopefully! I'm unable to test it as I'm fully upgraded already.

Please could someone review, and possibly test, my patch?

Thanks!

Changed in update-manager:
assignee: rbs-tito → nobody
Roberto Sarrionandia (rbs-tito) wrote :

Sorry, last patch is broken.

Damn you Jono, advocating Gedit!

Here's a better one

Michael Vogt (mvo) wrote :

Thanks for the patch. A easy way to test the patch is to run in the update-manager top level directory:
$ python -c 'from DistUpgrade.DistUpgradeView import FuzzyTimeToStr; FuzzyTimeToStr(3443)'
when the patch is applied. This leads to:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "DistUpgrade/DistUpgradeView.py", line 33
    if sec = 60*60*24:
           ^
SyntaxError: invalid syntax

After correcting the "=" to "==", I get:
$ python -c 'from DistUpgrade.DistUpgradeView import FuzzyTimeToStr; print FuzzyTimeToStr(3743)'
1 hours 2 minutes

So the patch fixes the cases where it is exactly one hour, but unfortunately not the case where its something between 1 hour and 2 hours.

If you could update the patch to cover those cases, that would be much appreciated.

Thanks,
 Michael

Roberto Sarrionandia (rbs-tito) wrote :

Thanks for your feedback, I'm still learning!

I'll make a new patch once I've sobered up!

Changed in update-manager:
assignee: nobody → rbs-tito
Roberto Sarrionandia (rbs-tito) wrote :

OK, I've taken a whole different approach

Here's the new patch, I've put it through a load of tests in the manner that you described above.

Let me know if it's good this time!

Changed in update-manager:
assignee: rbs-tito → nobody
Colin Watson (cjwatson) wrote :

It would be worth looking at the "Plural forms" node in 'info gettext', which goes into issues around this in some depth.

Michael Vogt (mvo) wrote :

Thanks Roberto for updating the patch and sorry that I have not replied earlier.

Unfortunately there are some issue with it still. There is a function called "ngettext" that should be capable to handle the cases with singular/plural. The info page that Colin mentions gives a good overview about it. In a nutshell there are languages that have not only "one item" / "many items" but instead "one, less than ten, ten or more" and different prefix/suffix rules. It can get quite complex.

If you could have a look at this, that would be much appreciated.

Thanks,
 Michael

Changed in update-manager:
assignee: nobody → rbs-tito

Ok, this patch is using the ngettext function to handle all plurals, and it also returned to the "fuzzy" method it is named after! (seconds only show if it is less than one minute)

I hope I've got it right this time.

Changed in update-manager:
assignee: rbs-tito → nobody
Daniel Holbach (dholbach) wrote :

Michael: is this one better?

Wousser (wousser) on 2008-07-02
Changed in update-manager:
status: Confirmed → Incomplete
Kees Cook (kees) on 2008-07-02
Changed in update-manager:
assignee: nobody → mvo
status: Incomplete → In Progress
Brian Murray (brian-murray) wrote :

As far as I can tell this is fixed in Intrepid, I'm not quite certain when the fix made it in though. I tested it using the command provided by Michael in comment 6 and saw the following:

19:46:51 - flash:[~] python -c 'from DistUpgrade.DistUpgradeView import FuzzyTimeToStr; print FuzzyTimeToStr(3684)'
/usr/lib/python2.5/site-packages/apt/__init__.py:18: FutureWarning: apt API not stable yet
  warnings.warn("apt API not stable yet", FutureWarning)
1 hour 1 minute

Changed in update-manager:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers