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

[SR-11211] Crash in WhitespaceLinter.swift, line 58 #349

Closed
ankitspd opened this issue Jul 25, 2019 · 3 comments
Closed

[SR-11211] Crash in WhitespaceLinter.swift, line 58 #349

ankitspd opened this issue Jul 25, 2019 · 3 comments
Labels
bug Something isn't working swift-format

Comments

@ankitspd
Copy link
Member

Previous ID SR-11211
Radar None
Original Reporter @aciidb0mb3r
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

swift-format 79bb590

Additional Detail from JIRA
Votes 0
Component/s swift-format
Labels Bug
Assignee dylansturg (JIRA)
Priority Medium

md5: 28277ce1f6ced9184d7825ca5e5c6948

Issue Description:

The attached file crashes swift-format:

/Users/ankit/workspace/swift.org/swift-format/.build/release/swift-format -m lint main.swift
Fatal error: Characters do not match: file /Users/ankit/workspace/swift.org/swift-format/Sources/SwiftFormatWhitespaceLinter/WhitespaceLinter.swift, line 58
[1]    12858 illegal hardware instruction  /Users/ankit/workspace/swift.org/swift-format/.build/release/swift-format -m
Application Specific Information:
Fatal error: Characters do not match: file /Users/ankit/workspace/swift.org/swift-format/Sources/SwiftFormatWhitespaceLinter/WhitespaceLinter.swift, line 58
 

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libswiftCore.dylib              0x00007fff7a8017d8 specialized _assertionFailure(_:_:file:line:flags:) + 376
1   libswiftCore.dylib              0x00007fff7a5ff859 _assertionFailure(_:_:file:line:flags:) + 25
2   swift-format                    0x00000001052edc7a WhitespaceLinter.lint() + 730
3   swift-format                    0x0000000105225eb5 SwiftLinter.lint(syntax:assumingFileURL:) + 1125 (SwiftLinter.swift:92)
4   swift-format                    0x000000010522593b SwiftLinter.lint(contentsOf:) + 923 (SwiftLinter.swift:57)
5   swift-format                    0x0000000105844652 lintMain(configuration:path:) + 386 (Run.swift:32)
6   swift-format                    0x000000010584782e main(_:) + 2222 (main.swift:41)
7   swift-format                    0x0000000105846f60 main + 32 (main.swift:132)
8   libdyld.dylib                   0x00007fff7ae893d5 start + 1
@ankitspd
Copy link
Member Author

/cc @allevato

@allevato
Copy link
Collaborator

It looks like we're not handling tab characters when we scan for runs of whitespace to diff between the original text and the formatted text, so the strings are unexpectedly out of sync.

(That's how seriously we hate tabs 😉 )

@swift-ci
Copy link

swift-ci commented Dec 5, 2019

Comment by Dylan Sturgeon (JIRA)

This should be resolved by #101.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working swift-format
Projects
None yet
Development

No branches or pull requests

3 participants