* when a file was split in two volumes, the tarinfo from the second volume was read twice
* tar iterator failed when reading an empty volume because instead of returning None, it tried to read position 0 and when reading from _Stream thats not allowed
self.delta_tar = delta_tar
self.tar_path = tar_path
self.tar_obj = None
+ self.last_member = None
self.__enter__()
def __iter__(self):
'''
Read each member and return it as a stat dict
'''
- self.last_member = tarinfo = self.tar_obj.next()
- if not tarinfo:
+ tarinfo = self.tar_obj.next()
+ if not tarinfo or tarinfo == self.last_member:
raise StopIteration
+ self.last_member = tarinfo
+
ptype = 'unknown'
if tarinfo.isfile():
ptype = 'file'
# to self.open_volume
self.volume_number += 1
self.new_volume_handler(self, self.base_name, self.volume_number)
- tarinfo = self.firstmember
+ tarinfo = self.next()
source = self.extractfile(tarinfo)
iterate = True
self.firstmember = None
return m
- # Read the next block.
- self.fileobj.seek(self.offset)
+ # Read the next block, unless there's none
+ if isinstance(self.fileobj, _Stream) and self.offset < self.fileobj.pos:
+ return None
+ else:
+ self.fileobj.seek(self.offset)
tarinfo = None
while True:
try: