Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#6770 closed defect (fixed)

Move of avatars from .gajim on nfs to .cache on local disk fails

Reported by: https://www.google.com/accounts/o8/id?id=AItOawkZwa6c3ReOUyp11W6GxTZxYVUQHD771fU Owned by:
Priority: normal Milestone: 0.14.2
Component: None Version: hg
Severity: normal Keywords:
Cc: Blocked By:
Blocking: OS: All

Description

Bug description

If you have an NFS home directory, and ~/.cache is a symlink to a local directory (for better performance), the first run of the latest hg version of gajim gives the following error:

moving /home/jbebel/.gajim/avatars to /home/jbebel/.cache/gajim/avatars Traceback (most recent call last):

File "gajim.py", line 436, in <module>

check_paths.check_and_possibly_create_paths()

File "/usr/local/share/gajim/src/common/check_paths.py", line 256, in check_and_possibly_create_paths

check_and_possibly_move_config()

File "/usr/local/share/gajim/src/common/check_paths.py", line 251, in check_and_possibly_move_config

os.renames(src, dst)

File "/usr/lib/python2.6/os.py", line 199, in renames

rename(old, new)

OSError: [Errno 18] Invalid cross-device link

Steps to reproduce

Move and symlink ~/.cache to another location. Run the latest hg version of gajim against an old gajim profile.

Software versions

OS version: Ubuntu 10.04 GTK version: 2.20.1 PyGTK version: 2.17.0

Attachments (2)

gajim.patch (556 bytes) - added by https://www.google.com/accounts/o8/id?id=AItOawkZwa6c3ReOUyp11W6GxTZxYVUQHD771fU 6 years ago.
patch to catch OSError on move.
gajim.diff (645 bytes) - added by https://www.google.com/accounts/o8/id?id=AItOawkZwa6c3ReOUyp11W6GxTZxYVUQHD771fU 6 years ago.
New patch to use shutil.move()

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by https://www.google.com/accounts/o8/id?id=AItOawkZwa6c3ReOUyp11W6GxTZxYVUQHD771fU

patch to catch OSError on move.

comment:1 Changed 6 years ago by https://www.google.com/accounts/o8/id?id=AItOawkZwa6c3ReOUyp11W6GxTZxYVUQHD771fU

Attached a patch that just catches the OSError. As the move I'm concerned with is just a cache, I don't care if it fails. However, if there are other more critical moves this function can perform, perhaps it should be re-written to handle the cross-filesystem case. Perhaps by performing a copy and delete.

comment:2 Changed 6 years ago by asterix

indeed this function also copy config and other things. Could you try to replace "os.rename" by "shutil.move" and add import shutil at the begining of the file? Does this also fixes the problem?

comment:3 Changed 6 years ago by https://www.google.com/accounts/o8/id?id=AItOawkZwa6c3ReOUyp11W6GxTZxYVUQHD771fU

That has the problem of not creating the directory if it doesn't exist. Adding a test, and an os.makedirs if it doesn't seems to work. New small patch forthcoming.

Incidentally, I'm also now getting the following error, though it's probably not related:

error moving table caps_cache to cache.db: table cache.caps_cache has 4 columns but 3 values were supplied

Changed 6 years ago by https://www.google.com/accounts/o8/id?id=AItOawkZwa6c3ReOUyp11W6GxTZxYVUQHD771fU

New patch to use shutil.move()

comment:4 Changed 6 years ago by Yann Leboulanger <asterix@…>

  • Milestone set to 0.15
  • Resolution set to fixed
  • Status changed from new to closed

(In [4821e8886fa1]) use shutil.move instead of os.rename to move files. Fixes #6770

comment:5 Changed 6 years ago by asterix

I changed it a bit to call check_and_possibly_move_config() ofter folders creation. Latest hg should be fine.

For the caps_cache table, that sounds normal, as you cannot upgrade it twice.

comment:6 Changed 5 years ago by Yann Leboulanger <asterix@…>

  • Milestone changed from 0.15 to 0.14.2

(In [351105e31243]) use shutil.move instead of os.rename to move files. Fixes #6770

Note: See TracTickets for help on using tickets.