From 1717a8c9655c8e3ef35b66e4b3d6e3dcb0c5568d Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Wed, 21 Feb 2018 12:15:41 +0000 Subject: [PATCH] gdbus-tool: Ignore unknown options for the 'emit' subcommand when completing When completing, we parse the options that the user has typed so far. Up until now we've been doing this without ignoring unknown options. This leads to broken completions when the user has typed an incomplete parameter. For example, when doing the following: $ gdbus emit --session --obj We expect --object-path to be completed, but it is currently not. What happens is that we fail to parse the options, therefore don't act on --session and so don't connect to the session bus, then we early-exit because we need to know which bus to operate on for later completions. Instead we can ignore the half-completed --obj, parse --session, get connected to the bus and then move on to the later completion code. https://bugzilla.gnome.org/show_bug.cgi?id=793597 --- gio/gdbus-tool.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gio/gdbus-tool.c b/gio/gdbus-tool.c index 77863a2a0..e71f5ba58 100644 --- a/gio/gdbus-tool.c +++ b/gio/gdbus-tool.c @@ -583,6 +583,8 @@ handle_emit (gint *argc, modify_argv0_for_command (argc, argv, "emit"); o = g_option_context_new (NULL); + if (request_completion) + g_option_context_set_ignore_unknown_options (o, TRUE); g_option_context_set_help_enabled (o, FALSE); g_option_context_set_summary (o, _("Emit a signal.")); g_option_context_add_main_entries (o, emit_entries, GETTEXT_PACKAGE);