Otherwise energy_performance_preference might not be writable. This can
happen on systems where the default cpufreq scaling governor has been
changed.
See https://bugzilla.redhat.com/show_bug.cgi?id=2079898Closes: #90
Before:
Traceback (most recent call last):
File "/usr/bin/powerprofilesctl", line 262, in <module>
main()
File "/usr/bin/powerprofilesctl", line 216, in main
_set(args[0])
File "/usr/bin/powerprofilesctl", line 111, in _set
proxy.Set('(ssv)',
File "/usr/lib/python3.10/site-packages/gi/overrides/Gio.py", line 349, in __call__
result = self.dbus_proxy.call_sync(self.method_name, arg_variant,
gi.repository.GLib.GError: g-io-error-quark: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code26: Error writing '/sys/devices/system/cpu/cpufreq/policy1/energy_performance_preference': Device or resource busy (26)
After:
Failed to communicate with power-profiles-daemon: g-io-error-quark: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code26: Error writing '/sys/devices/system/cpu/cpufreq/policy1/energy_performance_preference': Device or resource busy (26)
Because fprintf() is buffered unless disabled and we weren't checking
for the fclose() return value, we were returning without errors when
there should have been some.
WARNING: You should add the boolean check kwarg to the run_command call.
It currently defaults to false,
but it will default to true in future releases of meson.
See also: https://github.com/mesonbuild/meson/issues/9300
It's required for the g_autoptr() support we use. For older
distributions shipping older versions of polkit, it is recommended that
you backport the g_autoptr() support to your version of polkit and
amend the required version in this project.
The HoldProfile method was correctly throwing an error back to the
caller but was still carrying on to hold a profile.
This could cause a double-free in the daemon, and unwanted profile
changes for users.
** (power-profiles-daemon:55299): DEBUG: 10:48:10.411: (:1.0) requesting to hold profile 'performance', reason: ''
** (power-profiles-daemon:55299): DEBUG: 10:48:10.422: Setting active profile 'performance' for reason 'program-hold' (current: 'balanced')
==55299== Invalid read of size 8
==55299== at 0x4AA40F9: g_type_check_instance_is_fundamentally_a (gtype.c:4088)
==55299== by 0x4A8DA08: g_object_unref (gobject.c:3484)
==55299== by 0x4B17702: UnknownInlinedFun (gmain.c:1666)
==55299== by 0x4B17702: g_source_callback_unref (gmain.c:1659)
==55299== by 0x4B1B8BB: g_source_destroy_internal (gmain.c:1331)
==55299== by 0x4B1D47F: UnknownInlinedFun (gmain.c:3411)
==55299== by 0x4B1D47F: g_main_context_dispatch (gmain.c:4099)
==55299== by 0x4B72287: g_main_context_iterate.constprop.0 (gmain.c:4175)
==55299== by 0x4B1C902: g_main_loop_run (gmain.c:4373)
==55299== by 0x403C10: main (power-profiles-daemon.c:1006)
==55299== Address 0x54edc60 is 0 bytes inside a block of size 104 free'd
==55299== at 0x48430E4: free (vg_replace_malloc.c:872)
==55299== by 0x4B220BC: g_free (gmem.c:199)
==55299== by 0x4B3C6FF: g_slice_free1 (gslice.c:1183)
==55299== by 0x4AA2EF4: g_type_free_instance (gtype.c:2008)
==55299== by 0x49B4840: g_dbus_method_invocation_return_value_internal (gdbusmethodinvocation.c:528)
==55299== by 0x4064F2: hold_profile (power-profiles-daemon.c:568)
==55299== by 0x4064F2: handle_method_call (power-profiles-daemon.c:711)
==55299== by 0x49A4451: call_in_idle_cb.lto_priv.0 (gdbusconnection.c:4916)
==55299== by 0x4B1952A: g_idle_dispatch (gmain.c:5897)
==55299== by 0x4B1D33E: UnknownInlinedFun (gmain.c:3381)
==55299== by 0x4B1D33E: g_main_context_dispatch (gmain.c:4099)
==55299== by 0x4B72287: g_main_context_iterate.constprop.0 (gmain.c:4175)
==55299== by 0x4B1C902: g_main_loop_run (gmain.c:4373)
==55299== by 0x403C10: main (power-profiles-daemon.c:1006)
==55299== Block was alloc'd at
==55299== at 0x484086F: malloc (vg_replace_malloc.c:381)
==55299== by 0x4B257A8: g_malloc (gmem.c:106)
==55299== by 0x4B3D1E4: g_slice_alloc (gslice.c:1072)
==55299== by 0x4B3D84D: g_slice_alloc0 (gslice.c:1098)
==55299== by 0x4AA81F4: g_type_create_instance (gtype.c:1911)
==55299== by 0x4A8FCAC: g_object_new_internal (gobject.c:1945)
==55299== by 0x4A90C7C: g_object_new_with_properties (gobject.c:2114)
==55299== by 0x4A91780: g_object_new (gobject.c:1785)
==55299== by 0x49D8033: UnknownInlinedFun (gdbusmethodinvocation.c:369)
==55299== by 0x49D8033: schedule_method_call.constprop.0 (gdbusconnection.c:4946)
==55299== by 0x49A45B9: validate_and_maybe_schedule_method_call.lto_priv.0 (gdbusconnection.c:5048)
==55299== by 0x499C57A: UnknownInlinedFun (gdbusconnection.c:5091)
==55299== by 0x499C57A: UnknownInlinedFun (gdbusconnection.c:7172)
==55299== by 0x499C57A: UnknownInlinedFun (gdbusconnection.c:2344)
==55299== by 0x499C57A: on_worker_message_received (gdbusconnection.c:2258)
==55299== by 0x49B0082: UnknownInlinedFun (gdbusprivate.c:488)
==55299== by 0x49B0082: UnknownInlinedFun (gdbusprivate.c:484)
==55299== by 0x49B0082: UnknownInlinedFun (gdbusprivate.c:516)
==55299== by 0x49B0082: _g_dbus_worker_do_read_cb (gdbusprivate.c:801)
==55299==
(power-profiles-daemon:55299): GLib-GObject-CRITICAL **: 10:48:10.427: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
As power-profiles-daemon keeps getting built with slightly different
versions of pylint with newer warnings, disable pylint test by default
to avoid getting bug reports about it.
Closes: #52
If we are to run all the tests in parallel, we need to make sure that
each instance of the daemon gets its own configuration file, otherwise
all of them will be trying to change each other's config behind their
backs.
The drivers have needed to handle all the profiles they support since
c7fb31632b where we stopped using a
placeholder driver when a profile wasn't handled.