Language Selector crashes when drag languages

Bug #645774 reported by Ding Zhou
118
This bug affects 13 people
Affects Status Importance Assigned to Milestone
language-selector (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: language-selector

I have a Ubuntu 10.10 (Upgrade from Lucid) and everything is up-to-date.

The default language is English, after installing the Chinese (whatever simplified or traditional), I dragged the Language to the front, then a crash report displayed.

I tried to run Language Selector under terminal, here the output:

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 78, in wrapper
    res = f(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 1062, in on_treeview_locales_drag_end
    self.writeUserLanguage(envLanguage)
  File "/usr/lib/python2.6/dist-packages/LanguageSelector/gtk/GtkLanguageSelector.py", line 781, in writeUserLanguage
    self.writeUserLanguageSetting(userLanguage=languageString)
  File "/usr/lib/python2.6/dist-packages/LanguageSelector/LanguageSelector.py", line 201, in writeUserLanguageSetting
    find_string_and_replace(findString, setString, conffiles)
  File "/usr/lib/python2.6/dist-packages/LanguageSelector/utils.py", line 37, in find_string_and_replace
    os.rename(out.name, fname)
OSError: [Errno 18] Invalid cross-device link

After reading the source code, I've known the bug is caused by moving file from /tmp to $HOME through Python's os module.

I've fixed the bug in my bzr branch, Please help to merge my work.

Thanks!

Revision history for this message
Ding Zhou (tualatrix) wrote :
Ding Zhou (tualatrix)
description: updated
Revision history for this message
Colin Watson (cjwatson) wrote :

Scott Kitterman pointed out that this isn't the right fix; as the comment above the os.rename points out, we rely on rename being atomic (otherwise a crash could result in a broken /etc/default/locale), and shutil.move isn't. What we should do instead, I think, is create the temporary file in the same directory as the original to make sure that it's on the same filesystem. I'm working on this.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package language-selector - 0.6.5

---------------
language-selector (0.6.5) maverick; urgency=low

  * Switch back to using os.rename in find_string_and_replace, as we require
    atomicity. Instead, always create the temporary file in the same
    directory as the original (thanks, Scott Kitterman; LP: #645774).

language-selector (0.6.4) maverick; urgency=low

  * Use shutil.move rather than os.rename in find_string_and_replace
    (thanks, TualatriX; LP: #645774).
 -- Colin Watson <email address hidden> Fri, 24 Sep 2010 14:29:08 +0100

Changed in language-selector (Ubuntu):
status: New → Fix Released
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.