Skip to content

Tighten up some logic around file permissions#662

Merged
jakepetroules merged 1 commit into
swiftlang:mainfrom
jakepetroules:eng/PR-154663442
Jul 28, 2025
Merged

Tighten up some logic around file permissions#662
jakepetroules merged 1 commit into
swiftlang:mainfrom
jakepetroules:eng/PR-154663442

Conversation

@jakepetroules

@jakepetroules jakepetroules commented Jul 21, 2025

Copy link
Copy Markdown
Collaborator

Fix a regression (from #565) in PbxCp which caused files to inappropriately gain the execute bit. isExecutable is conceptually a higher level operation which (per POSIX) can return true even if the file has no execute permission bits set:

"If execute permission is requested, access shall be granted if execute permission is granted to at least one user by the file permission bits or by an alternate access control mechanism"

No test because it's not clear what the concrete conditions are under which this occurs. That said, copying now checks against the owner permission bit specifically, as that's the actual intent of what the code is meaning to do and matches the original behavior.

Additionally, fix some missing permission information in getFileInfo for the PseudoFS implementation and increase test coverage a bit. Avoids it coming back to bite later.

rdar://154663442

Fix a regression in PbxCp which caused files to inappropriately gain the execute bit. `isExecutable` is conceptually a higher level operation which (per POSIX) can return true even if the file has no execute permission bits set:

"If execute permission is requested, access shall be granted if execute permission is granted to at least one user by the file permission bits or by an alternate access control mechanism"

No test because it's not clear what the concrete conditions are under which this occurs. That said, copying now checks against the owner permission bit specifically, as that's the actual intent of what the code is meaning to do and matches the original behavior.

Additionally, fix some missing permission information in getFileInfo for the PseudoFS implementation and increase test coverage a bit. Avoids it coming back to bite later.

rdar://154663442
@jakepetroules

Copy link
Copy Markdown
Collaborator Author

@swift-ci test

@jakepetroules

Copy link
Copy Markdown
Collaborator Author

@swift-ci test linux

@jakepetroules jakepetroules enabled auto-merge (rebase) July 21, 2025 21:01
@jakepetroules

Copy link
Copy Markdown
Collaborator Author

@swift-ci test

@jakepetroules

Copy link
Copy Markdown
Collaborator Author

@swift-ci test linux

1 similar comment
@jakepetroules

Copy link
Copy Markdown
Collaborator Author

@swift-ci test linux

@jakepetroules jakepetroules merged commit 2063169 into swiftlang:main Jul 28, 2025
24 checks passed
@jakepetroules jakepetroules deleted the eng/PR-154663442 branch July 28, 2025 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants