Elisa won't launch in Turkish locale

Bug #310826 reported by Adam Williamson
4
Affects Status Importance Assigned to Milestone
Moovida
Invalid
Undecided
Unassigned

Bug Description

Fun bug. If I hadn't seen another incarnation of this before, I'd have had no clue.

Elisa won't run if your locale is Turkish:

https://qa.mandriva.com/show_bug.cgi?id=45955

this is a case conversion issue - the clue is the odd casing in the line:

KeyError: 'ROUND_CEiLiNG'

There's an oddity in Turkish. The letter 'I' is not the upper-case version of the letter 'i', and vice versa (the upper-case version of 'i' is a capital 'I' with a grave accent over it, and the lower-case version of 'I' is a small 'i' with no dot - they're all different characters). Case conversion algorithms that are not aware of this will break when dealing with Turkish. This is what's going on here.

I'm not sure if this bug is in Twisted or Elisa, I can't see exactly what's doing the conversion (presumably from round_ceiling to ROUND_CEILING) that breaks. If it's in Elisa, can you fix it, and if it's in Twisted, can you tell me? Thanks.

Revision history for this message
Olivier Tilloy (osomon) wrote :

From a quick investigation, the bug is neither in Elisa nor in twisted, but in Python itself:

    osomon@granuja:~$ grep -in round_ceiling /usr/lib/python2.5/decimal.py
    130: 'ROUND_DOWN', 'ROUND_HALF_UP', 'ROUND_HALF_EVEN', 'ROUND_CEILING',
    143:ROUND_CEILING = 'ROUND_CEILING'
    345: if context.rounding == ROUND_CEILING:
    1580: def _round_ceiling(self, prec):
    3137: context._set_rounding(ROUND_CEILING)

Changed in elisa:
status: New → Invalid
Revision history for this message
Adam Williamson (awilliamson) wrote :

Erm...I don't see any case conversion happening there?

Revision history for this message
Olivier Tilloy (osomon) wrote :

The case conversion happens around line 3363:

    # get rounding method function:
    rounding_functions = [name for name in Decimal.__dict__.keys()
                                        if name.startswith('_round_')]
    for name in rounding_functions:
        # name is like _round_half_even, goes to the global ROUND_HALF_EVEN value.
        globalname = ascii_upper(name[1:])
        val = globals()[globalname]
        Decimal._pick_rounding_function[val] = name

Revision history for this message
lipstick (sinanaykut-gmail) wrote :

I have the same problem with moovida

Revision history for this message
Olivier Tilloy (osomon) wrote :

Unfortunately the bug is in python, and there's nothing we can do in Moovida really.
A workaround is to run Moovida with a different locale, e.g.:

    LANG=en_US.UTF-8 moovida

Revision history for this message
lipstick (sinanaykut-gmail) wrote :

Maybe you can solve this problem by adding this code to the beginning of the program.

-*- coding: latin-1 -*-

or

-*- coding: iso-8859-9 -*-

or

-*- coding: utf-8 -*-

etc...

Revision history for this message
Olivier Tilloy (osomon) wrote :

@lipstick: I don't think this would make a change. The "coding" magic comment at the beginning of a python file defines the encoding the python interpreter should use to parse the module.
The issue we are talking about here is with a wrong case conversion algorithm using the system locale in one of python's standard modules.
Anyway, most if not all of Moovida's source files do define their encoding to utf-8.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.