fix: prevent concurrent XIP extraction race (with regression test)#797
Open
iXerol wants to merge 2 commits intoXcodesOrg:mainfrom
Open
fix: prevent concurrent XIP extraction race (with regression test)#797iXerol wants to merge 2 commits intoXcodesOrg:mainfrom
iXerol wants to merge 2 commits intoXcodesOrg:mainfrom
Conversation
…oncurrently Each XIP is now extracted into a version-specific directory (e.g. Xcode-16.0-extract/) instead of sharing the same parent directory, eliminating the race where one version's extracted Xcode.app could be moved to another version's destination path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix a race condition when installing multiple Xcode versions concurrently, and add a regression test that verifies the fix.
Root cause
Before this change, multiple
.xipextractions could share the same parent extraction location (Xcode.app/Xcode-beta.app). Under concurrent installs, one extracted app could be moved to another version's destination, causing rename/move conflicts and failed installs.Changes
Xcode-<version>-extract/test_UnarchiveAndMoveXIP_ConcurrentInstalls_DoNotShareExtractionDirectoryValidation
xcodebuild test -project Xcodes.xcodeproj -scheme Xcodes -destination 'platform=macOS,arch=x86_64' -only-testing:XcodesTests/AppStateTests/test_UnarchiveAndMoveXIP_ConcurrentInstalls_DoNotShareExtractionDirectoryHistorical reproduction (pre-fix)
I also validated equivalent behavior against pre-fix commit
1a0d335in a temporary worktree:This confirms the race was real and that this PR both fixes it and guards against regression.