[issue34904] Crash in ZipFile.close() when writing zip file to /dev/null

Erik Bray report at bugs.python.org
Fri Oct 5 06:06:44 EDT 2018


New submission from Erik Bray <erik.m.bray at gmail.com>:

Not that there is any great reason to write a zip file to /dev/null, but I had some code that happened to do so which worked on Python 2.7, but at some point this broke:

Python 3.8.0a0 (heads/master:fc7d1b3, Oct  5 2018, 09:49:57)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import zipfile
>>> f = zipfile.ZipFile('/dev/null', 'w')
>>> f.writestr('foo.txt', 'testtesttesttesttest')
>>> f.close()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/embray/src/python/cpython/Lib/zipfile.py", line 1813, in close
    self._write_end_record()
  File "/home/embray/src/python/cpython/Lib/zipfile.py", line 1914, in _write_end_record
    endrec = struct.pack(structEndArchive, stringEndArchive,
struct.error: argument out of range

----------
components: Library (Lib)
messages: 327118
nosy: erik.bray
priority: normal
severity: normal
status: open
title: Crash in ZipFile.close() when writing zip file to /dev/null
type: crash

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34904>
_______________________________________


More information about the Python-bugs-list mailing list