Menu

zipfile Never Writes the Zip's Executable Bit to Disk
πŸ“°

zipfile Never Writes the Zip's Executable Bit to Disk

DEV Community: cicdΒ·Mustafa ERBAYΒ·about 16 hours ago
#6UlRHMEz
#devtocicd#devto#dev#archive#file
Long article (3383 words) β€” no AI summary yet.
Reading 0:00
15s threshold

If you have unpacked a deployment bundle, called the installer script inside it and got

back "permission denied", the first suspect is usually the archive: was the bit wrong on

the machine that packed it, or does zip simply not carry the execute permission?

It carries it. A zip archive holds the Unix mode for every entry; the tool that opens the

archive is the one that loses it. Opening the same archive on the same machine with two

tools gave me -rwxr-xr-x in one case and -rw-r--r-- in the other. The archive was

identical both times. And the mode that landed on disk did not come from the archive at

all β€” it came from the umask of the machine doing the extraction .

The irritating part is that this is written down nowhere. On Python's zipfile

documentation page β€” on both of today's pages, 3.13.18 and 3.15.2 β€” the word "permission"

does not appear at all .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.