Last visit was: It is currently 28/07/2014, 19:29


All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Patch for locale problems (Turkish locale)
PostPosted: 24/12/2012, 23:54 
Newbie
Newbie

Joined: 24/12/2012, 23:36
Posts: 1
Hi,
Installed samsung tools on ubuntu 12.10, utf8 turkish laptop.

I had crashes both with system service and session service when the system locale was turkish, and when I change my system locale to english utf8, everything was ok.

I could trace the problem to reading of config files, the library that python provides changes keynames to lowercase. When reading config items, it fails to convert "BACKLIGHT_HOTKEY" text to lowercase resulting in "backlIght_hotkey" instead of "backlight_hotkey", and this causes problems. (In turkish, lowercase of I is a special unicode character, and uppercase of i is a special unicode character. In the code the strings used for keys are not unicode but ascii, so python lowercase method doesn't know how to represent those characters in ascii strings, and leaves them intact).

You can test the faulty behavior by setting system locale to utf8 turkish:
Code:
# cat /etc/default/locale
LANG="tr_TR.UTF-8"


You may need to have turkish utf8 locale support installed first. When the desktop starts, the session and system services would crash in a few minutes.


I fixed the problem by making both the session service and system service run in POSIX locale. Actually, the session/system services themselves do not set or use locale, and while it is not set, python lets them run in POSIX. Then, when the DBUS libraries are included, it sets the process locale according to environment variables, and this changes behavior of string.lower(), and this causes the mentioned problems.

/usr/lib/samsung-tools/session-service.py:
Code:
if __name__ == '__main__':
        # UPDATED
        if os.getenv('LC_ALL') != 'POSIX':
                os.putenv('LC_ALL', 'POSIX')
                os.execvp(sys.argv[0], sys.argv)
        # UPDATED

        dbus.mainloop.glib.DBusGMainLoop(set_as_default = True)


/usr/lib/samsung-tools/system-service.py:
Code:
if __name__ == '__main__':
        # UPDATED
        if os.getenv('LC_ALL') != 'POSIX':
                os.putenv('LC_ALL', 'POSIX')
                os.execvp(sys.argv[0], sys.argv)
        # UPDATED

        dbus.mainloop.glib.DBusGMainLoop(set_as_default = True)


What the patch does is; it checks if LC_ALL is set as POSIX, and if it's not, it sets it and replaces current process with a new instance, with all arguments intact. Thus, session and system services are always forced to run in POSIX locale.


Top
 Profile  
 
 Post subject: Re: Patch for locale problems (Turkish locale)
PostPosted: 18/07/2013, 18:44 
Administrator
Administrator
User avatar

Joined: 12/02/2009, 18:08
Posts: 1377
Location: Italy
The locale problem is fixed in Samsung Tools 2.2 ;)

_________________
Please consider a little donation to keep the 'Linux On My Samsung' project up and running. Thank you!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net & kodeki