[issue18262] ZipInfo.external_attr are not documented
New submission from anatoly techtonik:
zipfile doesn't restore file attributes when extracting. Documentation should at least contain example how to do this manually, because the ony way to do this - through ZipInfo.external_attr is too cryptic.
----------
assignee: docs@python
components: Documentation
messages: 191447
nosy: docs@python, techtonik
priority: normal
severity: normal
status: open
title: ZipInfo.external_attr are not documented
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
_______________________________________
Python tracker
anatoly techtonik added the comment:
Here is the doc -
http://stackoverflow.com/questions/434641/how-do-i-set-permissions-attribute...
----------
_______________________________________
Python tracker
Ronald Oussoren added the comment:
I'd be +1 on extending the zipfile API in 3.4 (with a documentation update in older releases as suggested by anatoly):
* Add a method or property to ZipInfo for (un)packing
the external_attr field
* Add an keyword argument to Zipfile.extract and Zipfile.extractall that
toggles restoring file permissions. This should be off by default for
backward compatibility.
The code that restores the file permissions should be careful to avoid
security problems, IMHO it should by default ignore the SUID en SGID
bits.
----------
components: +Library (Lib)
nosy: +ronaldoussoren
stage: -> needs patch
type: -> enhancement
versions: -Python 3.5
_______________________________________
Python tracker
Ronald Oussoren added the comment:
See also #15795
----------
_______________________________________
Python tracker
Ronald Oussoren added the comment:
Closing this as a duplicate of #15795 (which already has a patch)
----------
resolution: -> duplicate
superseder: -> Zipfile.extractall does not preserve file permissions
_______________________________________
Python tracker
anatoly techtonik added the comment:
3.4+ feature is not a replacement for proper documentation for 2.7-3.4
----------
resolution: duplicate ->
_______________________________________
Python tracker
Alex Lord added the comment:
Here's a documentation patch for 2.7 that informs the users that Zipfile.extra and Zipfile.extraall don't save permissions and that Zipfile.writestr will use ZipInfo.extra_attr or default to chmod permission set of 0600.
----------
keywords: +patch
nosy: +Alex.Lord
versions: -Python 2.6, Python 3.1, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file34858/Issue18262_27.patch
_______________________________________
Python tracker
Alex Lord added the comment:
And here's the 3.4 and 3.5 patch
----------
Added file: http://bugs.python.org/file34859/Issue18262_34_35.patch
_______________________________________
Python tracker
Alex Lord added the comment:
Any follow up on this?
----------
_______________________________________
Python tracker
Changes by Ned Deily
Changes by Ned Deily
Changes by Serhiy Storchaka
Pavol Babinčák
participants (6)
-
Alex Lord
-
anatoly techtonik
-
Ned Deily
-
Pavol Babinčák
-
Ronald Oussoren
-
Serhiy Storchaka