Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions samcli/lib/package/artifact_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,12 @@ def make_zip(file_name, source_root):
info = zipfile.ZipInfo(relative_path)
# Clear external attr set for Windows
info.external_attr = 0
# Set external attr with Unix 0005 permission
info.external_attr = 0o100005 << 16
# Set external attr with Unix 0755 permission
# Originally set to 0005 in the discussion below
# https://github.com/aws/aws-sam-cli/pull/2193#discussion_r513110608
# Changed to 0755 due to a regression in https://github.com/aws/aws-sam-cli/issues/2344
# Mimicking Unix permission bits and recommanded permission bits in the Lambda Trouble Shooting Docs
info.external_attr = 0o100755 << 16
# Set host OS to Unix
info.create_system = 3
zf.writestr(info, file_bytes)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/lib/package/test_artifact_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ def test_make_zip_windows(self, mock_system):
for info in zf.infolist():
files_in_zip.add(info.filename)
permission_bits = (info.external_attr & external_attr_mask) >> 16
self.assertEqual(permission_bits, 0o100005)
self.assertEqual(permission_bits, 0o100755)

self.assertEqual(files_in_zip, expected_files)

Expand Down