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

Recursive glob still doesn't work #3891

Closed
2 tasks done
pomozoff opened this issue Mar 11, 2022 · 6 comments · Fixed by #3892
Closed
2 tasks done

Recursive glob still doesn't work #3891

pomozoff opened this issue Mar 11, 2022 · 6 comments · Fixed by #3892

Comments

@pomozoff
Copy link

pomozoff commented Mar 11, 2022

New Issue Checklist

Describe the bug

excluded: doesn't work recursively

Complete output when running SwiftLint, including the stack trace and command used
$ tree .
.
├── another
│   └── 2.swift
└── classes
    ├── 3.swift
    └── tests
        ├── R.generated.swift
        └── unit
            └── Mocks.generated.swift

4 directories, 4 files

$ cat .swiftlint.yml
excluded:
  - "*.generated.swift"
  - "**/*.generated.swift"
  - "**/*/*.generated.swift"

$ swiftlint --config .swiftlint.yml
Linting Swift files in current working directory
Linting 'Mocks.generated.swift' (1/3)
Linting '3.swift' (2/3)
Linting '2.swift' (3/3)
Done linting! Found 0 violations, 0 serious in 3 files.

Environment

  • SwiftLint version - 0.46.5
  • Installation method used - Homebrew
  • Paste your configuration file:
excluded:
  - "*.generated.swift"
  - "**/*.generated.swift"
  - "**/*/*.generated.swift"
  • Are you using nested configurations? NO
    If so, paste their relative paths and respective contents.
  • Which Xcode version are you using (check xcodebuild -version)? - Xcode 13.2.1 Build version 13C100
  • Do you have a sample that shows the issue? Look above
@jpsim
Copy link
Collaborator

jpsim commented Mar 11, 2022

Please try again with a build from the master branch.

@pomozoff
Copy link
Author

/usr/local/bin/swiftlint --config .swiftlint.yml
Linting Swift files in current working directory
[1]    36842 illegal hardware instruction  /usr/local/bin/swiftlint --config .swiftlint.yml

@jpsim
Copy link
Collaborator

jpsim commented Mar 11, 2022

You found a crash! I'd really appreciate if you could share more information about it.

You can follow these steps to build and run in Xcode, which should pause the debugger when the crash happens: https://github.com/realm/SwiftLint/blob/master/CONTRIBUTING.md#building-and-running-locally

@jpsim
Copy link
Collaborator

jpsim commented Mar 11, 2022

Actually, I was able to reproduce it thanks to your detailed report.

It's crashing here: https://github.com/dduan/Pathos/blob/8697a340a25e9974d4bbdee80a4c361c74963c00/Sources/Pathos/Path.swift#L255

Swift/SliceBuffer.swift:287: Fatal error: Index out of bounds

Backtrace:

