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 30, 2024
1 parent ecba303 commit e18366c
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 e18366c

Please sign in to comment.