lock_path(directory) fails if directory is empty

Bug #1300721 reported by Christian Schwede
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Invalid
Low
Christian Schwede

Bug Description

lock_path(directory) raises an exception if directory is empty. This happens for example if one is using swift-account-info against a database in the current working directory like this:

 swift-account-info c8bcccab3ddbfdc34b08e9223f4f5178.db

 Traceback (most recent call last):
  File "/usr/local/bin/swift-account-info", line 90, in <module>
    print_account_info(args[0], swift_dir=options.swift_dir)
  File "/usr/local/bin/swift-account-info", line 40, in print_account_info
    info = broker.get_info()
  File "/vagrant/swift/swift/account/backend.py", line 264, in get_info
    self._commit_puts_stale_ok()
  File "/vagrant/swift/swift/common/db.py", line 558, in _commit_puts_stale_ok
    self._commit_puts()
  File "/vagrant/swift/swift/common/db.py", line 529, in _commit_puts
    with lock_parent_directory(self.pending_file, self.pending_timeout):
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/vagrant/swift/swift/common/utils.py", line 1392, in lock_path
    mkdirs(directory)
  File "/vagrant/swift/swift/common/utils.py", line 572, in mkdirs
    os.makedirs(path)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
 OSError: [Errno 2] No such file or directory: ''

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (master)

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

Revision history for this message
Edward (zhang-hare) wrote :

Chris, I can't reproduce this bug on my environment.

Revision history for this message
Christian Schwede (cschwede) wrote :

Edward, thanks for looking into this! I just checked again using the latest master branch, and I don't see this bug anymore. I'll close this bug report.

Changed in swift:
status: In Progress → Invalid
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.