Bug 469160 - Sugar crashes at ru_RU.UTF-8
Sugar crashes at ru_RU.UTF-8
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: sugar (Show other bugs)
10
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jonathan Blandford
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-30 07:07 EDT by Arkady L. Shane
Modified: 2013-04-02 00:22 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-02-25 03:03:58 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Arkady L. Shane 2008-10-30 07:07:33 EDT
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 11:28:38 EST
I think this is gettexts bug, not sugar. but i can be wrong.
Comment 2 Ignacio Vazquez-Abrams 2008-11-10 11:43:15 EST
It's a Python bug.
Comment 3 Mads Kiilerich 2008-11-10 12:26:31 EST
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-10 20:38:17 EST
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-10 23:57:25 EST
Alright, so not a Python bug then.
Comment 6 Simon Schampijer 2008-11-17 10:30:40 EST
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 07:02:00 EST
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 08:22:05 EST
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 08:59:03 EST
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 10:27:56 EST
$ 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 17:58:25 EST
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 04:29:51 EST
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-25 23:29:31 EST
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 03:03:58 EST
Fixed in F10.

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