Bug 661278

Summary: pirut traceback when updating package from RHN repo
Product: Red Hat Enterprise Linux 5 Reporter: Miroslav Vadkerti <mvadkert>
Component: pirutAssignee: James Antill <james.antill>
Status: CLOSED ERRATA QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: high Docs Contact:
Priority: high    
Version: 5.6CC: aalam, ankit, bkearney, ddumas, eng-i18n-bugs, eng-l10n-bugs, mhideo, petersen, rolf.kyburz, slukasik
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pirut-1.3.28-19.el5 Doc Type: Bug Fix
Doc Text:
Due to an error in the Slovak translation, working with a package that was signed with an unknown GPG key caused pirut to terminate unexpectedly with a traceback. This update corrects the Slovak translation, and pirut no longer crashes.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-13 23:51:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 640580    
Attachments:
Description Flags
pup traceback with slovak localization none

Description Miroslav Vadkerti 2010-12-08 11:58:19 UTC
Description of problem:
Component: pirut
Summary: TB4a729d8f __init__.py:646:keyImportCallback:TypeError: not all arguments converted during string formatting

Traceback (most recent call last):
  File "/usr/sbin/pup", line 407, in _apply
    output = self.applyChanges(self.mainwin)
  File "/usr/lib/python2.4/site-packages/pirut/__init__.py", line 818, in applyChanges
    self.checkSignatures(dlpkgs, mainwin)
  File "/usr/lib/python2.4/site-packages/pirut/__init__.py", line 677, in checkSignatures
    self.getKeyForPackage(po, fullaskcb = keyImportCallback)
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 3537, in getKeyForPackage
    rc = fullaskcb({"po": po, "userid": info['userid'],
  File "/usr/lib/python2.4/site-packages/pirut/__init__.py", line 646, in keyImportCallback
    sec = _("The package %s is signed with a key "
TypeError: not all arguments converted during string formatting

Local variables in innermost frame:
d: <gtk.MessageDialog object (GtkMessageDialog) at 0x61161e0>
mainwin: <gtk.Window object (GtkWindow) at 0x5efc870>
userid: Red Hat, Inc. (release key) <security>
keyurl: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
keydict: {'timestamp': 1165366052, 'userid': 'Red Hat, Inc. (release key) <security>', 'keyurl': 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release', 'fingerprint': <bound method public_key.fingerprint of <yum.pgpmsg.public_key instance at 0xbbdf6c8>>, 'hexkeyid': '37017186', 'po': <YumAvailablePackageSqlite : apr-util-1.2.7-11.el5_5.2.x86_64 (0x82524d0)>}
hexkeyid: 37017186
po: apr-util-1.2.7-11.el5_5.2.x86_64


Version-Release number of selected component (if applicable):
pirut-1.3.28-17.el5

How reproducible:
100% (on current tree)

Steps to Reproduce:
1. Install tree RHEL5.6-Server-20101202.2/
2. rhn_register
3. 2 updates should be available
4. Run pup
  
Actual results:
Traceback

Expected results:
No traceback 

Additional info:

Comment 1 James Antill 2010-12-08 15:03:26 UTC
 The code is:

            sec = _("The package %s is signed with a key "
                  "%s (0x%s) from %s.  Would you like to "
                  "import this key?") %(po, userid, hexkeyid, keyurl)

...which is asking the user about installing a GPG key, as the package does not verify with the known keys. The error from pyhton implies that there aren't four %s's (which there are in the above) ... looking through the translations I see a few problems:


% fgrep 'The package' pirut-1.3.28/po/* -A 2
[...]
--
pirut-1.3.28/po/mai.po:"The package %s is signed with a key %s (0x%s) from %s.  Would you like to "
pirut-1.3.28/po/mai.po-"import this key?"
pirut-1.3.28/po/mai.po-msgstr "सँकुल %s हस्ताक्षरित अछि %s (0x%s) की कुंजी सँ.  की अहाँ ई कुंजी आयात करना चाहब?"
--
[...]
pirut-1.3.28/po/ru.po:"The package %s is signed with a key %s (0x%s) from %s.  Would you like to "
pirut-1.3.28/po/ru.po-"import this key?"
pirut-1.3.28/po/ru.po-msgstr "Пакет %s подписан ключом %s (0x%s).  Нужно ли импортировать этот ключ?"
--
[...]
pirut-1.3.28/po/sl.po:"The package %s is signed with a key %s (0x%s) from %s.  Would you like to "
pirut-1.3.28/po/sl.po-"import this key?"
pirut-1.3.28/po/sl.po-msgstr "Paket %s je podpisan s ključem iz %s (0x%s).  Ali naj ga uvozim?"
--
[...]
pirut-1.3.28/po/zh_CN.po:"The package %s is signed with a key %s (0x%s) from %s.  Would you like to "
pirut-1.3.28/po/zh_CN.po-"import this key?"
pirut-1.3.28/po/zh_CN.po-msgstr "软件包 %s 被来自 %s的 (0x%s) 密钥%s标注.您需要导入这个密钥吗?"
--
pirut-1.3.28/po/zh_TW.po:"The package %s is signed with a key %s (0x%s) from %s.  Would you like to "
pirut-1.3.28/po/zh_TW.po-"import this key?"
pirut-1.3.28/po/zh_TW.po-msgstr "套件 %s 是以來自 %s(0x%s)的金鑰所簽署。您要匯入這個金鑰嗎?"

Comment 2 Ankit Patel 2010-12-10 04:59:20 UTC
Adding "Translation" keyword and "eng-l10n-bugs" in the watch list.

Comment 3 Ankit Patel 2010-12-10 11:37:44 UTC
Hi,

I have reviewed the problem described in the comment #0 and also checked the po files reported in comment #1 and found that there is no issue with translation or i18n here.

Translation files (po files basically) are clean and error free.

Please check the problem again and try to provide exact steps to reproduce it.

Thanks!
Ankit

Comment 4 Miroslav Vadkerti 2010-12-10 12:02:51 UTC
Ankit, are you saying the translation conatains 4 %s as it should, not 3 %s as reported in comment #1?

Comment 5 Miroslav Vadkerti 2010-12-10 12:07:41 UTC
The repro steps are provided in the description with 1 IMPORTANT addition:
use localization, e.g. system->localization->language

Comment 6 Ankit Patel 2010-12-10 12:20:55 UTC
(In reply to comment #4)
> Ankit, are you saying the translation conatains 4 %s as it should, not 3 %s as
> reported in comment #1?

Yes and No both.

Below is the actual translation content I have grabbed from /cvs/dist/pirut/RHEL-5.

If you check all the reported problematic files, zh_CN.po has already 4 %s where it should be, while rest of the languages has 3 %s. However, these language PO files (mai.po, sl.po, ru.po and zh_CN.po) has marked mentioned message as "Fuzzy", i.e. those message translations will not be used for generating an MO file and hence the message will appear in English itself.

So, basically I do not see a problem, when
- zh_CN already has correct number of %s (4 here)
- rest of the languages where the problematic message is marked as fuzzy.

hence this shouldn't be a translation problem.

Thanks!
Ankit

*** pirut-1.3.28/po/mai.po ***

#: ../pirut/__init__.py:563
#, fuzzy, python-format
msgid ""
"The package %s is signed with a key %s (0x%s) from %s.  Would you like to "
"import this key?"
msgstr "सँकुल %s हस्ताक्षरित अछि %s (0x%s) की कुंजी सँ.  की अहाँ ई कुंजी आयात करना चाहब?"

*** pirut-1.3.28/po/ru.po ***

#: ../pirut/__init__.py:563
#, fuzzy, python-format
msgid ""
"The package %s is signed with a key %s (0x%s) from %s.  Would you like to "
"import this key?"
msgstr "Пакет %s подписан ключом %s (0x%s).  Нужно ли импортировать этот ключ?"


*** pirut-1.3.28/po/sl.po ***

#: ../pirut/__init__.py:563
#, fuzzy, python-format
msgid ""
"The package %s is signed with a key %s (0x%s) from %s.  Would you like to "
"import this key?"
msgstr "Paket %s je podpisan s ključem iz %s (0x%s).  Ali naj ga uvozim?"

*** pirut-1.3.28/po/zh_CN.po ***

#: ../pirut/__init__.py:563
#, python-format
msgid ""
"The package %s is signed with a key %s (0x%s) from %s.  Would you like to "
"import this key?"
msgstr "软件包 %s 被来自 %s的 (0x%s) 密钥%s标注.您需要导入这个密钥吗?"

*** pirut-1.3.28/po/zh_TW.po ***

#: ../pirut/__init__.py:563
#, fuzzy, python-format
msgid ""
"The package %s is signed with a key %s (0x%s) from %s.  Would you like to "
"import this key?"
msgstr "套件 %s 是以來自 %s(0x%s)的金鑰所簽署。您要匯入這個金鑰嗎?"

Comment 7 Miroslav Vadkerti 2010-12-10 12:25:12 UTC
I just reproduced the problem without any issues with Slovak langauge.

Exact repro steps:
1. Install RHEL5.6 via http (not the latest tree, e.g. 20101014)
2. rhn_register - successfuly register to RHN
3. system->localization->language and choose a language 
4. logout and login to have localization enabled
5. ALT+F2 -> pup
6. Update packages

With Slovak language I get a traceback. I will attach a screenshot.

Important NOTE:
Not all localizations are affected. For example Slovak is affected, but
Hungarian is not.

Comment 8 Miroslav Vadkerti 2010-12-10 12:29:19 UTC
Created attachment 467964 [details]
pup traceback with slovak localization

Comment 9 Miroslav Vadkerti 2010-12-10 12:30:40 UTC
Ankit, is Slovak localization marked as Fuzzy, if not it should be.

Comment 10 Ankit Patel 2010-12-10 12:34:59 UTC
(In reply to comment #9)
> Ankit, is Slovak localization marked as Fuzzy, if not it should be.

Sloval (sl.po) also has that particular message marked as Fuzzy.

Comment 11 James Antill 2010-12-10 15:18:18 UTC
Ankit seems to be right, testing here (LANG=zh_CN):


In [1]: from rhpl.translate import _, textdomain

In [2]: textdomain('pirut')

In [3]: _("The package %s is signed with a key %s (0x%s) from %s.  Would you like to import this key?")
Out[3]: '\xe8\xbd\xaf\xe4\xbb\xb6\xe5\x8c\x85 %s \xe8\xa2\xab\xe6\x9d\xa5\xe8\x87\xaa %s\xe7\x9a\x84 (0x%s) \xe5\xaf\x86\xe9\x92\xa5%s\xe6\xa0\x87\xe6\xb3\xa8.\xe6\x82\xa8\xe9\x9c\x80\xe8\xa6\x81\xe5\xaf\xbc\xe5\x85\xa5\xe8\xbf\x99\xe4\xb8\xaa\xe5\xaf\x86\xe9\x92\xa5\xe5\x90\x97?'

...but with LANG=sl I get:

In [3]: _("The package %s is signed with a key %s (0x%s) from %s.  Would you like to import this key?")
Out[3]: 'The package %s is signed with a key %s (0x%s) from %s.  Would you like to import this key?'

...Miroslav ... what version of pirut/python do you have?
 Also is it possible for you to edit around line 646 to find out what the message coming back from gettext is? (just print it and run from the console).

Comment 12 James Antill 2010-12-13 17:11:18 UTC
Miroslav, can you do the test?

Comment 13 James Antill 2010-12-13 21:22:12 UTC
If I try doing this here:

1. remove all installed gpg keys.

2. install old version of w3m.

3. run: LANG=sl.utf8 sudo pup

...then I get half translated text, and the "bad" text is in english (and doesn't cause a traceback). Dito. zh_TW.utf8 ... and zh_CN.utf8 shows "translated" text.

 This is on "normal" RHN RHEL-5

Comment 14 Miroslav Vadkerti 2010-12-14 08:10:05 UTC
James, I apologize for the late answer. Slovak is actually sk locale not Slovenian sl. The latter works for me too.

$ rpm -q pirut python
pirut-1.3.28-17.el5
python-2.4.3-41.el5

Here is the output of my test, when pirut tracebacks:
# LANG=sk.utf8 pup
Loaded plugins: rhnplugin
varovanie: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 37017186
Importing GPG key 0x37017186 "Red Hat, Inc. (release key) <security>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Balík %s je podpísaný kľúčom od %s (0x%s).  Ste si istý ze chcete importovať tento kľúč?

In my case the bad text is localized and causes a traceback. Sorry for the confusion. I should have corrected Ankit's post.

Comment 15 James Antill 2010-12-14 14:53:37 UTC
Yeh, weird, not sure how I missed this earlier:


#: ../pirut/__init__.py:563
#, python-format
msgid ""
"The package %s is signed with a key %s (0x%s) from %s.  Would you like to "
"import this key?"
msgstr ""
"Balík %s je podpísaný kľúčom od %s (0x%s).  Ste si istý ze chcete importovať "
"tento kľúč?"

...so it isn't marked fuzzy and only has 3 %s.

Comment 16 Denise Dumas 2010-12-14 14:57:50 UTC
So this is a problem in the sk localization file?

Comment 17 James Antill 2010-12-14 15:08:45 UTC
yes (at least sk, but maybe only sk).

Comment 20 Rolf Kyburz 2010-12-15 17:18:08 UTC
I get a pup installation failure even with LANG="en_US.UTF-8" - here's my traceback:

Component: pirut
Summary: TB7d428655 rhnplugin.py:319:_getFile:RepoError: failed to retrieve repodata/c55860d7e201ad141a1b173a01723c8ec168b6c3-updateinfo.xml.gz from rhel-x86_64-client-5
error was [Errno -1] Metadata file does not match checksum

Traceback (most recent call last):
  File "/usr/sbin/pup", line 617, in ?
    main()
  File "/usr/sbin/pup", line 613, in main
    pup.run()
  File "/usr/sbin/pup", line 451, in run
    self.doRefresh()
  File "/usr/sbin/pup", line 291, in doRefresh
    self.populateUpdates()
  File "/usr/sbin/pup", line 347, in populateUpdates
    self.updateMetadata.add(repo)
  File "/usr/lib/python2.4/site-packages/yum/update_md.py", line 367, in add
    md = obj.retrieveMD(mdtype)
  File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1494, in retrieveMD
    return self._retrieveMD(mdtype)
  File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1534, in _retrieveMD
    cache=self.http_caching == 'all')
  File "/usr/lib/yum-plugins/rhnplugin.py", line 319, in _getFile
    raise yum.Errors.RepoError, \
RepoError: failed to retrieve repodata/c55860d7e201ad141a1b173a01723c8ec168b6c3-updateinfo.xml.gz from rhel-x86_64-client-5
error was [Errno -1] Metadata file does not match checksum

Local variables in innermost frame:
e: [Errno -1] Metadata file does not match checksum
url: None
text: rhel-x86_64-client-5/updateinfo
self: rhel-x86_64-client-5
cache: False
reget: None
relative: repodata/c55860d7e201ad141a1b173a01723c8ec168b6c3-updateinfo.xml.gz
start: None
checkfunc: (<bound method RhnRepo.checkMD of <rhnplugin.RhnRepo object at 0x1aa997d0>>, ('updateinfo',), {})
copy_local: 1
end: None
local: /var/cache/yum/rhel-x86_64-client-5/c55860d7e201ad141a1b173a01723c8ec168b6c3-updateinfo.xml.gz

Comment 21 James Antill 2010-12-15 18:49:49 UTC
 This is a different bug (in RHN and the CDN). It goes away eventually, I've created a number of BZs against RHN but they keep getting closed as soon as the current problem is over.
 638922 is one. 452538 is another.

Comment 22 Jaromir Hradilek 2010-12-16 20:26:25 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Due to an error in the Slovak translation, working with a package that was signed with an unknown GPG key caused pirut to terminate unexpectedly with a traceback. This update corrects the Slovak translation, and pirut no longer crashes.

Comment 25 errata-xmlrpc 2011-01-13 23:51:44 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0132.html