* thread #2, queue = 'com.apple.root.default-qos', stop reason = Fatal error: Index out of bounds
    frame #0: 0x00000001bd002718 libswiftCore.dylib`_swift_runtime_on_report
    frame #1: 0x00000001bd082ba4 libswiftCore.dylib`_swift_stdlib_reportFatalErrorInFile + 192
    frame #2: 0x00000001bccb7504 libswiftCore.dylib`closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in Swift._assertionFailure(_: Swift.StaticString, _: Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 316
    frame #3: 0x00000001bccb7288 libswiftCore.dylib`closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in Swift._assertionFailure(_: Swift.StaticString, _: Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 224
    frame #4: 0x00000001bccb6b54 libswiftCore.dylib`Swift._assertionFailure(_: Swift.StaticString, _: Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 236
    frame #5: 0x00000001bccab3cc libswiftCore.dylib`Swift.ArraySlice.subscript.getter : (Swift.Int) -> τ_0_0 + 188
  * frame #6: 0x0000000100189394 swiftlint`Path.glob(self=Pathos.Path @ 0x000000016fe81b90) at Path.swift:255:33
    frame #7: 0x0000000100a7ed6c swiftlint`static Glob.resolveGlob(pattern="**/*.generated.swift", self=SwiftLintFramework.Glob) at Glob.swift:12:43
    frame #8: 0x0000000100a43018 swiftlint`implicit closure #2 in implicit closure #1 in Configuration.excludedPaths(pattern="**/*.generated.swift", self=SwiftLintFramework.Glob) at Configuration+LintableFiles.swift:96:27
    frame #9: 0x0000000100a43050 swiftlint`thunk for @callee_guaranteed (@guaranteed String) -> (@owned [String], @error @owned Error) at <compiler-generated>:0
    frame #10: 0x0000000100a430b4 swiftlint`partial apply for thunk for @callee_guaranteed (@guaranteed String) -> (@owned [String], @error @owned Error) at <compiler-generated>:0
    frame #11: 0x00000001bce33400 libswiftCore.dylib`Swift.Sequence.flatMap<τ_0_0 where τ_1_0: Swift.Sequence>((τ_0_0.Element) throws -> τ_1_0) throws -> Swift.Array<τ_1_0.Element> + 912
    frame #12: 0x0000000100a42924 swiftlint`Configuration.excludedPaths(fileManager=0x0000000104bbebb0, self=SwiftLintFramework.Configuration @ 0x000000016fe82030) at Configuration+LintableFiles.swift:96:14
    frame #13: 0x0000000100a424c4 swiftlint`Configuration.filterExcludedPaths(fileManager=0x0000000104bbebb0, paths=2 values, self=SwiftLintFramework.Configuration @ 0x000000016fe83e60) at Configuration+LintableFiles.swift:67:34
    frame #14: 0x0000000100a41cbc swiftlint`Configuration.lintablePaths(path="", forceExclude=false, excludeByPrefix=false, fileManager=0x0000000104bbebb0, self=SwiftLintFramework.Configuration @ 0x000000016fe82498) at Configuration+LintableFiles.swift:46:15
    frame #15: 0x0000000100a41744 swiftlint`Configuration.lintableFiles(path="", forceExclude=false, excludeByPrefix=false, self=SwiftLintFramework.Configuration @ 0x000000016fe83e60) at Configuration+LintableFiles.swift:16:16
    frame #16: 0x0000000100028da0 swiftlint`closure #2 in Configuration.getFiles($0="", self=SwiftLintFramework.Configuration @ 0x000000016fe83e60, visitor=swiftlint.LintableFilesVisitor @ 0x000000016fe83888) at Configuration+CommandLine.swift:246:18
    frame #17: 0x0000000100028ddc swiftlint`thunk for @callee_guaranteed (@guaranteed String) -> (@owned [SwiftLintFile], @error @owned Error) at <compiler-generated>:0
    frame #18: 0x000000010002af5c swiftlint`partial apply for thunk for @callee_guaranteed (@guaranteed String) -> (@owned [SwiftLintFile], @error @owned Error) at <compiler-generated>:0
    frame #19: 0x00000001bce33400 libswiftCore.dylib`Swift.Sequence.flatMap<τ_0_0 where τ_1_0: Swift.Sequence>((τ_0_0.Element) throws -> τ_1_0) throws -> Swift.Array<τ_1_0.Element> + 912
    frame #20: 0x0000000100022dd0 swiftlint`Configuration.getFiles(visitor=swiftlint.LintableFilesVisitor @ 0x000000016fe82e58, self=SwiftLintFramework.Configuration @ 0x000000016fe82db8) at Configuration+CommandLine.swift:245:39
    frame #21: 0x0000000100022214 swiftlint`closure #1 in Configuration.visitLintableFiles(self=SwiftLintFramework.Configuration @ 0x000000016fe83e60, visitor=swiftlint.LintableFilesVisitor @ 0x000000016fe83888) at Configuration+CommandLine.swift:52:13
    frame #22: 0x0000000100022e74 swiftlint`thunk for @callee_guaranteed () -> (@owned Result<[SwiftLintFile], SwiftLintError>) at <compiler-generated>:0
    frame #23: 0x00000001000459d8 swiftlint`static Signposts.record<R>(name="Configuration.VisitLintableFiles.GetFiles", span=timeline, body=0x100022e98, self=swiftlint.Signposts) at Signposts.swift:32:26
    frame #24: 0x0000000100021cf0 swiftlint`Configuration.visitLintableFiles(visitor=swiftlint.LintableFilesVisitor @ 0x000000016fe83688, storage=0x0000000104c043b0, self=SwiftLintFramework.Configuration @ 0x000000016fe835e0) at Configuration+CommandLine.swift:51:26
    frame #25: 0x00000001000290d4 swiftlint`closure #1 in Configuration.visitLintableFiles(visitor=swiftlint.LintableFilesVisitor @ 0x000000016fe83888, self=SwiftLintFramework.Configuration @ 0x000000016fe83e60, storage=0x0000000104c043b0) at Configuration+CommandLine.swift:258:13
    frame #26: 0x000000010002913c swiftlint`thunk for @callee_guaranteed (@guaranteed LintableFilesVisitor) -> (@owned Result<[SwiftLintFile], SwiftLintError>) at <compiler-generated>:0
    frame #27: 0x00000001bce25788 libswiftCore.dylib`Swift.Result.flatMap<τ_0_0>((τ_0_0) -> Swift.Result<τ_1_0, τ_0_1>) -> Swift.Result<τ_1_0, τ_0_1> + 460
    frame #28: 0x0000000100029020 swiftlint`Configuration.visitLintableFiles(options=swiftlint.LintOrAnalyzeOptions @ 0x000000016fe83de8, cache=nil, storage=0x0000000104c043b0, visitorBlock=0x000000010003cf88, self=SwiftLintFramework.Configuration @ 0x000000016fe83af8) at Configuration+CommandLine.swift:257:69
    frame #29: 0x000000010003805c swiftlint`static LintOrAnalyzeCommand.collectViolations(builder=0x0000000104c046a0, self=swiftlint.LintOrAnalyzeCommand) at LintOrAnalyzeCommand.swift:44:38
    frame #30: 0x0000000100037cfc swiftlint`static LintOrAnalyzeCommand.lintOrAnalyze(options=swiftlint.LintOrAnalyzeOptions @ 0x000000016fe84fa8, self=swiftlint.LintOrAnalyzeCommand) at LintOrAnalyzeCommand.swift:36:16
    frame #31: 0x00000001000378e8 swiftlint`closure #1 in static LintOrAnalyzeCommand.run(options=swiftlint.LintOrAnalyzeOptions @ 0x000000016fe84fa8, self=swiftlint.LintOrAnalyzeCommand) at LintOrAnalyzeCommand.swift:30:58
    frame #32: 0x0000000100037dd4 swiftlint`thunk for @callee_guaranteed () -> (@owned Result<(), SwiftLintError>) at <compiler-generated>:0
    frame #33: 0x00000001000459d8 swiftlint`static Signposts.record<R>(name="LintOrAnalyzeCommand.run", span=timeline, body=0x100037df8, self=swiftlint.Signposts) at Signposts.swift:32:26
    frame #34: 0x0000000100037854 swiftlint`static LintOrAnalyzeCommand.run(options=swiftlint.LintOrAnalyzeOptions @ 0x000000016fe84390, self=swiftlint.LintOrAnalyzeCommand) at LintOrAnalyzeCommand.swift:29:26
    frame #35: 0x000000010000ff4c swiftlint`SwiftLint.Lint.run(self=swiftlint.SwiftLint.Lint @ 0x0000000104bc76c0) at Lint.swift:54:47
    frame #36: 0x0000000100013a9c swiftlint`protocol witness for ParsableCommand.run() in conformance SwiftLint.Lint at <compiler-generated>:0
    frame #37: 0x0000000100dd5304 swiftlint`static ParsableCommand.main(arguments=nil, self=swiftlint.SwiftLint) at ParsableCommand.swift:97:19
    frame #38: 0x000000010001f280 swiftlint`static SwiftLint.mainHandlingDeprecatedCommands(arguments=nil, self=swiftlint.SwiftLint) at SwiftLint.swift:24:13
    frame #39: 0x0000000100046820 swiftlint`closure #1 in  at main.swift:11:15
    frame #40: 0x0000000100046858 swiftlint`thunk for @escaping @callee_guaranteed () -> () at <compiler-generated>:0
    frame #41: 0x0000000104797ff0 libdispatch.dylib`_dispatch_call_block_and_release + 32
    frame #42: 0x0000000104799d24 libdispatch.dylib`_dispatch_client_callout + 20
    frame #43: 0x000000010479cd08 libdispatch.dylib`_dispatch_queue_override_invoke + 1084
    frame #44: 0x00000001047b1a0c libdispatch.dylib`_dispatch_root_queue_drain + 408
    frame #45: 0x00000001047b2640 libdispatch.dylib`_dispatch_worker_thread2 + 196
    frame #46: 0x000000010439bed8 libsystem_pthread.dylib`_pthread_wqthread + 228

@jpsim
Copy link
Collaborator

jpsim commented Mar 11, 2022

@pomozoff could you please try #3892?

jpsim added a commit that referenced this issue Mar 11, 2022
@pomozoff
Copy link
Author

@jpsim, Yes! It works! Thank you!

jpsim added a commit that referenced this issue Mar 16, 2022
coffmark pushed a commit to coffmark/SwiftLint that referenced this issue Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants