OSError: [Errno 18] Invalid cross-device link

Bug #1265190 reported by Florent Flament
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-keystoneclient
Fix Released
Medium
Florent Flament

Bug Description

When launching "tox" (tox -e py27 actually) locally, I get many "OSError: [Errno 18] Invalid cross-device link
" error messages.

FAIL: keystoneclient.tests.test_auth_token_middleware.CrossVersionAuthTokenMiddlewareTest.test_valid_uuid_request_forced_to_2_0
tags: worker-1
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/florent/src/python-keystoneclient/.tox/py27/local/lib/python2.7/site-packages/httpretty/core.py", line 1006, in wrapper
    return test(*args, **kw)
  File "keystoneclient/tests/test_auth_token_middleware.py", line 1158, in test_valid_uuid_request_forced_to_2_0
    self.set_middleware(conf=conf)
  File "keystoneclient/tests/test_auth_token_middleware.py", line 274, in set_middleware
    {"revoked": [], "extra": "success"})
  File "keystoneclient/middleware/auth_token.py", line 1251, in token_revocation_list
    os.rename(f.name, self.revoked_file_name)
OSError: [Errno 18] Invalid cross-device link

This happen when os.rename(fname_old, fname_new) is called and fname_old are on different partitions. In that case os.rename raises an exception instead of moving the file.

To deal with that issue, we can use shutil.move instead of os.rename as documented there:
As documented there https://mail.python.org/pipermail/python-list/2005-February/342893.html

Changed in python-keystoneclient:
assignee: nobody → Florent Flament (florent-flament-ext)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-keystoneclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/64544

Changed in python-keystoneclient:
status: New → In Progress
Changed in python-keystoneclient:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/64555

Changed in python-keystoneclient:
status: Fix Committed → Confirmed
Changed in python-keystoneclient:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

Reviewed: https://review.openstack.org/64555
Committed: https://git.openstack.org/cgit/openstack/python-keystoneclient/commit/?id=6157dd57e732b12455cb64f85894037f2672d6d6
Submitter: Jenkins
Branch: master

commit 6157dd57e732b12455cb64f85894037f2672d6d6
Author: Florent Flament <email address hidden>
Date: Tue Dec 31 16:23:43 2013 +0100

    Fix auth_token middleware test invalid cross-device link issue

    Fixes path of temporary files, containing token revocation lists,
    which weren't in the appropriate directory. File renaming now works
    properly since source and destination files are in the same directory,
    and therefore on the same partition.

    Added to .gitignore temporary files generated during tests, that are
    not being removed at the end of test.

    Change-Id: I21ff81419313f4205ebe552556e27b86135fd096
    Closes-Bug: #1265190

Changed in python-keystoneclient:
status: In Progress → Fix Committed
Dolph Mathews (dolph)
Changed in python-keystoneclient:
importance: Undecided → Medium
Dolph Mathews (dolph)
Changed in python-keystoneclient:
milestone: none → 0.4.2
Changed in python-keystoneclient:
status: Fix Committed → Fix Released
status: Fix Released → Fix Committed
Dolph Mathews (dolph)
Changed in python-keystoneclient:
status: Fix Committed → 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.