-
-
Notifications
You must be signed in to change notification settings - Fork 90
gio::auto::file::File::new_for_path runs into nullptr on musl #351
Comments
That would be a bug in GLib/GIO or the GVfs implementation used there. The function must never return
Please report it with a testcase here: https://gitlab.gnome.org/GNOME/glib/-/issues/new |
Will do, thanks :) |
@Cogitri Did you find the root cause of the issue? I'm facing a similar issue with |
Yeah, the SEGFAULT occurs because gtk-rs assumes that that function can't return NULL (since it can't do that according to the docs). I have to admit I kind of forgot about this issue, so I didnt open an issue over at glib's repo |
@george-hopkins Sending a fix for the function then. |
@george-hopkins Actually, can you show us how you the call the function please? |
fn main() {
let arg = std::env::args().skip(1).next().unwrap();
println!("{:?}", gio::File::for_commandline_arg(arg));
} Environment: rustc 1.52.1 on Alpine Linux (Docker container |
I still think that the fault occurs before calling and returning from the shared library. It occurs on this call in the Rust binary: mov 0x30(%rsp),%rdi # %rdi is a pointer to arg (null-terminated)
call *0x64b0f(%rip) # 0x7ffff7ffced0
|
Can you give a try to my fix please? |
Unfortunately, I still get a SEGFAULT with the fix applied. |
So the problem isnt the returned value of the function but something else. |
After recompiling with |
This looks like either a GLib or musl bug, or an environment bug where you end up having multiple CRTs. |
It's an environment bug. Using some random static musl version (from rustc) when you have shared libraries that are linked against the system musl copy is broken (same for using static musl from rustc and shared libs linked against glibc). There's currently some working being done in rust upstream to make musl shared by default and introduce a new static triplet so this won't happen anymore. |
Hello,
In
tracker-rs
examplesgio::auto::file::File::new_for_path
crashes with a SIGSEGV because it runs into a nullpointer. The backtrace:Here's a Dockerfile for a reproducer:
The text was updated successfully, but these errors were encountered: