diff -urN Python-2.5.2/Lib/gzip.py Python-2.5.2-gzip/Lib/gzip.py --- Python-2.5.2/Lib/gzip.py 2006-08-02 06:12:36.000000000 +0200 +++ Python-2.5.2-gzip/Lib/gzip.py 2008-05-13 23:58:11.867744000 +0200 @@ -311,6 +311,18 @@ raise IOError, "CRC check failed" elif isize != LOWU32(self.size): raise IOError, "Incorrect length of data produced" + # It might happen that gzip files are padded with zeroes. + # http://www.gzip.org/#faq8, but they can still contain multiple + # archives. To simulate the behaviour of any decent gzip, we will + # consume all zero bytes here and set file position to the first + # non-zero byte. + s = '\000' + while s and s == '\000': + s = self.fileobj.read(1) + if s: + # Haven't hit EOF... need to rewind one character back since it can + # be the begining of another archive. + self.fileobj.seek(-1, 1) def close(self): if self.mode == WRITE: