Created attachment 9669 Patch for segmentation fault When I click Log Out->Suspend in my XFCE4 on Debian 10 it sometimes fails to suspend my computer. Instead, a line like this appears in the system logs: [157564.090376] traps: xfsm-shutdown-h[18010] general protection ip:7f5cd3b359bd sp:7ffc11a900a0 error:0 in libc-2.28.so[7f5cd3ad3000+148000] When executed as root from the command it either works as expected, or emits this message: # PKEXEC_UID=12345 /usr/lib/x86_64-linux-gnu/xfce4/session/xfsm-shutdown-helper --suspend (xfsm-shutdown-helper:19816): GLib-WARNING **: 14:03:03.723: GError set over the top of a previous GError or uninitialized memory. This indicates a bug in someone's code. You must ensure an error is NULL before it's set. The overwriting error message was: Failed to execute child process ?/usr/sbin/pm-suspend? (No such file or directory) Segmentation fault Apparently the pm-utils package, which contains the /usr/sbin/pm-suspend utility, is not a dependency of XFCE in Debian, but still xfsm-shutdown-helper should handle this without a segfault. I tracked this to be a violation of this rule (https://developer.gnome.org/glib/stable/glib-Error-Reporting.html#gerror-rules): * A GError* must be initialized to NULL before passing its address to a function that can report errors. and the attached patch fixes Segmentation fault problem. Now I reliably get: # PKEXEC_UID=12345 ./xfsm-shutdown-helper --suspend Failed to execute child process “/usr/sbin/pm-suspend” (No such file or directory) I guess this also explains the "sometimes fails to suspend" behaviour, because occasionally the err variable could be initialized to NULL and then XFCE gracefully handled the missing pm-suspend command by trying some alternative method.
Piotr Trojanek referenced this bugreport in commit 2cd5029d4b6be6ff9cbb7bec9fdc0216b95132c5 Bug #16632: Segfault when suspending without pm-suspend installed https://gitlab.xfce.org/xfce/xfce4-session/commit/2cd5029d4b6be6ff9cbb7bec9fdc0216b95132c5
Thank you !
Piotr Trojanek referenced this bugreport in commit 209c67febf16ff5bdd50e6c26630a9e04995f3a6 Bug #16632: Segfault when suspending without pm-suspend installed https://gitlab.xfce.org/xfce/xfce4-session/commit/209c67febf16ff5bdd50e6c26630a9e04995f3a6