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

Crashes always with Swift 5 on linux #2703

Closed
Dschoordsch opened this issue Apr 2, 2019 · 8 comments
Closed

Crashes always with Swift 5 on linux #2703

Dschoordsch opened this issue Apr 2, 2019 · 8 comments

Comments

@Dschoordsch
Copy link

New Issue Checklist

Describe the bug

SwiftLint crashes always when built with Swift 5 on linux (Ubuntu 16.04 and Ubuntu 18.04).

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint

Backtrace:

Current executable set to './.build/x86_64-unknown-linux/release/swiftlint' (x86_64).
(lldb) r
Process 7457 launched: '/root/SwiftLint/.build/x86_64-unknown-linux/release/swiftlint' (x86_64)
error: ld-2.27.so 0xffffffff0005c564: adding range [0x1464a-0x146ba) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0xffffffff0005c564: adding range [0x146d0-0x146d6) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0xffffffff0005c5c5: adding range [0x1464a-0x146ba) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0xffffffff0005c5c5: adding range [0x146d0-0x146d6) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
Process 7457 stopped and restarted: thread 1 received signal: SIGCHLD
Process 7457 stopped and restarted: thread 1 received signal: SIGCHLD
Loading configuration from '.swiftlint.yml'
Linting Swift files at paths 
Process 7457 stopped
* thread #2, name = 'swiftlint', stop reason = signal SIGILL: illegal instruction operand
    frame #0: 0x00007ffff72cdef4 libFoundation.so`function signature specialization <Arg[0] = Exploded, Arg[1] = Dead> of Foundation.FileManager.fileSystemRepresentation(withPath: Swift.String) -> Swift.UnsafePointer<Swift.Int8> + 212
libFoundation.so`function signature specialization <Arg[0] = Exploded, Arg[1] = Dead> of Foundation.FileManager.fileSystemRepresentation(withPath: Swift.String) -> Swift.UnsafePointer<Swift.Int8>:
->  0x7ffff72cdef4 <+212>: ud2    
    0x7ffff72cdef6 <+214>: leaq   0x4408e3(%rip), %rax
    0x7ffff72cdefd <+221>: movabsq $-0x8000000000000000, %r8 ; imm = 0x8000000000000000 
    0x7ffff72cdf07 <+231>: orq    %rax, %r8
Target 0: (swiftlint) stopped.
(lldb) 

these two work:

swiftlint help
swiftlint version

Environment

  • SwiftLint version (run swiftlint version to be sure)?
    0.31.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
    built from source with Swift 5:
git checkout master
git pull
swift build -c release --static-swift-stdlib

OS: Ubuntu 16.04 and Ubuntu 18.04 (x86_64)

  • Paste your configuration file:
    no file, empty file, ./.build/checkouts/SwiftyTextTable/.swiftlint.yml all same result
included: Source

disabled_rules:
  - closure_parameter_position

line_length: 130
@keith
Copy link
Collaborator

keith commented Apr 3, 2019

I've looked at this a bit and it's crashing on this line

if FileManager.default.fileExists(atPath: self, isDirectory: &isDirectoryObjC) {

When self == "". I'm looking into a fix

@keith
Copy link
Collaborator

keith commented Apr 3, 2019

@keith
Copy link
Collaborator

keith commented Apr 3, 2019

Here's a fix: #2706

@keith
Copy link
Collaborator

keith commented Apr 3, 2019

Here's a stacktrace with symbols:

Process 15822 stopped and restarted: thread 1 received signal: SIGCHLD
Process 15822 stopped and restarted: thread 1 received signal: SIGCHLD
Linting Swift files at paths
Process 15822 stopped
* thread #2, name = 'swiftlint', stop reason = signal SIGILL: illegal instruction operand
    frame #0: 0x00007ffff72cf034 libFoundation.so`function signature specialization <Arg[0] = Exploded, Arg[1] = Dead> of Foundation.FileManager.fileSystemRepresentation(withPath: Swift.String) -> Swift.UnsafePointer<Swift.Int8> + 212
