classification
Title: ZipInfo.external_attr are not documented
Type: enhancement Stage: patch review
Components: Documentation, Library (Lib) Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder: Zipfile.extractall does not preserve file permissions
View: 15795
Assigned To: serhiy.storchaka Nosy List: Alex.LordThorsen, alanmcintyre, docs@python, ronaldoussoren, scrool, serhiy.storchaka, techtonik, twouters
Priority: normal Keywords: patch

Created on 2013-06-19 06:19 by techtonik, last changed 2020-05-17 14:25 by scrool.

Files
File name Uploaded Description Edit
Issue18262_27.patch Alex.LordThorsen, 2014-04-14 22:53 python 2.7 documentation patch review
Issue18262_34_35.patch Alex.LordThorsen, 2014-04-14 22:54 python 3.x zipfile documentation patch review
Messages (10)
msg191447 - (view) Author: anatoly techtonik (techtonik) Date: 2013-06-19 06:19
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.
msg191451 - (view) Author: anatoly techtonik (techtonik) Date: 2013-06-19 07:01
Here is the doc - 
http://stackoverflow.com/questions/434641/how-do-i-set-permissions-attributes-on-a-file-in-a-zip-file-using-pythons-zip/6297838#6297838
msg191456 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2013-06-19 08:24
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.
msg191457 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2013-06-19 08:24
See also #15795
msg191458 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2013-06-19 08:26
Closing this as a duplicate of #15795 (which already has a patch)
msg191488 - (view) Author: anatoly techtonik (techtonik) Date: 2013-06-19 18:22
3.4+ feature is not a replacement for proper documentation for 2.7-3.4
msg216246 - (view) Author: Alex LordThorsen (Alex.LordThorsen) * Date: 2014-04-14 22:53
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.
msg216247 - (view) Author: Alex LordThorsen (Alex.LordThorsen) * Date: 2014-04-14 22:54
And here's the 3.4 and 3.5 patch
msg241314 - (view) Author: Alex LordThorsen (Alex.LordThorsen) * Date: 2015-04-17 05:19
Any follow up on this?
msg369122 - (view) Author: Pavol Babinčák (scrool) * Date: 2020-05-17 14:25
I'm interested in this documentation enhancement as well.

Alex, I'm wondering if you could convert your patch to GitHub? [1]


[1] https://devguide.python.org/pullrequest/#converting-an-existing-patch-from-b-p-o-to-github
History
Date User Action Args
2020-05-17 14:25:40scroolsetnosy: + scrool
messages: + msg369122
2015-04-17 22:54:45serhiy.storchakasetassignee: docs@python -> serhiy.storchaka
2015-04-17 05:22:42ned.deilysetstage: needs patch -> patch review
versions: + Python 3.4, Python 3.5
2015-04-17 05:22:07ned.deilysetnosy: + twouters, alanmcintyre, serhiy.storchaka
2015-04-17 05:19:32Alex.LordThorsensetmessages: + msg241314
2014-04-14 22:54:32Alex.LordThorsensetfiles: + Issue18262_34_35.patch

messages: + msg216247
2014-04-14 22:53:44Alex.LordThorsensetfiles: + Issue18262_27.patch
versions: - Python 2.6, Python 3.1, Python 3.2, Python 3.3, Python 3.4
nosy: + Alex.LordThorsen

messages: + msg216246

keywords: + patch
2013-06-19 18:22:03techtoniksetresolution: duplicate ->
messages: + msg191488
2013-06-19 08:26:50ronaldoussorensetsuperseder: Zipfile.extractall does not preserve file permissions
resolution: duplicate
messages: + msg191458
2013-06-19 08:24:51ronaldoussorensetmessages: + msg191457
2013-06-19 08:24:16ronaldoussorensettype: enhancement
components: + Library (Lib)
versions: - Python 3.5
nosy: + ronaldoussoren

messages: + msg191456
stage: needs patch
2013-06-19 07:01:18techtoniksetmessages: + msg191451
2013-06-19 06:19:22techtonikcreate