update-manager crashed with TypeError in _get_last_apt_get_update_text()
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| Python |
Won't Fix
|
Unknown
|
||
| Software Updater |
Fix Released
|
Undecided
|
Unassigned | |
| Ubuntu Translations |
Undecided
|
Unassigned | ||
| language-pack-he (Ubuntu) |
Undecided
|
Ubuntu Hebrew Translators | ||
| update-manager (Ubuntu) |
Undecided
|
Unassigned |
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/
InterpreterPath: /usr/bin/python2.5
NonfreeKernelMo
Package: update-manager 1:0.93.34
PackageArchitec
ProcAttrCurrent: unconfined
ProcCmdline: /usr/bin/python2.5 /usr/bin/
ProcEnviron:
PATH=/
LANG=he_IL.UTF-8
SHELL=/bin/bash
PythonArgs: ['/usr/
SourcePackage: update-manager
Title: update-manager crashed with TypeError in _get_last_
Uname: Linux 2.6.27-11-generic i686
UserGroups: adm admin cdrom dialout lpadmin plugdev pulse-rt sambashare vboxusers
Shahar Or (mightyiam) wrote : | #1 |
Michael Vogt (mvo) wrote : | #2 |
Shahar Or (mightyiam) wrote : | #3 |
I've added new suggestions to the translations of this string in both intrepid and jaunty, which include the correct number of %s.
security vulnerability: | yes → no |
tags: | added: hebrew |
Changed in language-pack-he (Ubuntu): | |
assignee: | nobody → Ubuntu Hebrew Translators (ubuntu-l10n-he) |
Sneetsher (sneetsher) wrote : | #4 |
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:
n=1;
printf("One hour.", n);
in other hand python/print rises an error:
n=1
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?
Yaron (sh-yaron) wrote : Re: [Ubuntu-l10n-he] [Bug 341015] Re: update-manager crashed with TypeError in _get_last_apt_get_update_text() | #5 |
Is it truly a python one or is it also gettext related?
Sneetsher (sneetsher) wrote : | #6 |
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 : | #7 |
Test this in python console:
i=1
print "%i hour." % i
print "One hour." % i
Yaron (sh-yaron) wrote : | #8 |
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 : | #9 |
I see where you are getting at, but is it a bug or we should suggest a new
feature?
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 : | #10 |
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.
Changed in python: | |
importance: | Undecided → Unknown |
status: | New → Unknown |
tags: | added: i18n python |
Changed in python: | |
status: | Unknown → New |
Sneetsher (sneetsher) wrote : | #11 |
From: http://
So we have 2 choices:
- Developers can use str.format() instead of % formatting operation. (a fix)
or
- Translators add the variables even if they are not needed. (a workaround)
Yaron (sh-yaron) wrote : | #12 |
The first option sounds fair enough
Do you have any idea who should we inform?
Sneetsher (sneetsher) wrote : | #13 |
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-
Yaron (sh-yaron) wrote : | #14 |
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 : | #15 |
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:/
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.
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 |
Yaron (sh-yaron) wrote : Re: [Ubuntu-l10n-he] [Bug 341015] Re: update-manager crashed with TypeError in _get_last_apt_get_update_text() | #17 |
This is an apport report, I really can't tell and I never seen it ever
since.
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
Hebrew...
Can this be fixed?
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 : | #18 |
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
http://
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 |
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
"The package information was last updated %s hours ago.",
ago_ hours) % ago_hours
return ngettext("The package information was last updated %s hour ago.",
most likely does not match the original string.