gsd-power crashing on systems that dont have backlight keyboards
We are currently testing gnome-settings-daemon 3.27.91 in gnome3-staging PPA (before updating in Ubuntu), however it crashes the entire session on systems that dont have backlit keyboards.
Test Case
Open gnome-control-center to the Power panel. Close gnome-control-center Open gnome-control-center
(gnome-control-center 3.27.91 will automatically open the last opened panel, which is Power here).
gsd-power crashes which crashes the entire session and logs you out.
Core was generated by `/usr/lib/gnome-settings-daemon/gsd-power'.
Program terminated with signal SIGFPE, Arithmetic exception.
#0 0x000056134e7068d8 in gsd_power_backlight_abs_to_percentage (
min=min@entry=0, max=<optimised out>, value=<optimised out>)
at ../plugins/power/gpm-common.c:61
61 ../plugins/power/gpm-common.c: No such file or directory.
[Current thread is 1 (Thread 0x7f49b27d80c0 (LWP 2070))]
(gdb) bt
#0 0x000056134e7068d8 in gsd_power_backlight_abs_to_percentage (
min=min@entry=0, max=<optimised out>, value=<optimised out>)
at ../plugins/power/gpm-common.c:61
#1 0x000056134e70c207 in handle_get_property_other (error=0x0,
property_name=0x561350569bd0 "Brightness",
interface_name=0x561350569480 "org.gnome.SettingsDaemon.Power.Keyboard",
manager=0x561350568150) at ../plugins/power/gsd-power-manager.c:2924
#2 handle_get_property (connection=<optimised out>, sender=<optimised out>,
object_path=object_path@entry=0x7f4998011ad0 "/org/gnome/SettingsDaemon/Power",
interface_name=interface_name@entry=0x561350569480 "org.gnome.SettingsDaemon.Power.Keyboard",
property_name=property_name@entry=0x561350569bd0 "Brightness",
error=error@entry=0x0, user_data=0x561350568150)
at ../plugins/power/gsd-power-manager.c:2957
#3 0x00007f49b0d8caf8 in invoke_get_all_properties_in_idle_cb (
_data=0x7f499803b920) at ../../../../gio/gdbusconnection.c:4494
#4 0x00007f49b07aef85 in g_main_dispatch (context=0x56135052e800)
at ../../../../glib/gmain.c:3177
#5 g_main_context_dispatch (context=context@entry=0x56135052e800)
at ../../../../glib/gmain.c:3830
#6 0x00007f49b07af350 in g_main_context_iterate (context=0x56135052e800,
block=block@entry=1, dispatch=dispatch@entry=1, self=<optimised out>)
---Type <return> to continue, or q <return> to quit---
../../../glib/gmain.c:3903
#7 0x00007f49b07af662 in g_main_loop_run (loop=0x561350595b10) at ../../../../glib/gmain.c:4099
#8 0x00007f49b15a9455 in gtk_main () from /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#9 0x000056134e705fca in main (argc=<optimised out>, argv=<optimised out>) at ../plugins/common/daemon-skeleton-gtk.h:246
I poked at this with gdb:
#0 gsd_power_backlight_abs_to_percentage (min=min@entry=0, max=0, value=-1) at ../plugins/power/gpm-common.c:61
that should atleast trigger g_return_val_if_fail (max > min, -1) to return, however the g_return_val_if_fail's seem to have been compiled out, or atleast I am not getting them in gdb when setting a breakpoint on gsd_power_backlight_abs_to_percentage.
I am not sure if the arguments passed in are as expected for the case when no backlit keyboard exist, but if so should there be a an explicit check to return, rather than relying on g_return_val_if_fail?