gvfs-udisks2-volume-monitor SIGSEGV due to filename with bad encoding
Running debian trixie, a few weeks back that some file dialogs suddenly became very slow to open (~25 s). That was the result of a timeout on a DBus call because the systemd user service gvfs-udisks2-volume-monitor.service had failed with a segfault. Indeed when trying to spawn gvfs-udisks2-volume-monitor from the command line it would immediately segfault.
Using strace, I could determine the segfault was occurring when the program was 'statx'ing a specific file on an NFS mount that had a string encoding problem in its name (an illegal utf8 token i presume) :
statx(AT_FDCWD, "/media/XXXXX/YYYYYYYYYY\2602 (1).mp3", ...
On that crash gdb would give:
Thread 1 "gvfs-udisks2-vo" received signal SIGSEGV, Segmentation fault. __GI___wcsxfrm_l (dest=0x0, src=0x0, n=0, l=0x7ffff7993580 <_nl_global_locale>)
at ../string/strxfrm_l.c:685
685 ../string/strxfrm_l.c: No such file or folder.
(gdb) bt
#0 __GI___wcsxfrm_l (dest=0x0, src=0x0, n=0, l=0x7ffff7993580 <_nl_global_locale>) at ../string/strxfrm_l.c:685
#1 0x00007ffff7c9cb4e in g_utf8_collate_key () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 0x00007ffff7e8510a in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#3 0x00007ffff7e853e5 in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#4 0x00007ffff7e866f4 in g_content_type_guess_for_tree ()
After removing that offending character in that file the issue was solved for me, but I guess the code should be made more robust to avoid such problem.