Skip to content

application: Preserve GS_DEBUG-induced verbosity

Will Thompson requested to merge wip/wjt/2082-make-GS_DEBUG-work into main

The first call in main() is to gs_debug_new_from_environment(), which checks whether 'GS_DEBUG' is set in the environment and, if so, enables verbose output. In theory, this should mean that setting GS_DEBUG=1 in your session's environment, perhaps via environment.d(5), will cause Software to always show verbose output, regardless of how it is launched.

gs_application_handle_local_options() runs slightly later in the application startup. Its first act is to enable verbose output if '--verbose' was passed on the command line, and disable it if not. This means that setting GS_DEBUG in the environment has no effect.

Later down the same function, the 'verbose' action is activated if '--verbose' was passed on the command line. This translates to a call to gs_debug_set_verbose(..., TRUE) in the service that owns the 'org.gnome.Software' bus name, which may or may not be the current process.

Remove the problematic first call to gs_debug_set_verbose(). Trigger the 'verbose' action if '--verbose' is passed earlier, so that verbose output is enabled, if requested, before any other actions (such as 'autoupdate') are handled.

Compared to the previous behaviour:

  • GS_DEBUG is now respected, rather than effectively ignored
  • It is no longer possible to disable verbose output on a running instance of the app (but I believe this was only previously possible by accident)
  • In the case where the current process is talking to an existing gnome-software instance, the current process will no longer display verbose output if '--verbose' is passed but 'GS_DEBUG' is unset. However since all it is doing is triggering actions on the remote instance, I don't think this is a great loss.

Fixes: #2082 (closed)

Merge request reports