Fix deadlock when extracting 0 sized files from remote repositories

This commit is contained in:
Jonas Borgström 2014-01-30 22:16:21 +01:00
parent 2068e7cf34
commit 50cabd53b1
3 changed files with 6 additions and 2 deletions

View File

@ -6,8 +6,9 @@ Here you can see the full list of changes between each Attic release.
Version 0.10 Version 0.10
------------ ------------
(feature release, released on X) (bugfix release, released on Jan 30, 2014)
- Fix deadlock when extracting 0 sized files from remote repositories
- "--exclude" wildcard patterns are now properly applied to the full path - "--exclude" wildcard patterns are now properly applied to the full path
not just the file name part (#5). not just the file name part (#5).
- Make source code endianness agnostic (#1) - Make source code endianness agnostic (#1)

View File

@ -111,6 +111,8 @@ class RemoteRepository(object):
return resp return resp
def call_many(self, cmd, calls, wait=True, is_preloaded=False): def call_many(self, cmd, calls, wait=True, is_preloaded=False):
if not calls:
return
def fetch_from_cache(args): def fetch_from_cache(args):
msgid = self.cache[args].pop(0) msgid = self.cache[args].pop(0)
if not self.cache[args]: if not self.cache[args]:

View File

@ -104,6 +104,7 @@ class ArchiverTestCase(AtticTestCase):
"""Create a minimal test case including all supported file types """Create a minimal test case including all supported file types
""" """
# File # File
self.create_regual_file('empty', size=0)
self.create_regual_file('file1', size=1024 * 80) self.create_regual_file('file1', size=1024 * 80)
# Directory # Directory
self.create_regual_file('dir2/file2', size=1024 * 80) self.create_regual_file('dir2/file2', size=1024 * 80)
@ -134,7 +135,7 @@ class ArchiverTestCase(AtticTestCase):
with changedir('output'): with changedir('output'):
self.attic('extract', self.repository_location + '::test') self.attic('extract', self.repository_location + '::test')
self.assert_equal(len(self.attic('list', self.repository_location).splitlines()), 2) self.assert_equal(len(self.attic('list', self.repository_location).splitlines()), 2)
self.assert_equal(len(self.attic('list', self.repository_location + '::test').splitlines()), 9) self.assert_equal(len(self.attic('list', self.repository_location + '::test').splitlines()), 10)
self.assert_dirs_equal('input', 'output/input') self.assert_dirs_equal('input', 'output/input')
info_output = self.attic('info', self.repository_location + '::test') info_output = self.attic('info', self.repository_location + '::test')
shutil.rmtree(self.cache_path) shutil.rmtree(self.cache_path)