ZipFile and file rigths

Robert Kern rkern at ucsd.edu
Sun Jul 10 18:39:45 EDT 2005


perchef wrote:

[Sybren Stuvel:]
>>ZIP doesn't store file permissions.

Yes, the .zip file format does store file permissions appropriate to the 
platform that generates the file.

> ok, but in that case how could stuffit retrieve these permissions ?
> 
> Thanks for the link Robert.

When one makes a .zip file using ZipFile, the permissions are stored, 
but there is also a flag that tells unzip utilities what system the .zip 
file was made on. ZipFile always stores this flag as MS Windows no 
matter what system actually made it. StuffIt seems to ignore the flag 
and always propagate the permissions when it unzips. It assumes that the 
.zip file was made on a Mac. InfoZip's unzip(1) utility does look at the 
flag, and if it says "MS Windows", it does not propagate the 
permissions. If the .zip file actually *were* made on a Windows machine 
and unzipped on a UNIX-like filesystem, all of the files would be marked 
executable. I remember this used to happen quite often a few years ago. 
InfoZip made an arguably incorrect choice (but also a fairly convenient 
one), but ZipFile's behavior is definitely incorrect.

OTOH, I don't know if this has any relevance to the problem that you are 
seeing.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Python-list mailing list