SwiftFormat: SwiftFormat crashes on launch due to invalid signature
Podfile contains pod 'SwiftFormat/CLI'
We run a CI job every Sunday to auto-format our code with SwiftFormat. It passed on Dec 23, 2018 12:32 AM but failed on next run at Dec 30, 2018 12:32 AM. The executable just crashes instantly on launch. I can repro locally on my MBP with 10.14.2 (18C54).
Version 0.35.6 and 0.37.1 are affected (I just tried running pod update as we were using an old version of SwiftFormat).
$ ./Pods/SwiftFormat/CommandLineTool/swiftformat
Killed: 9
$ lldb ./Pods/SwiftFormat/CommandLineTool/swiftformat
(lldb) target create "./Pods/SwiftFormat/CommandLineTool/swiftformat"
Current executable set to './Pods/SwiftFormat/CommandLineTool/swiftformat' (x86_64).
(lldb) r
error: process exited with status -1 (unable to attach)
Crash logs are created in ~/Library/Logs/DiagnosticReports:
Process: swiftformat [25065]
Path: /Users/USER/*/swiftformat
Identifier: swiftformat
Version: ???
Code Type: X86-64 (Native)
Parent Process: bash [9970]
Responsible: swiftformat [25065]
User ID: 501
Date/Time: 2018-12-30 14:28:21.830 -0800
OS Version: Mac OS X 10.14.2 (18C54)
Report Version: 12
Bridge OS Version: 3.0 (14Y674)
Anonymous UUID: 8618749C-55BE-49B0-D91A-6F09D9DE37EE
Sleep/Wake UUID: 98FD6B43-A7EA-4AF3-AFC3-F7BE3FEA5A2B
Time Awake Since Boot: 23000 seconds
Time Since Wake: 1900 seconds
System Integrity Protection: enabled
Crashed Thread: Unknown
Exception Type: EXC_CRASH (Code Signature Invalid)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace CODESIGNING, Code 0x1
kernel messages:
Backtrace not available
Unknown thread crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000000000000 rcx: 0x0000000000000000 rdx: 0x0000000000000000
rdi: 0x0000000000000000 rsi: 0x0000000000000000 rbp: 0x0000000000000000 rsp: 0x00007ffee37faa30
r8: 0x0000000000000000 r9: 0x0000000000000000 r10: 0x0000000000000000 r11: 0x0000000000000000
r12: 0x0000000000000000 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x0000000000000000
rip: 0x0000000112eb7000 rfl: 0x0000000000000200 cr2: 0x0000000000000000
Logical CPU: 0
Error Code: 0x00000000
Trap Number: 0
Binary images description not available
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 17217
thread_create: 0
thread_set_state: 0
Here’s the code-signing info:
$ codesign -dvvv ./Pods/SwiftFormat/CommandLineTool/swiftformat
Executable=/Users/pol/Source/ios_client/Pods/SwiftFormat/CommandLineTool/swiftformat
Identifier=swiftformat
Format=Mach-O thin (x86_64)
CodeDirectory v=20200 size=87691 flags=0x0(none) hashes=2733+5 location=embedded
Hash type=sha256 size=32
CandidateCDHash sha1=253b388fb4856a62c5e8cbfa17f148b5d5bb481b
CandidateCDHash sha256=0f90651f795ac74b5f3a0baf853b092ea8b2c71a
Hash choices=sha1,sha256
CDHash=0f90651f795ac74b5f3a0baf853b092ea8b2c71a
Signature size=4778
Authority=(unavailable)
Info.plist=not bound
TeamIdentifier=8VQKF583ED
Sealed Resources=none
Internal requirements count=1 size=172
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 18 (9 by maintainers)
Works for me:
You should have to codesign your tool. The ones provided as part of the OS are signed but third party ones are not to my knowledge. It’s more hassle than it’s worth at this time.
Anyway, removing the signature from the tool makes it work again: