polkit-org / polkit

polkit (formerly PolicyKit) is a toolkit for defining and handling authorizations. It is used for allowing unprivileged processes to speak to privileged processes.
Other
68 stars 33 forks source link

LogControl doesn't interact with `--no-debug` well #518

Open evverx opened 1 week ago

evverx commented 1 week ago

Describe the bug The LogControl1 API doesn't affect logs emitted by polkit when --no-debug option is removed.

To Reproduce To reproduce it it should be enough to remove the --no-debug option and set the LogLevel to crit. polkit keeps emitting messages like

Error performing authentication: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Remote peer disconnected (g-dbus-error-quark 4)
Error cancelling authentication: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name is not activatable
g_dbus_method_invocation_get_message: assertion 'G_IS_DBUS_METHOD_INVOCATION (invocation)' failed
g_dbus_message_get_unix_fd_list: assertion 'G_IS_DBUS_MESSAGE (message)' failed
16:57:03.311: Error converting subject to JS object: Process 786 terminated
Error converting subject to JS object: Process 786 terminated
Error getting process for system bus name `:1.99': GDBus.Error:org.freedesktop.DBus.Error.NameHasNoOwner: The connection does not exist
Error performing authentication: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name is not activatable (g-dbus-error-quark 2)
Error getting process for system bus name `:1.99': GDBus.Error:org.freedesktop.DBus.Error.NameHasNoOwner: The connection does not exist
Error cancelling authentication: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name is not activatable
Error cancelling authentication: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name is not activatable
Error calling GetUnitByPIDFD: GDBus.Error:org.freedesktop.DBus.Error.UnixProcessIdUnknown: Failed to get PID from PIDFD: No such process
g_error_free: assertion 'error != NULL' failed
Process 786 terminated
g_error_free: assertion 'error != NULL' failed
g_error_free: assertion 'error != NULL' failed
g_error_free: assertion 'error != NULL' failed

Expected behavior polkit should emit only critical messages (and the TRANSPORT should probably be syslog since the LogTarget property says that it all goes to syslog.

It was also discussed in https://github.com/polkit-org/polkit/issues/506#issuecomment-2431965987

evverx commented 1 week ago

FWIW I agree with https://github.com/polkit-org/polkit/pull/425#discussion_r1530689868 that ideally --no-debug shouldn't be necessary. polkit could emit info messages by default and the LogLevel property could be used to control all the logs (by analogy with what all the systemd services do for example).