update-manager crashed with TypeError in _get_last_apt_get_update_text()

Bug #341015 reported by Shahar Or on 2009-03-11
This bug affects 9 people
Affects Status Importance Assigned to Milestone
Won't Fix
Software Updater
Fix Released
Ubuntu Translations
language-pack-he (Ubuntu)
Ubuntu Hebrew Translators
update-manager (Ubuntu)

Bug Description

Binary package hint: update-manager

I was telling it to upgrade the dash security upgrade, entered my sudo password, looked away and when I looked back it had already crashed!

ProblemType: Crash
Architecture: i386
DistroRelease: Ubuntu 8.10
ExecutablePath: /usr/bin/update-manager
InterpreterPath: /usr/bin/python2.5
NonfreeKernelModules: ath_hal
Package: update-manager 1:0.93.34
PackageArchitecture: all
ProcAttrCurrent: unconfined
ProcCmdline: /usr/bin/python2.5 /usr/bin/update-manager
PythonArgs: ['/usr/bin/update-manager']
SourcePackage: update-manager
Title: update-manager crashed with TypeError in _get_last_apt_get_update_text()
Uname: Linux 2.6.27-11-generic i686
UserGroups: adm admin cdrom dialout lpadmin plugdev pulse-rt sambashare vboxusers

Shahar Or (mightyiam) wrote :
Michael Vogt (mvo) wrote :

Thanks for your bugreport.

This is most likely a bug in the translation. Please switch (as a workaround) to the english translation.

The amount of '%s' in the translation of
          return ngettext("The package information was last updated %s hour ago.",
                          "The package information was last updated %s hours ago.",
                          ago_hours) % ago_hours
most likely does not match the original string.

Shahar Or (mightyiam) wrote :

I've added new suggestions to the translations of this string in both intrepid and jaunty, which include the correct number of %s.

Kees Cook (kees) on 2009-03-25
security vulnerability: yes → no
Shahar Or (mightyiam) on 2010-03-24
tags: added: hebrew
Changed in language-pack-he (Ubuntu):
assignee: nobody → Ubuntu Hebrew Translators (ubuntu-l10n-he)
Sneetsher (sneetsher) wrote :

I think this bug is coming from python/print function.

As in Arabic,we have 6 plural forms. we used NOT to include the variable (%i for example) in 0th, 1st & 2nd forms. This is the correct language.

I have check both c/printf and python/print. c/printf is more robust.

c/printf accepts this:

printf("One hour.", n);

in other hand python/print rises an error:

print "One hour." % n

As a work around we could do some thing like "(%i) One hour.".

But should we pass this bug to python?

Sneetsher (sneetsher) wrote :

In python; they use this form:

print n_("%i hour.", "%i hours.",n) % n

then it chooses one of the 2 strings if it is English or their translation and replaces n_("%i hour.", "%i hours.",n).

if the result string don't have %i, there will an error in python/print.

Sneetsher (sneetsher) wrote :

Test this in python console:

print "%i hour." % i
print "One hour." % i

Yaron (sh-yaron) wrote :

I see, I'm not so familiar with python that's why I asked
In this case python bug should be reported
And many thanks in advanced

Yaron (sh-yaron) wrote :

I see where you are getting at, but is it a bug or we should suggest a new

I got:
>>> print "One hour." % i
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: not all arguments converted during string formatting

Sneetsher (sneetsher) wrote :

It's a bug; As c/printf works well. @#4. Exactly is bug in '%' format operation if not integrated in python/print as in c/printf.

Also it should fixed within python/print we don't have to change all old code.

Sneetsher (sneetsher) on 2010-04-10
Changed in python:
importance: Undecided → Unknown
status: New → Unknown
tags: added: i18n python
Changed in python:
status: Unknown → New
Sneetsher (sneetsher) wrote :

From: http://bugs.python.org/issue8359 ; This won't be fixed in python % operation.

So we have 2 choices:

- Developers can use str.format() instead of % formatting operation. (a fix)
- Translators add the variables even if they are not needed. (a workaround)

Yaron (sh-yaron) wrote :

The first option sounds fair enough
Do you have any idea who should we inform?

Sneetsher (sneetsher) wrote :

It is difficult to inform each developer to use str.format() instead of % formatting operation.

I suggest making a generalized bug. Any one finds similar case can link that tools and packages to it. As 'update-manager' and that one you have told me about 'evolution-indicator'.

Yaron (sh-yaron) wrote :

But this one is specifig, if we will find it in any other place we'll report
again and link to this one but until then we will have to battle each
occurrence individually

We'll start with this one

Changed in python:
status: New → Won't Fix
David Planella (dpm) wrote :

I've been given a heads up on this bug, but by reading the previous comments, I'm not sure it's fixed. Could someone give an update on the status?

I explained the background on https://bugs.launchpad.net/ubuntu/+source/language-selector/+bug/409785/comments/9 and added another comment on the Python upstream bug about using str.format().

The solution here is that the packages use %-formatting with named arguments (e.g. %(argument) ) to avoid crashes from happening while allowing the languages which require it to discard arguments. If it's not possible to change the code, you should use a workaround in the translation.

If someone could also send a bug report at gettext upstream mentioning the issues with msgfmt I described on the comment from the other bug above, that would also be awesome.

David Planella (dpm) on 2010-08-02
Changed in ubuntu-translations:
status: New → Incomplete

Is this update-manager's fault? Please respond if you think so.

Changed in update-manager:
status: New → Incomplete

This is an apport report, I really can't tell and I never seen it ever

If I remember correct, this bug was plural forms related, instead of
translating: "%d Hour" to "שעה %s", I translated to "שעה אחת" (Which is just
like "One Hour" thus omitting the parameter), I heard they were crashes and
even saw it with my own eyes several times, If I remember correct we
eventually changed back to %d Hour although its not the correct form in

Can this be fixed?

Robert Roth (evfool) on 2011-09-05
Changed in update-manager:
status: Incomplete → Confirmed
Changed in language-pack-he (Ubuntu):
status: New → Confirmed
Changed in update-manager (Ubuntu):
status: New → Confirmed
Robert Roth (evfool) wrote :

Setting this to fix released, as this does not happen with update-manager on oneiric with translations without parameter placeholders, tried the translations without the %s for the "last updated %s hour" and "last updated %s day" ago strings (singular forms). The translations which do not have the placeholder are : eu, et, he, ar. If you still experience this issue, feel free to reopen this bug by setting its status to new, and describe in a comment the update-manager version you are using, and the output of the locale terminal command.
Ubuntu Bug Squad volunteer triager

Changed in ubuntu-translations:
status: Incomplete → Fix Released
Changed in update-manager:
status: Confirmed → Fix Released
Changed in ubuntu-translations:
status: Fix Released → Invalid
Changed in language-pack-he (Ubuntu):
status: Confirmed → Invalid
Changed in update-manager (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.