`--keep-above` combined with any other arg no longer works since 1.8.12 (f3782da2)
Since 1.8.12, I think since commit f3782da2 - "connection-editor: turn it into a GtkApplication", this no longer works:
nm-connection-editor --keep-above --edit 2ee981ca-5ff4-4f9b-03fe-32879aa3dc85
in fact, no combination of
--keep-above with any other argument appears to work. All of these fail:
nm-connection-editor --keep-above --create nm-connection-editor --keep-above --edit=2ee981ca-5ff4-4f9b-03fe-32879aa3dc85 nm-connection-editor --edit 2ee981ca-5ff4-4f9b-03fe-32879aa3dc85 --keep-above
The failure mode is that an error appears on the console:
Failed to parse options: Unknown option --keep-above
and the app does not appear (though the process does not end, it just gets stuck until you hit ctrl-c).
I believe this is because of the way
src/connection-editor/main.c tries to parse the
keep-above option in
main(), but all the other options in
main() sets up the option, calls
g_option_context_free(), then sets up the callback to
editor_command_line(). I think the expectation here is that
g_option_context_parse(), having parsed
--keep-above, will remove it from
argv, and thus
editor_command_line() will not see it (and thus doesn't need to recognize it). However, this is not in fact the behaviour of
g_option_context_parse(), per the docs:
"If the parsing is successful, any parsed arguments are removed from the array and argc and argv are updated accordingly. A '--' option is stripped from argv unless there are unparsed options before and after it..."
i.e. in exactly the case we're dealing with here - a
-- option with other unparsed options on the command line - the option will not be dropped after parsing. Note that this does work:
which makes perfect sense, because per that explanation,
--keep-above is stripped from argv in this case because there are no "other unparsed options".
I guess either parsing of
--keep-above should be moved into
editor_command_line() if possible (I'm not sure why it isn't), or if that's not possible,
main() should be tweaked to do the work of removing it from
argv after parsing itself, or
editor_command_line() could be given a dummy entry allowing it to recognize the argument and just not do anything with it.
Note, this is quite significant to Fedora/RHEL, because this is exactly the invocation used by anaconda (the Fedora/RHEL installer) when it attempts to launch
nm-connection-editor for advanced connection editing. Thus in current Fedora Rawhide, you can't do any advanced connection editing, which will likely be considered a release blocker for Fedora 29.