[Bug]: archive extraction strips special permission bits
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- swift
- Domain
- operating-systems
Research direction
Start in ArchiveReader.setFileAttributes and inspect the ArchiveReaderTests case named preserveSpecialPermissionBits. Run swift test --disable-automatic-resolution -Xswiftc -warnings-as-errors --filter preserveSpecialPermissionBits. Done means extraction preserves the full 0o7777 POSIX permission field, including sticky and set-ID bits, while excluding unrelated file-type bits.
Written by the indexing model from the issue text.
Description
I have done the following
- I have searched the existing issues
- I reproduced the issue against
apple/containerizationmainat50f77222964ed3d01dcb53f803ea2d511656a9dc
Steps to reproduce
-
Add an
ArchiveReaderTestscase that writes a directory entry with mode01777. -
Extract the archive with
ArchiveReader. -
Read the extracted directory's
.posixPermissions. -
Run:
swift test --disable-automatic-resolution -Xswiftc -warnings-as-errors --filter preserveSpecialPermissionBits
On current main, the regression fails with:
Expectation failed: ((perms & permMask) -> 511) == (0o1777 -> 1023)
Special permission bits should be preserved
The cause is ArchiveReader.setFileAttributes, which applies entry.permissions & 0o777. That mask strips the sticky, set-user-ID, and set-group-ID bits.
Current behavior
Archive extraction preserves only ordinary owner/group/other read, write, and execute permissions. A 01777 directory is extracted as 0777; set-user-ID and set-group-ID bits are also discarded.
This is a regression in main after #816 changed the extraction mask from the full mode to 0o777.
Expected behavior
Archive extraction should preserve the full POSIX permission field (0o7777) while continuing to exclude unrelated file-type bits.
Environment
- OS: macOS 26.5.1 (25F80)
- Xcode: 26.6 (17F113)
- Swift: Apple Swift 6.3.3
- Containerization source:
apple/containerizationmainat50f77222964ed3d01dcb53f803ea2d511656a9dc
Relevant log output
Test preserveSpecialPermissionBits() recorded an issue at ArchiveReaderTests.swift
Expectation failed: ((perms & permMask) -> 511) == (0o1777 -> 1023)
Special permission bits should be preserved
Test run with 1 test in 1 suite failed with 1 issue.
Code of Conduct
- I agree to follow this project's Code of Conduct
- Dominant language
- Swift
- Stars
- 8.9k
- Forks
- 360
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 16
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apple/containerization
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apple/containerization#819 · 1 comment · 1 reaction ·
-
LinuxContainer.create() leaks the VZ VM/XPC process when vm.start() throws — no do/catch around it Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apple/containerization#804 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
apple/containerization#921 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
apple/containerization#913 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
apple/containerization#912 ·
All issues in apple/containerization
Similar issues
-
type: docs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
googleapis/google-cloud-swift#971 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mozilla-mobile/firefox-ios#35743 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
manaflow-ai/cmux#13417 ·
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ionic-team/capacitor#8616 ·