Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.9] Fix Swift SDK bundles not working due to quarantine #6427

Merged
merged 11 commits into from
May 18, 2023

Conversation

MaxDesiatov
Copy link
Contributor

@MaxDesiatov MaxDesiatov commented Apr 13, 2023

Cherry-picked from 738f5f3

When using swift experimental-sdk install subcommand with bundle archives or bundles unpacked from archives downloaded manually in the browser, installed executables are quarantined and trigger an error message when used by swift build

Steps To Reproduce:

  1. Download a destination bundle archive
  2. Unpack and install the bundle with swift experimental-destination install
  3. Confirm that the destination is installed and note its ID with swift experimental-destination list
  4. Build using the newly installed destination with swift build --experimental-destination-selector <destination-id>

Actual result:
Building with this destination triggers an error: "swift-driver cannot be opened because the developer cannot be verified."

rdar://107392863

Modifications:

Running xattr -r -d -s com.apple.quarantine on the installed bundle fixes the error. The reason is that bundles downloaded in the browser get a quarantine attribute assigned and unpacking such bundles preserves it.

"Cross-compilation destination" is a very verbose name. "Swift SDK" (note that this is distinct from just plain "SDK" used in other contexts) is a nicer alternative. Not all of the types and functions were renamed yet, especially `Destination`, which has been present in the codebase for long time. Renaming that type will be potentially source-breaking for libSwiftPM clients. This change is focused and updating user-visible strings and renaming types and functions that were only recently added. CLI subcommands were renamed accordingly.
When using `swift experimental-sdk install` subcommand with bundle archives or bundles unpacked from archives downloaded manually in the browser, installed executables are quarantined and trigger an error message when used by `swift build`

Steps To Reproduce:
1. Download a destination bundle archive
2. Unpack and install the bundle with `swift experimental-destination install`
3. Confirm that the destination is installed and note its ID with `swift experimental-destination list`
4. Build using the newly installed destination with `swift build --experimental-destination-selector <destination-id>`

Actual result:
Building with this destination triggers an error: "`swift-driver` cannot be opened because the developer cannot be verified."

rdar://107392863
@MaxDesiatov MaxDesiatov added bug swift 5.9 This PR targets the 5.9 branch labels Apr 13, 2023
@MaxDesiatov MaxDesiatov changed the base branch from maxd/5.9-swift-sdks-renaming to release/5.9 April 14, 2023 10:58
# Conflicts:
#	Sources/Basics/FileSystem/FileSystem+Extensions.swift
# Conflicts:
#	Sources/PackageModel/SwiftSDKBundle.swift
@MaxDesiatov MaxDesiatov marked this pull request as draft May 11, 2023 13:23
@MaxDesiatov
Copy link
Contributor Author

Converting to a draft as it's blocked by swiftlang/swift-tools-support-core#419 and swiftlang/swift-tools-support-core#412

@MaxDesiatov MaxDesiatov marked this pull request as ready for review May 16, 2023 14:33
@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci test windows

@MaxDesiatov
Copy link
Contributor Author

@swift-ci smoke test

@MaxDesiatov
Copy link
Contributor Author

@swift-ci test windows

@MaxDesiatov MaxDesiatov merged commit 5db2228 into release/5.9 May 18, 2023
@MaxDesiatov MaxDesiatov deleted the maxd/5.9-fix-quarantine-error branch May 18, 2023 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cross-compilation swift 5.9 This PR targets the 5.9 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants