[issue15795] Zipfile.extractall does not preserve file permissions
New submission from Alexey Boriskin: Zipfile._extract_member does not preserve file permissions while extracting it. As may be seen at link[1], raw open() is used and no os.chmod() applied after that, therefore any permission data stored in zipfile is dropped and file is created with default permission depending on current user's umask. [1] http://hg.python.org/cpython/file/52159aa5d401/Lib/zipfile.py#l1251 -- components: Library (Lib) messages: 169233 nosy: uruz priority: normal severity: normal status: open title: Zipfile.extractall does not preserve file permissions type: behavior versions: Python 2.7, Python 3.4 ___ Python tracker <http://bugs.python.org/issue15795> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15795] Zipfile.extractall does not preserve file permissions
Changes by Alexey Boriskin : -- hgrepos: +147 ___ Python tracker <http://bugs.python.org/issue15795> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15795] Zipfile.extractall does not preserve file permissions
Alexey Boriskin added the comment: I'm attaching a patch, which solves the issue. Patch intoduces new argument "preserve_permissions" for extract and extractall methods. That argument may accept one of the three values: do not preserve permissions, preserve a safe subset of them or preserve all permissions. Three constants introduced for these options. Patch also contains test and docs. Tests pass for me on OS X 10.5, but I'm not sure if they'll pass on other operating systems. -- keywords: +patch Added file: http://bugs.python.org/file27086/issue15795.patch ___ Python tracker <http://bugs.python.org/issue15795> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15795] Zipfile.extractall does not preserve file permissions
Alexey Boriskin added the comment: I'm working on updating the patch to unify tarfile and zipfile interfaces and to restore owner/timestamp for zipfile -- ___ Python tracker <http://bugs.python.org/issue15795> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com