From eccaf795b95cb8b24e61d7c277b375156efeb540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= Date: Mon, 8 Jun 2020 17:27:59 +0200 Subject: [PATCH] tuned-adm: Fix profile_info crash when no profile is active MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If Tuned is running without any profile applied (e.g. after running 'tuned-adm off'), then 'tuned-adm profile_info' crashes with the following error: 2020-06-08 17:24:11,998 ERROR dbus.connection: Unable to set arguments (None,) according to signature 's': : Expected a string or unicode object ERROR:dbus.connection:Unable to set arguments (None,) according to signature 's': : Expected a string or unicode object dbus[25054]: arguments to dbus_message_get_destination() were incorrect, assertion "message != NULL" failed in file ../../dbus/dbus-message.c line 3678. This is normally a bug in some application using the D-Bus library. D-Bus not built with -rdynamic so unable to print a backtrace Aborted (core dumped) To fix it, detect that no profile is applied and print the same message as in _action_profile_info in this case. Signed-off-by: Ondřej Lysoněk --- tuned/admin/admin.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tuned/admin/admin.py b/tuned/admin/admin.py index c56633b..680d267 100644 --- a/tuned/admin/admin.py +++ b/tuned/admin/admin.py @@ -149,7 +149,12 @@ class Admin(object): def _action_dbus_profile_info(self, profile = ""): if profile == "": profile = self._dbus_get_active_profile() - return self._controller.exit(self._print_profile_info(profile, self._controller.profile_info(profile))) + if profile: + res = self._print_profile_info(profile, self._controller.profile_info(profile)) + else: + print("No current active profile.") + res = False + return self._controller.exit(res) def _action_profile_info(self, profile = ""): if profile == "":