Issue 1517887: zipfile appends broken in 2.5b1 (original) (raw)
Discovered this while implementing a patch for 1514451. It doesn't matter if compression is used or not, the bug occurs either way. Test case attached. Output as below:
tom@chip:/python_bug$ ls
bug.py file_a.txt file_c.txt
tom@chip:/python_bug$ python -V
Python 2.4.3
tom@chip:/python_bug$ python bug.py
file a
file b
file c
file d
tom@chip:/python_bug$ python2.5 -V
Python 2.5b1
tom@chip:/python_bug$ python2.5 bug.py
file a
file b
Traceback (most recent call last):
File "bug.py", line 16, in
print f.read('file_c.txt').strip()
File "/usr/local/python2.5/lib/python2.5/zipfile.py",
line 482, in read
raise BadZipfile, "Bad magic number for file header"
zipfile.BadZipfile: Bad magic number for file header
tom@chip:/python_bug$