Bug 431073 - pirut crashs with german locale
pirut crashs with german locale
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: pirut (Show other bugs)
5.2
All Linux
medium Severity low
: rc
: ---
Assigned To: James Antill
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-31 11:23 EST by Christian Jung
Modified: 2013-01-10 05:21 EST (History)
1 user (show)

See Also:
Fixed In Version: RHBA-2008-0388
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-05-21 10:22:07 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
pirut error message if you use LANG=de_DE (180.84 KB, application/octet-stream)
2008-01-31 11:23 EST, Christian Jung
no flags Details
pirut error message if you use LANG=de (926 bytes, application/octet-stream)
2008-01-31 11:24 EST, Christian Jung
no flags Details
error message of LANG=de_DE yum info python-tools (1.35 KB, text/plain)
2008-02-04 08:32 EST, Christian Jung
no flags Details
current python backtrace (698.26 KB, text/plain)
2008-02-06 09:37 EST, Christian Jung
no flags Details
Fix for python gettext split problem (600 bytes, patch)
2008-02-06 10:13 EST, James Antill
no flags Details | Diff
Output of LANG=de_DE yum info lftp (1.31 KB, text/plain)
2008-02-21 04:59 EST, Christian Jung
no flags Details

  None (edit)
Description Christian Jung 2008-01-31 11:23:46 EST
Description of problem:
Pirut crashs with german locale. 

Version-Release number of selected component (if applicable):
pirut-1.3.28-2

How reproducible:
always

Steps to Reproduce:
1. Start pirut with german language:
LANG=de_DE pirut
2. Click on "Liste"
3. pirut crashs

Actual results:
error message on console is:
/usr/lib/python2.4/site-packages/rhpl/exception.py:64: GtkWarning:
gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text, len, NULL)' failed
  buffer.set_text(text)
(see also attached file pirut-lang-de_DE.txt.bz2)

Expected results:
pirut should show the list of available/installable/installed packages.

Additional info:
If you try:
LANG=de pirut
You see the following error message:
(pirut:26662): Gtk-WARNING **: Locale not supported by C library.
        Using the fallback 'C' locale.
and pirut crashs 
(see attached log "pirut-lang-de.txt")

This is less important since LANG=de shouldn't be used.
Comment 1 Christian Jung 2008-01-31 11:23:46 EST
Created attachment 293597 [details]
pirut error message if you use LANG=de_DE
Comment 2 Christian Jung 2008-01-31 11:24:40 EST
Created attachment 293598 [details]
pirut error message if you use LANG=de
Comment 3 James Antill 2008-02-01 17:23:54 EST
 Ok, trying this on Fedora 8 I get:

/usr/sbin/pirut:417: GtkWarning: Failed to set text from markup due to error
parsing markup: Fehler in Zeile 1: Zeichen » « ist in einem Entitätsnamen ungültig
  gtk.main()
/usr/sbin/pirut:417: GtkWarning: Failed to set text from markup due to error
parsing markup: Fehler in Zeile 1: Zeichen » « ist am Anfang eines
Entitätsnamens ungültig; eine Entität beginnt mit dem Zeichen &; wenn das Et
keine Entität sein soll, es als & umschreiben
  gtk.main()
/usr/sbin/pirut:417: GtkWarning: Failed to set text from markup due to error
parsing markup: Fehler in Zeile 1: Zeichen »'« ist in einem Entitätsnamen ungültig
  gtk.main()

...which I assume means one of two things:

1. we have a newer gtk in Fedora 8, which doesn't have the assert problem and
we'll have to work around it in RHEL-5.2

2. The translations are different in Fedora 8 vs. RHEL-5.2 and we should copy
them over, I think this should be the same (as it's the same tarball/src.rpm)
but I want to make sure I'm not missing something.

...do you know if I can rule out #2?
Comment 4 RHEL Product and Program Management 2008-02-01 17:37:35 EST
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 5 James Antill 2008-02-03 23:59:28 EST
 Looking into this a bit more, the only place that calls set_text is:


buffer.set_text(sanitizeString(desc))

..and sanitizeString() ends with:

def sanitizeString(s, translate = True):
[...]
    if type(s) != unicode:
        try:
            s = unicode(s, "utf-8")
        except UnicodeDecodeError, e:
            print >> sys.stderr, "Unable to convert %s to a unicode object: %s"
%(s, e)
            return ""
    return s

...which should ensure that "s" passes g_utf8_validate () ... more investigation
required I guess.

Comment 6 James Antill 2008-02-04 01:21:24 EST
 Ok, not sure why the currect code doesn't work ... but I've reverted to the old
(RHEL-5.0 GA) behaviour of using utf8() from rhpl.translate. See if that fixes
it for you, pirut-1_3_28-3_el5
Comment 7 Christian Jung 2008-02-04 08:31:54 EST
I tried this new package and behaviour didn't change.

More testing showed, that it doesn't seem to be a pirut issue. It seems to be a
yum issue. 

If I execute "yum show python-tools" I get the attached error messages.
While upgrading pirut, I also upgraded yum:
# rpm -qa | grep yum
yum-updatesd-0.9-2
yum-utils-1.1.10-2
yum-metadata-parser-1.1.2-2
yum-rhn-plugin-0.5.2-5.el5_1.2
yum-3.2.8-5

Last lines of output of pirut in comment #1 and attached output, seems to be the
same.
LANG=C yum show python-tools does not crash
LANG=de_DE yum show python-tools does crash
Comment 8 Christian Jung 2008-02-04 08:32:48 EST
Created attachment 293883 [details]
error message of LANG=de_DE yum info python-tools
Comment 9 James Antill 2008-02-04 09:28:09 EST
 Damn I remember fixing this for Fedora, python's gettext doesn't like .po files
formatted in a certain way.
 We can either re-format the .po files, or include the python gettext fix
(probably hard, due to it not being updated so far) ... *sigh*.
Comment 10 James Antill 2008-02-04 16:06:18 EST
 Ok, I've reverted the gettext code to rhpl.translate varient, which should
resolve this without us having to alter python.
 Please try: pirut-1.3.28-4.el5.src.rpm
Comment 11 Christian Jung 2008-02-05 07:43:36 EST
It is still not working, but the error message changed:
# pirut 
Loading "rhnplugin" plugin
Component: pirut
Summary: TB9ce3a230 __init__.py:866:sanitizeString:NameError: global name
'textdomain' is not defined

Traceback (most recent call last):
  File "/usr/sbin/pirut", line 121, in _pageSwitch
    self.pageMap[num]()
  File "/usr/sbin/pirut", line 305, in _showListReal
    plist.addPackage(po, t)
  File "/usr/lib/python2.4/site-packages/pirut/PackageList.py", line 142, in
addPackage
    self.pkgStore.append([po, pix in installedpix, pix,
  File "/usr/lib/python2.4/site-packages/pirut/PackageList.py", line 67, in
listEntryString
    desc = "<b>%s</b> - %s" %(po, pirut.sanitizeString(desc))
  File "/usr/lib/python2.4/site-packages/pirut/__init__.py", line 866, in
sanitizeString
    textdomain(d)
NameError: global name 'textdomain' is not defined

Local variables in innermost frame:
i18ndomains: ['redhat-dist']
s: Umwandlung von Text und anderen Dateitypen in PostScript(TM).
translate: True
d: redhat-dist

Pirut now also fails if I try this:
LANG=C pirut
With the same error message (but in english this time)
Comment 12 James Antill 2008-02-05 12:32:11 EST
 Of course a missing import makes it in to what I commit ... should be fixed in
pirut-1.3.28-5.el5.src.rpm

 Thanks for the quick testing.
Comment 13 Christian Jung 2008-02-06 02:24:04 EST
Now the bug in comment #11 is gone.
But I still see the original bug. :-(
Comment 14 James Antill 2008-02-06 09:21:19 EST
 Wait you get the problem in comment#8 or the very first one in comment#0 ?
Comment 15 Christian Jung 2008-02-06 09:37:20 EST
Created attachment 294107 [details]
current python backtrace

since the backtrace looks slightly different with the current pirut package, I
added the new one.
Packages:
yum-updatesd-0.9-2
yum-utils-1.1.10-2
yum-metadata-parser-1.1.2-2
yum-rhn-plugin-0.5.2-5.el5_1.2
yum-3.2.8-5
pirut-1.3.28-5.el5
Comment 16 James Antill 2008-02-06 10:13:52 EST
Created attachment 294112 [details]
Fix for python gettext split problem

 Ok, it's the comment#8 problem ... It looks like rhpl.translate is also goling
through the python gettext code ... weird, I don't understand why that's
triggering with the new pirut and not the old one.

 Anyway it looks like we'll have to fix python, can you try applying this to
your installed python (just apply it to the installed file). This should fix
the python problem (it does in Fedora) but I want to make sure there isn't
anything else.
Comment 17 Christian Jung 2008-02-06 10:43:38 EST
I applied the patch from comment #16 and it fixes all the specified problems.
Comment 18 James Antill 2008-02-06 12:32:08 EST
 Ok, could you do one last test. Could you test downgrading your pirut/yum to
the RHEL-5.0 GA versions (without the above python fix) and see if it has the
same problems with the .po data.
 I assume it will, which will go a long way towards making the python errata
easy to propose.

 TiA.
Comment 19 Christian Jung 2008-02-06 13:08:52 EST
I downgraded yum, pirut and checked python. With this old packages, I don't get
the error I reported:

yum-rhn-plugin-0.4.3-1.el5
yum-updatesd-3.0.1-5.el5
yum-metadata-parser-1.0-8.fc6
yum-utils-1.0.4-3.el5
yum-3.0.1-5.el5
pirut-1.2.10-1.el5
python-2.4.3-19.el5
Comment 20 James Antill 2008-02-06 13:50:46 EST
 Ok, not the answer I was expecting, but I see now ... the older version wasn't
loading "de" (like /usr/share/locale/de/LC_MESSAGES/redhat-dist.mo) when in
"de_DE", I've created a new package which might work around it (pirut-1.3.28-6.el5).
 Also can you confirm/deny whether "LANG=de pirut" works with the GA version?
Comment 21 Christian Jung 2008-02-06 15:06:25 EST
LANG=de pirut on RHEL5 GA switches back to LANG=C:
# LANG=de pirut

(pirut:7303): Gtk-WARNING **: Locale not supported by C library.
        Using the fallback 'C' locale.
Loading "installonlyn" plugin
Loading "rhnplugin" plugin

I will upgrade to newest pirut and report back soon.
Comment 22 Christian Jung 2008-02-06 15:16:24 EST
This looks good. I upgraded to the newest pirut package and
LANG=de_DE pirut
doesn't crash!

# rpm -qa | grep -e yum -e pirut -e iniparse
yum-updatesd-0.9-2
python-iniparse-0.2.3-4.el5
yum-utils-1.1.10-2
yum-3.2.8-5
yum-rhn-plugin-0.5.3-1.el5
pirut-1.3.28-6.el5
yum-metadata-parser-1.1.2-2

Additional info:
# LANG=de pirut

(pirut:8372): Gtk-WARNING **: Locale not supported by C library.
        Using the fallback 'C' locale.
Loading "rhnplugin" plugin
Comment 23 James Antill 2008-02-06 16:27:18 EST
 Ok, thank you again for all the testing. The latest fix should go into the
errata tonight.
Comment 26 Christian Jung 2008-02-21 04:59:06 EST
Created attachment 295493 [details]
Output of LANG=de_DE yum info lftp

I have to correct myself. I looked again into the example from comment #8:
LANG=de_DE yum info <package name> fails

packages installed:
# rpm -qa | grep -e yum -e inipar
yum-updatesd-0.9-2
python-iniparse-0.2.3-4.el5
yum-utils-1.1.10-2
yum-3.2.8-5
yum-rhn-plugin-0.5.3-1.el5
yum-metadata-parser-1.1.2-2

I appologize for my bad testing.
Comment 27 James Antill 2008-02-21 10:15:54 EST
 Ahh, yum needs a workaround too. *me hopes this is it*.
 I built: yum-3.2.8-7.el5 which should have a workaround in it.

 It's just:

-                    t = gettext.dgettext(d, s)
+                    try:
+                        t = gettext.dgettext(d, s)
+                    except AttributeError: # Horrible hack for python bug
+                       t = s

...in usr/share/yum-cli/output.py
Comment 28 Christian Jung 2008-02-21 10:38:53 EST
With this latest package, yum does not crash any more.
Comment 31 errata-xmlrpc 2008-05-21 10:22:07 EDT
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 the 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-2008-0388.html

Note You need to log in before you can comment on or make changes to this bug.