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
swiftlint 0.54.0 #153931
base: master
Are you sure you want to change the base?
swiftlint 0.54.0 #153931
Conversation
|
ade304f
to
6d01d42
Compare
relates to: |
@chenrui333 thanks for making the update to the required Xcode version. Are you saying that SwiftLint 0.54.0 is blocked on #143762 or #152643? |
Does Homebrew not support CLI tools using Swift Macros? 🤔 |
nope, just not gonna be built with linux |
that i have to defer to @Bo98 |
We have our own sandbox and macOS doesn't support nested sandboxes. I'm guessing something isn't respecting |
Are any other homebrew formulas using Swift Macros or are we breaking new ground here? |
@Bo98 Swift macros are plugins invoked by the Swift compiler when building Swift code, so that process could definitely be breaking the homebrew sandbox rules. Perhaps the homebrew sandboxing rules will need to be adjusted to add support for Swift macros? |
I'm not sure.
macOS doesn't support nested sandboxing at all AFAIK so no rule can allow that. Not being able to disable the sandbox seems like a bug, given Swift Package Manger has always made sure to have conditionals to do so: https://github.com/apple/swift-package-manager/blob/4c3549144733d8042a0c08d59938b505431cf12c/Sources/Workspace/DefaultPluginScriptRunner.swift#L446 |
Ok I found the unconditional Sandbox - it's the first one that's on compiler level: https://github.com/apple/swift/blob/swift-5.9-RELEASE/lib/AST/PluginRegistry.cpp#L148. I'll ask about and see if there's anything that can be done about it. |
d730628
to
34c1059
Compare
I wanted to see if building with Bazel avoided the sandbox issue, but it's still there, which makes sense since this is baked into the Swift compiler. |
34c1059
to
3a0e4bc
Compare
Ok I've let the relevant people aware that we (and likely MacPorts who also ship swiftlint) are affected by this. For now consider this tracked under FB13373741. A basic step to reproduce is Not really related but: this pull request does remind me we don't have Xcode 15 on the macOS 13 machines yet, probably because we were waiting for the linker bugfixes in Xcode 15.1. Will have a look and see about maybe using the beta, not that it matters here just yet. |
Thanks for filing feedback with apple about this. Any Swift package with macros will fail when building with For example, a pretty minimal project: https://github.com/alvmo/HexColors $ sandbox-exec -p '(version 1)(allow default)' swift build --disable-sandbox
Fetching https://github.com/apple/swift-syntax.git from cache
Fetched https://github.com/apple/swift-syntax.git (1.50s)
Computing version for https://github.com/apple/swift-syntax.git
Computed https://github.com/apple/swift-syntax.git at 509.0.0 (0.70s)
Creating working copy for https://github.com/apple/swift-syntax.git
Working copy of https://github.com/apple/swift-syntax.git resolved at 509.0.0
Building for debugging...
sandbox-exec: sandbox_apply: Operation not permitted
<unknown>:0: warning: compiler plugin not loaded: '/Users/jp/src/HexColors/.build/arm64-apple-macosx/debug/HexColorsMacros; failed to initialize
/Users/jp/src/HexColors/Sources/HexColors/HexColors.swift:7:14: warning: external macro implementation type 'HexColorsMacros.ColorHexMacro' could not be found for macro 'color'
public macro color(_ stringLiteral: StringLiteralType ) -> Color = #externalMacro(module: "HexColorsMacros", type: "ColorHexMacro")
^
/Users/jp/src/HexColors/Sources/HexColors/HexColors.swift:10:14: warning: external macro implementation type 'HexColorsMacros.HexIntExpressionMacro' could not be found for macro 'color'
public macro color(_ hexadecimalIntegerLiteral: IntegerLiteralType ) -> Color = #externalMacro(module: "HexColorsMacros", type: "HexIntExpressionMacro")
^
/Users/jp/src/HexColors/Sources/HexColors/HexColors.swift:28:14: warning: external macro implementation type 'HexColorsMacros.NSColorHexMacro' could not be found for macro 'nsColor'
public macro nsColor(_ stringLiteral: StringLiteralType ) -> NSColor = #externalMacro(module: "HexColorsMacros", type: "NSColorHexMacro")
^
/Users/jp/src/HexColors/Sources/HexColors/HexColors.swift:32:14: warning: external macro implementation type 'HexColorsMacros.NSColorHexMacro' could not be found for macro 'nsColor'
public macro nsColor(_ hexadecimalIntegerLiteral: IntegerLiteralType ) -> NSColor = #externalMacro(module: "HexColorsMacros", type: "NSColorHexMacro")
^
/Users/jp/src/HexColors/Sources/HexColors/HexColors.swift:40:14: warning: external macro implementation type 'HexColorsMacros.CGColorHexMacro' could not be found for macro 'cgColor'
public macro cgColor(_ stringLiteral: StringLiteralType ) -> CGColor = #externalMacro(module: "HexColorsMacros", type: "CGColorHexMacro")
^
/Users/jp/src/HexColors/Sources/HexColors/HexColors.swift:43:14: warning: external macro implementation type 'HexColorsMacros.CGColorHexMacro' could not be found for macro 'cgColor'
public macro cgColor(_ hexadecimalIntegerLiteral: IntegerLiteralType ) -> CGColor = #externalMacro(module: "HexColorsMacros", type: "CGColorHexMacro")
^
sandbox-exec: sandbox_apply: Operation not permitted
<unknown>:0: warning: compiler plugin not loaded: '/Users/jp/src/HexColors/.build/arm64-apple-macosx/debug/HexColorsMacros; failed to initialize
/Users/jp/src/HexColors/Sources/HexColors/HexColors.swift:7:14: warning: external macro implementation type 'HexColorsMacros.ColorHexMacro' could not be found for macro 'color'
public macro color(_ stringLiteral: StringLiteralType ) -> Color = #externalMacro(module: "HexColorsMacros", type: "ColorHexMacro")
^
/Users/jp/src/HexColors/Sources/HexColors/HexColors.swift:10:14: warning: external macro implementation type 'HexColorsMacros.HexIntExpressionMacro' could not be found for macro 'color'
public macro color(_ hexadecimalIntegerLiteral: IntegerLiteralType ) -> Color = #externalMacro(module: "HexColorsMacros", type: "HexIntExpressionMacro")
^
/Users/jp/src/HexColors/Sources/HexColors/HexColors.swift:28:14: warning: external macro implementation type 'HexColorsMacros.NSColorHexMacro' could not be found for macro 'nsColor'
public macro nsColor(_ stringLiteral: StringLiteralType ) -> NSColor = #externalMacro(module: "HexColorsMacros", type: "NSColorHexMacro")
^
/Users/jp/src/HexColors/Sources/HexColors/HexColors.swift:32:14: warning: external macro implementation type 'HexColorsMacros.NSColorHexMacro' could not be found for macro 'nsColor'
public macro nsColor(_ hexadecimalIntegerLiteral: IntegerLiteralType ) -> NSColor = #externalMacro(module: "HexColorsMacros", type: "NSColorHexMacro")
^
/Users/jp/src/HexColors/Sources/HexColors/HexColors.swift:40:14: warning: external macro implementation type 'HexColorsMacros.CGColorHexMacro' could not be found for macro 'cgColor'
public macro cgColor(_ stringLiteral: StringLiteralType ) -> CGColor = #externalMacro(module: "HexColorsMacros", type: "CGColorHexMacro")
^
/Users/jp/src/HexColors/Sources/HexColors/HexColors.swift:43:14: warning: external macro implementation type 'HexColorsMacros.CGColorHexMacro' could not be found for macro 'cgColor'
public macro cgColor(_ hexadecimalIntegerLiteral: IntegerLiteralType ) -> CGColor = #externalMacro(module: "HexColorsMacros", type: "CGColorHexMacro")
^
Build complete! (34.80s) I'm assuming there's no way to release this version of SwiftLint via Homebrew given this sandbox violation? It's unfortunate to tell our users they can't use Homebrew to update to the latest version of SwiftLint until Swift has a new stable release that supports disabling this sandbox. |
I've also filed an issue in SwiftPM, which can be easier to track for non-Apple folks than the feedback you filed: apple/swift-package-manager#7098 |
Swift 5.9.2 will be out (likely) next month and will be the last 5.9.x release shipped with Xcode. I however obviously don't know yet if there will be a fix in time. After that, there is usually no further Xcode updates until March/April. I've let our contact know as usual, but of course timeframes are something never discussed. If it became clear that it won't be fixed in the short term, there are more drastic actions we could take such as potentially patching it out ourselves in our own compiler build and using that. I'll look into fixing up Linux this week and see where things are at. |
Support has landed in SwiftPM: apple/swift-package-manager#7167 Hopefully the next minor Xcode release will include a toolchain with that. So 15.2 which according to past years release cadence should be expected around March. |
Can now be rebased with latest Swift. |
The issues on the macOS side should be fixed in Xcode 15.3 (though I'll need to confirm this) so we are waiting for that. |
3a0e4bc
to
e5f2f8a
Compare
d942f6c
to
69d4cb3
Compare
Co-authored-by: Bo Anderson <mail@boanderson.me> Signed-off-by: Michael Cho <michael@michaelcho.dev>
69d4cb3
to
8931fd4
Compare
The Linux CI job appears to be failing because it can't download the SwiftPM plugin binary artifact:
Possibly related to sandboxing limitations? Can we just disable the Linux CI job to unblock this? Finally the macOS CI job is passing now that it runs with Xcode 15.3 🥳 |
Linux doesn't have a sandbox at all. Is there a reason we're downloading macOS artifacts on Linux? |
This is a bug in Swift Package Manager. There is a workaround in the 0.55.0 line. How about skipping 0.54.0 in Homebrew entirely and continue with the (not yet released) 0.55.0 version? |
We can, as soon as 0.55.0 is tagged. We do not ship unstable versions. |
Created with
brew bump-formula-pr
.