Skip to content

Commit

Permalink
Only restore file permissions on Linux (#707)
Browse files Browse the repository at this point in the history
The file permissions issue that was fixed via #608 was specifically targeting Linux systems (as seen in the tests, that only test for Linux), however the permissions fix-up was applied regardless of operating system. This change ensures that the fixup is only applied on Non windows systems.
  • Loading branch information
Javagedes authored Dec 14, 2023
1 parent 18d44eb commit 5289289
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion edk2toolext/environment/extdeptypes/web_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import logging
import os
import pathlib
import platform
import shutil
import tarfile
import tempfile
Expand Down Expand Up @@ -108,8 +109,9 @@ def unpack(compressed_file_path, destination, internal_path, compression_type):
_ref.extract(member=file, path=destination)

# unzip functionality does not preserve file permissions. Fix-up the permissions
# if using a non-windows machine.
path = pathlib.Path(destination, file)
if path.is_file() and compression_type == "zip":
if path.is_file() and compression_type == "zip" and not platform.system().startswith("Win"):
expected_mode = _ref.getinfo(file).external_attr >> 16
path.chmod(expected_mode)

Expand Down

0 comments on commit 5289289

Please sign in to comment.