Closed
Description
When applying swift-format to my project it crashes with following stack trace:
💣 Program crashed: System trap at 0x0000aaaac5d215e0
Thread 0 "swift-format" crashed:
0 WhitespaceLinter.contiguousWhitespace(startingAt:in:) in swift-format at /home/build-user/swift-format/Sources/SwiftFormat/PrettyPrint/WhitespaceLinter.swift:327:11
1 WhitespaceLinter.lint() + 660 in swift-format at /home/build-user/swift-format/Sources/SwiftFormat/PrettyPrint/WhitespaceLinter.swift:56:33
2 SwiftLinter.lint(syntax:operatorTable:assumingFileURL:source:) + 715 in swift-format at /home/build-user/swift-format/Sources/SwiftFormat/API/SwiftLinter.swift:155:8
3 SwiftLinter.lint(source:assumingFileURL:parsingDiagnosticHandler:) + 307 in swift-format at /home/build-user/swift-format/Sources/SwiftFormat/API/SwiftLinter.swift:101:9
4 LintFrontend.processFile(_:) + 555 in swift-format at /home/build-user/swift-format/Sources/swift-format/Frontend/LintFrontend.swift:33:18
5 specialized Sequence.forEach(_:) + 2491 in swift-format at /home/build-user/swift-format/Sources/swift-format/Frontend/Frontend.swift:153:18
6 implicit closure #7 in Frontend.processURLs(_:parallel:) in swift-format at /home/build-user/swift-format/Sources/swift-format/Frontend/Frontend.swift:153:10
7 Frontend.processURLs(_:parallel:) + 699 in swift-format at /home/build-user/swift-format/Sources/swift-format/Frontend/Frontend.swift:153:18
8 Frontend.run() + 199 in swift-format at /home/build-user/swift-format/Sources/swift-format/Frontend/Frontend.swift:102:7
9 closure #1 in SwiftFormatCommand.Lint.run() + 123 in swift-format at /home/build-user/swift-format/Sources/swift-format/Subcommands/Lint.swift:37:18
10 specialized PerformanceMeasurementsOptions.printingInstructionCountIfRequested<A>(_:) in swift-format at Sources/swift-format/Subcommands/PerformanceMeasurement.swift:24:18
11 SwiftFormatCommand.Lint.run() + 175 in swift-format at /home/build-user/swift-format/Sources/swift-format/Subcommands/Lint.swift:35:41
12 0x0000ffff938f84c4 <unknown> in libc.so.6
13 0x0000ffff938f8598 <unknown> in libc.so.6
Here's how you can reproduce the crash:
# Clone the repository
git clone https://github.com/seemoo-lab/CellGuard.git
# Run swift-format included with the latest swift Docker container
docker run --rm -it -v $(pwd)/CellGuard:/app:ro swift:latest
# Inside the container go to the mounted directory
cd /app/CellGuardAppSwift
# Run swift-format
swift format lint -r .
# At some point, you'll encounter this crash
Best
Lukas
Metadata
Metadata
Assignees
Labels
No labels