libFoundation.so`function signature specialization <Arg[0] = Exploded, Arg[1] = Dead> of Foundation.FileManager.fileSystemRepresentation(withPath: Swift.String) -> Swift.UnsafePointer<Swift.Int8>:
->  0x7ffff72cf034 <+212>: ud2
    0x7ffff72cf036 <+214>: lea    rax, [rip + 0x440a73]
    0x7ffff72cf03d <+221>: movabs r8, -0x8000000000000000
    0x7ffff72cf047 <+231>: or     r8, rax
Target 0: (swiftlint) stopped.
(lldb) bt
* thread #2, name = 'swiftlint', stop reason = signal SIGILL: illegal instruction operand
  * frame #0: 0x00007ffff72cf034 libFoundation.so`function signature specialization <Arg[0] = Exploded, Arg[1] = Dead> of Foundation.FileManager.fileSystemRepresentation(withPath: Swift.String) -> Swift.UnsafePointer<Swift.Int8> + 212
    frame #1: 0x00007ffff72cf1da libFoundation.so`function signature specialization <Arg[0] = Exploded> of Foundation.FileManager.fileExists(atPath: Swift.String, isDirectory: Swift.Optional<Swift.UnsafeMutablePointer<Foundation.ObjCBool>>) -> Swift.Bool + 250
    frame #2: 0x00007ffff72c7f99 libFoundation.so`Foundation.FileManager.fileExists(atPath: Swift.String, isDirectory: Swift.Optional<Swift.UnsafeMutablePointer<Foundation.ObjCBool>>) -> Swift.Bool + 9
    frame #3: 0x00005555558d17e9 swiftlint`String.isFile.getter(self="") at String+SwiftLint.swift:84:32
    frame #4: 0x000055555589b6c7 swiftlint`Configuration.lintablePaths(path="", forceExclude=false, fileManager=<unavailable>, self=<unavailable>) at Configuration+LintableFiles.swift:12:17
    frame #5: 0x000055555589b407 swiftlint`Configuration.lintableFiles(path="", forceExclude=false, self=<unavailable>) at Configuration+LintableFiles.swift:6:16
    frame #6: 0x0000555555cc7c04 swiftlint`closure #2 in Configuration.getFiles($0="", self=<unavailable>, visitor=<unavailable>) at Configuration+CommandLine.swift:152:18
    frame #7: 0x0000555555cca400 swiftlint`partial apply for closure #2 in Configuration.getFiles(with:) at <compiler-generated>:0
    frame #8: 0x0000555555cc7c47 swiftlint`thunk for @callee_guaranteed (@guaranteed String) -> (@owned [File], @error @owned Error) at <compiler-generated>:0
    frame #9: 0x0000555555cca44b swiftlint`partial apply for thunk for @callee_guaranteed (@guaranteed String) -> (@owned [File], @error @owned Error) at <compiler-generated>:0
    frame #10: 0x00007ffff7b1a3da libswiftCore.so`(extension in Swift):Swift.Sequence.flatMap<A where A1: Swift.Sequence>((A.Element) throws -> A1) throws -> Swift.Array<A1.Element> + 602
    frame #11: 0x0000555555cc234e swiftlint`Configuration.getFiles(visitor=<unavailable>, self=<unavailable>) at Configuration+CommandLine.swift:151:39
    frame #12: 0x0000555555cc1209 swiftlint`Configuration.visitLintableFiles(visitor=<unavailable>, self=<unavailable>) at Configuration+CommandLine.swift:53:16
    frame #13: 0x0000555555cc9080 swiftlint`partial apply for Configuration.visitLintableFiles(with:) at <compiler-generated>:0
    frame #14: 0x0000555555cc86ee swiftlint`thunk for @callee_guaranteed (@guaranteed LintableFilesVisitor) -> (@owned Result<[File], CommandantError<()>>) at <compiler-generated>:0
    frame #15: 0x0000555555cc8761 swiftlint`partial apply for thunk for @callee_guaranteed (@guaranteed LintableFilesVisitor) -> (@owned Result<[File], CommandantError<()>>) at <compiler-generated>:0
    frame #16: 0x0000555555810f7f swiftlint`Result.flatMap<A>(transform=0x0000555555cc8750 swiftlint`partial apply forwarder for reabstraction thunk helper from @callee_guaranteed (@guaranteed swiftlint.LintableFilesVisitor) -> (@owned Result.Result<Swift.Array<SourceKittenFramework.File>, Commandant.CommandantError<()>>) to @escaping @callee_guaranteed (@in_guaranteed swiftlint.LintableFilesVisitor) -> (@out Result.Result<Swift.Array<SourceKittenFramework.File>, Commandant.CommandantError<()>>) at <compiler-generated>, self=<unavailable>) at ResultProtocol.swift:39:36
    frame #17: 0x0000555555cc856f swiftlint`Configuration.visitLintableFiles(options=<unavailable>, cache=<unavailable>, visitorBlock=0x0000555555cd20a0 swiftlint`partial apply forwarder for closure #1 (SwiftLintFramework.Linter) -> () in static swiftlint.LintOrAnalyzeCommand.run(swiftlint.LintOrAnalyzeOptions) -> Result.Result<(), Commandant.CommandantError<()>> at <compiler-generated>, self=<unavailable>) at Configuration+CommandLine.swift:172:88
    frame #18: 0x0000555555cd1350 swiftlint`static LintOrAnalyzeCommand.run(options=<unavailable>, self=0x0000000000000000) at LintOrAnalyzeCommand.swift:30:30
    frame #19: 0x0000555555cafc7d swiftlint`LintCommand.run(options=<unavailable>, self=<unavailable>) at LintCommand.swift:9:37
    frame #20: 0x0000555555caff97 swiftlint`protocol witness for CommandProtocol.run(_:) in conformance LintCommand at <compiler-generated>:0
    frame #21: 0x00005555556132a1 swiftlint`closure #1 in CommandWrapper.init<A>(arguments=<unavailable>, command=0x00000000746e696c) at Command.swift:55:7
    frame #22: 0x0000555555616e50 swiftlint`partial apply for closure #1 in CommandWrapper.init<A>(_:) at <compiler-generated>:0
    frame #23: 0x000055555561466c swiftlint`CommandRegistry.run(verb="lint", arguments=0 values, self=<unavailable>) at Command.swift:109:22
    frame #24: 0x0000555555615258 swiftlint`CommandRegistry.main(arguments=1 value, defaultVerb="lint", errorHandler=0x0000555555cdc580 swiftlint`partial apply forwarder for reabstraction thunk helper from @callee_guaranteed (@guaranteed Commandant.CommandantError<()>) -> () to @escaping @callee_guaranteed (@in_guaranteed Commandant.CommandantError<()>) -> () at <compiler-generated>, self=<unavailable>) at Command.swift:174:10
    frame #25: 0x0000555555614ca8 swiftlint`CommandRegistry.main(defaultVerb="lint", errorHandler=0x0000555555cdc580 swiftlint`partial apply forwarder for reabstraction thunk helper from @callee_guaranteed (@guaranteed Commandant.CommandantError<()>) -> () to @escaping @callee_guaranteed (@in_guaranteed Commandant.CommandantError<()>) -> () at <compiler-generated>, self=<unavailable>) at Command.swift:138:3
    frame #26: 0x0000555555cdbd10 swiftlint`closure #1 in  at main.swift:15:14
    frame #27: 0x00005555558ce67d swiftlint`thunk for @escaping @callee_guaranteed () -> () at <compiler-generated>:0
    frame #28: 0x00007ffff7f27667 libdispatch.so`_dispatch_call_block_and_release + 7
    frame #29: 0x00007ffff7f3b7c8 libdispatch.so`_dispatch_worker_thread + 1016
    frame #30: 0x00007ffff6d6e6ba libpthread.so.0`start_thread + 202
    frame #31: 0x00007ffff5bf941d libc.so.6`clone + 109

@keith
Copy link
Collaborator

keith commented Apr 3, 2019

A workaround in the meantime is to pass --path . to lint

@keith
Copy link
Collaborator

keith commented Apr 3, 2019

I filed https://bugs.swift.org/browse/SR-10277 since this behavior differs between macOS and Linux

@jpsim
Copy link
Collaborator

jpsim commented Apr 6, 2019

Fixed in #2706. Thanks @keith !

@jpsim jpsim closed this as completed Apr 6, 2019
@Dschoordsch
Copy link
Author

Thank you very much for the fast fix!

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

No branches or pull requests

3 participants