summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2017-07-28 15:59:50 +0100
committerJürg Billeter <j@bitron.ch>2017-07-28 16:03:18 +0100
commit2179f547262c1a4fc5aa31a9f08ffb07303cf16e (patch)
treee6af103615e8f1998394ef3f6b71435140ca2736
parent332fed488a8b8af995dbd346654b157b75846adf (diff)
downloadbuildstream-2179f547262c1a4fc5aa31a9f08ffb07303cf16e.tar.gz
_artifactcache/pushreceive.py: Ensure stream is at the right position
-rw-r--r--buildstream/_artifactcache/pushreceive.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/buildstream/_artifactcache/pushreceive.py b/buildstream/_artifactcache/pushreceive.py
index 5e83c1c99..e0f49d03d 100644
--- a/buildstream/_artifactcache/pushreceive.py
+++ b/buildstream/_artifactcache/pushreceive.py
@@ -282,8 +282,15 @@ class PushMessageReader(object):
# This should block while tar.next() reads the next
# tar object from the stream.
while True:
+ filepos = tar.fileobj.tell()
tar_info = tar.next()
if not tar_info:
+ # End of stream marker consists of two 512 Byte blocks.
+ # Current Python tarfile stops reading after the first block.
+ # Read the second block as well to ensure the stream is at
+ # the right position for following messages.
+ if tar.fileobj.tell() - filepos == 512:
+ tar.fileobj.read(512)
break
tar.extract(tar_info, self.tmpdir)