diff --git a/samcli/lib/package/artifact_exporter.py b/samcli/lib/package/artifact_exporter.py index cda721299ed..60ed6733c8a 100644 --- a/samcli/lib/package/artifact_exporter.py +++ b/samcli/lib/package/artifact_exporter.py @@ -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) diff --git a/tests/unit/lib/package/test_artifact_exporter.py b/tests/unit/lib/package/test_artifact_exporter.py index d132ca01c26..5384f36e0ce 100644 --- a/tests/unit/lib/package/test_artifact_exporter.py +++ b/tests/unit/lib/package/test_artifact_exporter.py @@ -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)