You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This can be seen by running SwiftLint against swift
brew install swiftlint
git clone https://github.com/apple/swift
cd swift
swiftlint
The problem file is ./validation-test/IDE/crashers_fixed/033-swift-identifier-isoperatorslow.swift , which cannot be interpreted as UTF-8
% swiftlint ./validation-test/IDE/crashers_fixed/033-swift-identifier-isoperatorslow.swift
Linting Swift files at paths ./validation-test/IDE/crashers_fixed/033-swift-identifier-isoperatorslow.swift
Linting '033-swift-identifier-isoperatorslow.swift' (1/1)
SourceKittenFramework/File.swift:20: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=261 "The file “033-swift-identifier-isoperatorslow.swift” couldn’t be opened using text encoding Unicode (UTF-8)." UserInfo={NSFilePath=/Users/martin.redington/Documents/Hudl/Source/swift/validation-test/IDE/crashers_fixed/033-swift-identifier-isoperatorslow.swift, NSStringEncoding=4}
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
zsh: trace trap ../Sportscode64/Pods/SwiftLint/swiftlint
But actually, if the file cannot be read for any reason, then this will cause a crash
touch t.swift
chmod -r t.swift
swiftlint t.swift
Linting Swift files at paths t.swift
Linting 't.swift' (1/1)
SourceKittenFramework/File.swift:20: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=257 "The file “t.swift” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/Users/martin.redington/Documents/Hudl/Source/SourceKitten/t.swift, NSUnderlyingError=0x600002a48210 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
zsh: trace trap ../Sportscode64/Pods/SwiftLint/swiftlint t.swift
The text was updated successfully, but these errors were encountered:
mildm8nnered
changed the title
File.contents will crash for files that cannot be parsed as UTF-8, when initialised with init(pathDeferringReading:)File.contents will crash for files that cannot be read later, when initialised with init(pathDeferringReading:)Mar 18, 2023
This can be seen by running SwiftLint against swift
The problem file is
./validation-test/IDE/crashers_fixed/033-swift-identifier-isoperatorslow.swift
, which cannot be interpreted as UTF-8See realm/SwiftLint#4821
But actually, if the file cannot be read for any reason, then this will cause a crash
The text was updated successfully, but these errors were encountered: