-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Previous ID | SR-14789 |
Radar | rdar://problem/79456450 |
Original Reporter | GalenRhodes1967 (JIRA User) |
Type | Bug |
Environment
- Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-74-generic x86_64)
-
- Swift version 5.4 (swift-5.4-RELEASE) Target: x86_64-unknown-linux-gnu
- Ubuntu 20.04.2 LTS (GNU/Linux 5.8.0-55-generic x86_64)
-
- Swift version 5.4 (swift-5.4-RELEASE) Target: x86_64-unknown-linux-gnu
- Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-1036-raspi aarch64) - Raspberry PI 4 (4GB)
-
- Swift version 5.5-dev (LLVM c64e53b8742ea89, Swift 3f6eb2f8a0a1287) Target: aarch64-unknown-linux-gnu
- Ubuntu 20.04.2 LTS (GNU/Linux 4.9.241-70 aarch64) - ODROID C4
-
- Swift version 5.5-dev (LLVM c64e53b8742ea89, Swift 3f6eb2f8a0a1287) Target: aarch64-unknown-linux-gnu
Additional Detail from JIRA
Votes | 0 |
Component/s | Foundation, Standard Library |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: 8041e548b25e485dcc7fa65e64e981dc
Issue Description:
Attempting to read the value of property streamError in InputStream class causes a trap with the error message "Illegal Instruction" on Linux. I've tried this on 4 different Linux machines. Works fine in macOS.
import Foundation
import CoreFoundation
let testDataDir: String = "Tests/RubiconTests/Files"
guard let inputStream = InputStream(fileAtPath: "\(testDataDir)/Test_UTF-8.xml") else {
print("Unable to create input stream!")
exit(1)
}
inputStream.open()
if let e = inputStream.streamError { // <----- Crashes here.
print("File not opened: \(e.localizedDescription)")
exit(1)
}
var array = [ UInt8 ](repeating: 0, count: 100)
let result = inputStream.read(&array, maxLength: 100)
guard result >= 0 else {
let e = inputStream.streamError // <----- Crashes here.
let msg = (e?.localizedDescription ?? "Unknown Error")
print("Error reading file: \(msg)")
exit(1)
}
let str = String(bytes: array, encoding: .utf8)
print(str ?? "???")
inputStream.close()
exit(0)