Bug 469160

Summary: Sugar crashes at ru_RU.UTF-8
Product: [Fedora] Fedora Reporter: Arkady L. Shane <atigro>
Component: sugarAssignee: Jonathan Blandford <jrb>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 10CC: abbris, dchen, ddumas, ivazqueznet, johnp, jrb, mads, morgan.collett, simon, tomeu
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-02-25 08:03:58 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:

Description Arkady L. Shane 2008-10-30 11:07:33 UTC
Description of problem:
Sugar crashes every time when I run sugar or sugar-shell. I think this is a translation problem:

Traceback (most recent call last):
  File "/usr/bin/sugar-shell", line 30, in <module>
    from main import main
  File "/usr/share/sugar/shell/main.py", line 30, in <module>
    from sugar.profile import get_profile
  File "/usr/lib/python2.5/site-packages/sugar/profile.py", line 24, in <module>
    from sugar import util
  File "/usr/lib/python2.5/site-packages/sugar/util.py", line 183, in <module>
    AND = _(' and ')
  File "/usr/lib/python2.5/site-packages/sugar/util.py", line 26, in <lambda>
    _ = lambda msg: gettext.dgettext('sugar-toolkit', msg)
  File "/usr/lib64/python2.5/gettext.py", line 532, in dgettext
    codeset=_localecodesets.get(domain))
  File "/usr/lib64/python2.5/gettext.py", line 480, in translation
    t = _translations.setdefault(key, class_(open(mofile, 'rb')))
  File "/usr/lib64/python2.5/gettext.py", line 180, in __init__
    self._parse(fp)
  File "/usr/lib64/python2.5/gettext.py", line 317, in _parse
    self.plural = c2py(plural)
  File "/usr/lib64/python2.5/gettext.py", line 93, in c2py
    raise ValueError, 'plural forms expression could be dangerous'
ValueError: plural forms expression could be dangerous

Comment 1 Sergey Podushkin 2008-11-10 16:28:38 UTC
I think this is gettexts bug, not sugar. but i can be wrong.

Comment 2 Ignacio Vazquez-Abrams 2008-11-10 16:43:15 UTC
It's a Python bug.

Comment 3 Mads Kiilerich 2008-11-10 17:26:31 UTC
It chokes on parsing plural spec '(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10< =4 && (n%100<10 or n%100>=20) ? 1 : 2)'

Apparently python gettext doesn't support that complex plural specs. IMHO that could be a valid feature request, but the short time workaround would probably be to make sugar catch and ignore the exception somehow - or to fix the translation.

Comment 4 Mads Kiilerich 2008-11-11 01:38:17 UTC
More specifically, the problem is the "or" in the plural spec. It has to be more c-ish "||".

http://www.gnu.org/software/automake/manual/gettext/Plural-forms.html seems to be the "definition" of valid plural specs. It mentions the following russion plural spec:

          Plural-Forms: nplurals=3; \
              plural=n%10==1 && n%100!=11 ? 0 : \
                     n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;

Comment 5 Ignacio Vazquez-Abrams 2008-11-11 04:57:25 UTC
Alright, so not a Python bug then.

Comment 6 Simon Schampijer 2008-11-17 15:30:40 UTC
So the problem was in the po file, someone added a line break in the plural form equation. Making sugar not choke here is an interesting subject which we need to look at more closely. As far as i understood it, if we catch the error we would need to change our initial gettext imports to not result in unpredictable behaviour. 

For now Sayamindu fixed the ru.po:

http://dev.laptop.org/git?p=sugar-toolkit;a=commit;h=856c84b523aaeafdda80e7969636ebd9fe029dff

Comment 7 Simon Schampijer 2008-11-18 12:02:00 UTC
I have a built a new sugar-toolkit with the fixed po 
http://koji.fedoraproject.org/koji/buildinfo?buildID=70101

Comment 8 Arkady L. Shane 2008-11-19 13:22:05 UTC
No I have:

Traceback (most recent call last):
  File "/usr/bin/sugar-shell", line 30, in <module>
    from main import main
  File "/usr/share/sugar/shell/main.py", line 32, in <module>
    import view.Shell
  File "/usr/share/sugar/shell/view/Shell.py", line 38, in <module>
    from view.frame import frame
  File "/usr/share/sugar/shell/view/frame/frame.py", line 29, in <module>
    from view.frame.activitiestray import ActivitiesTray
  File "/usr/share/sugar/shell/view/frame/activitiestray.py", line 33, in <module>
    from model import shellmodel
  File "/usr/share/sugar/shell/model/shellmodel.py", line 24, in <module>
    from model.devices.devicesmodel import DevicesModel
  File "/usr/share/sugar/shell/model/devices/devicesmodel.py", line 25, in <module>
    from model import network
  File "/usr/share/sugar/shell/model/network.py", line 23, in <module>
    from sugar import dispatch
ImportError: cannot import name dispatch

Comment 9 Mads Kiilerich 2008-11-19 13:59:03 UTC
That is not related to the first bug.

It seems to be a bug in the sugar package or one of its dependencies.

I suggest you file another bug and include the stacktrace and the output of 

rpm -qa 'sugar*'

Comment 10 Arkady L. Shane 2008-11-19 15:27:56 UTC
$ rpm -qa 'sugar*'
sugar-datastore-0.8.3-2.fc10.noarch
sugar-artwork-0.82.3-1.fc10.i386
sugar-terminal-16-2.fc10.noarch
sugar-emulator-0.82.9-4.fc10.x86_64
sugar-write-59-1.fc10.noarch
sugar-artwork-0.82.3-1.fc10.x86_64
sugar-presence-service-0.82.2-1.fc10.noarch
sugar-calculator-23-2.fc10.noarch
sugar-toolkit-0.82.11-2.fc10.x86_64
sugar-journal-99-3.fc10.noarch
sugar-base-0.82.2-2.fc10.x86_64
sugar-browse-99-1.fc10.noarch
sugar-log-16-1.fc10.noarch
sugar-moon-8-2.fc10.noarch
sugar-chat-47-1.fc10.noarch
sugar-0.82.9-4.fc10.x86_64

Comment 11 Simon Schampijer 2008-11-20 22:58:25 UTC
Yeah the sugar-base package is faulty. I rebuilt it - can you have a look if that fixes it for you? http://koji.fedoraproject.org/koji/buildinfo?buildID=70446 [sugar-base-0.82.2-4]

Thanks

Comment 12 Simon Schampijer 2008-11-21 09:29:51 UTC
Actually please use #472472 from now for the import error described above - nothing to do with the original po file bug.

Comment 13 Bug Zapper 2008-11-26 04:29:31 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 15 Simon Schampijer 2009-02-25 08:03:58 UTC
Fixed in F10.