Skip to content

Commit

Permalink
Preserve file permissions in zap_download.py (#30835)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksperling-apple authored and pull[bot] committed Jan 18, 2024
1 parent 487f15a commit 5761330
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/tools/zap/zap_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ def _SetupReleaseZap(install_directory: str, zap_version: str):
z = zipfile.ZipFile(io.BytesIO(r.content))

logging.info("Data downloaded, extracting ...")
z.extractall(install_directory)
# extractall() does not preserve permissions (https://github.com/python/cpython/issues/59999)
for entry in z.filelist:
path = z.extract(entry, install_directory)
os.chmod(path, (entry.external_attr >> 16) & 0o777)
logging.info("Done extracting.")


Expand Down

0 comments on commit 5761330

Please sign in to comment.