[New-bugs-announce] [issue25624] shutil.make_archive makes invalid directory entries

Dingyuan Wang report at bugs.python.org
Sat Nov 14 04:25:24 EST 2015


New submission from Dingyuan Wang:

The _make_zipfile in shutil uses ZIP_DEFLATED compression by default, and the fix introduced by #24982 adds directory entries. In zipfile.ZipFile.write, directories is added as 0 file_size, 0 compress_size, regardless of the compression method. Deflate will compress an empty string as \x03\x00, thus the directory entries become incorrect.

The command line interface of zipfile is correct. Shutil can be fixed as zipfile.main. As a directory entry with compression methods other than ZIP_STORED is meaningless, zipfile.write and (maybe) zipfile.writestr should always write a ZIP_STORED header for directory entries to avoid the above problem occuring by programming mistakes.

----------
components: Library (Lib)
messages: 254647
nosy: gumblex
priority: normal
severity: normal
status: open
title: shutil.make_archive makes invalid directory entries
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25624>
_______________________________________


More information about the New-bugs-announce mailing list