Wrong variant in CanSuspend and CanHibernate in ConsoleKit2 support.

Bug #1732850 reported by Joel Barrios
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Light Display Manager
Fix Committed
High
Unassigned

Bug Description

Systems using ConsoleKit2 instead of SystemD or elogind cannot suspend or hibernate from LightDM 1.24.0.

According to ConsoleKit2 documentation:

...
CanSuspend (out 's' can_suspend)
...
CanHibernate (out 's' can_hibernate)
...

But the code in liblightdm-gobject/power.c uses 'b':

        r = ck_call_function ("CanSuspend", NULL, NULL);
        if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
            g_variant_get (r, "(b)", &can_suspend);

       r = ck_call_function ("CanHibernate", NULL, NULL);
        if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
            g_variant_get (r, "(b)", &can_hibernate);

After changing "(b)" with "(s)", LightDM 1.24.0 can suspend an hibernate again in systems with ConsoleKit2.

        r = ck_call_function ("CanSuspend", NULL, NULL);
        if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(s)")))
            g_variant_get (r, "(s)", &can_suspend);

       r = ck_call_function ("CanHibernate", NULL, NULL);
        if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(s)")))
            g_variant_get (r, "(s)", &can_hibernate);

Revision history for this message
Joel Barrios (darkshram) wrote :
Joel Barrios (darkshram)
summary: - Wrong variant in CanSusoend and CanHibernate in ConsoleKit2 support.
+ Wrong variant in CanSuspend and CanHibernate in ConsoleKit2 support.
Joel Barrios (darkshram)
description: updated
Revision history for this message
Robert Ancell (robert-ancell) wrote :

The patch is not correct (trying to store a string into a boolean value) but you are correct on pointing out I'm not using the API correctly; thanks!

Changed in lightdm:
status: New → Triaged
importance: Undecided → High
status: Triaged → Fix Committed
Revision history for this message
Robert Ancell (robert-ancell) wrote :

commit 8c134bd0985dc529bc6b2676b0a7c884675bbe42
Author: Robert Ancell <email address hidden>
Date: Tue Jan 23 12:39:09 2018 +1300

    Fix incorrect use of ConsoleKit CanSuspend/Hibernate API

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.