martinlau
(Martin Lau)
May 29, 2020, 7:06am
1
Hi:
My English is very poor, hope someone can understand and help me.
There is a runtime error in swift5.2.4. When I type swift in ubuntu 18.04 to test, a crash occurs.
When the compilation is complete, it seems that the release mode crashes directly, while the debug mode crashes only after using Process
.Run.
Hi @martinlau , could you provide more details with how Process.run
is used? Is this reproducible with any Swift code, or a specific project/file? Could you show the source code snippet then that's causing the crash? Also, how exactly was the Swift distribution installed on Ubuntu 18.04?
martinlau
(Martin Lau)
June 1, 2020, 2:39am
3
Hi @Max_Desiatov , I installed swift on Ubuntu 18.04 according to the guide in swift.org .
For Process crash I only apply the following simple code:
let pipe = Pipe()
let task = Process()
task.standardError = pipe
if #available(OSX 10.13, *) {
task.executableURL = URL(fileURLWithPath: "/usr/bin/zip")
task.currentDirectoryURL = URL(fileURLWithPath: folder)
try task.run()
} else {
task.launchPath = "/usr/bin/zip"
task.currentDirectoryPath = folder
task.launch()
}
var data = pipe.fileHandleForReading.readDataToEndOfFile()
while task.isRunning {
data = pipe.fileHandleForReading.readDataToEndOfFile()
}
martinlau
(Martin Lau)
June 1, 2020, 9:48am
4
Running the compiled program outputs the following error:
[1] 17163 segmentation fault .build/debug/MagicSignature
I got the following error log via shell $ dmesg
:
segfault at 7f0725e279e0 ip 00007f0725a6a3bd sp 00007ffdcad41510 error 7 in libicui18nswift.so.65.1 [7f072590c000 + 319000]
millenomi
(Aura Lily Vulcano)
June 1, 2020, 5:42pm
6
Can we get a proper backtrace via lldb?
martinlau
(Martin Lau)
June 2, 2020, 2:37am
7
I am not familiar with the use of lldb, this is my first time using swift on Linux.
Thanks for sharing this, but I'm not able to reproduce it since this doesn't seem to be a complete snippet. When I try to run it, I get these errors:
test.swift:8:53: error: use of unresolved identifier 'folder'
task.currentDirectoryURL = URL(fileURLWithPath: folder)
^~~~~~
test.swift:12:33: error: use of unresolved identifier 'folder'
task.currentDirectoryPath = folder
Would you be able to share the complete code so that others could reproduce the error and provide help in diagnosing the issue?
1 Like
martinlau
(Martin Lau)
February 24, 2023, 6:10am
9
Since I updated Swift 5.6 this bug has somehow disappeared, I am not sure if there is something wrong with my environment