Unnecessary APIs have been removed from nm-setting-proxy, client like
nm-connection-editor are expected to create a PAC script snippet the load
the location of file in NM.
Currently the editor runs in a dedicated thread so that the blocking
call to readline() doesn't stop the processing of D-Bus events in the
main loop. The editor thread can access objects concurrently with the
main thread and this can cause races and crashes.
Remove the editor thread and use the non-blocking readline API.
https://bugzilla.gnome.org/show_bug.cgi?id=732097https://bugzilla.redhat.com/show_bug.cgi?id=1368353
Since commit ac888de151 ("cli/connections: fail the activation when
the active connection disappears") we rely only on the disappearing of
the active-connection to determine the failure of an activation.
libnm can collapse a 'added' and a 'removed' signal if they are
received closer enough and thus we may miss the removal of the active
connection. Restore the detection of failure based on
active-connection state.
The error returned to users when a load_connection(s)/set_logging call
fails due to D-Bus policy denial is a bit obscure:
$ nmcli general logging level debug
Error: failed to set logging: Rejected send message, 4 matched rules;
type="method_call", sender=":1.233" (uid=1001 pid=27225 comm="nmcli
general logging level debug ")
interface="org.freedesktop.NetworkManager" member="SetLogging" error
name="(unset)" requested_reply="0" destination=":1.207" (uid=0
pid=25793 comm="/usr/sbin/NetworkManager --no-daemon ")
Convert it to a more comprehensible:
$ nmcli general logging level debug
Error: failed to set logging: access denied
https://bugzilla.redhat.com/show_bug.cgi?id=1362542
(cherry picked from commit 805925f9ef)
It can go away before the activation finishes:
(process:378): GLib-GObject-WARNING **: instance with invalid (NULL) class pointer
Thread 1 "lt-nmcli" received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff4fa919b in g_logv () from /lib64/libglib-2.0.so.0
(gdb) bt
#0 0x00007ffff4fa919b in g_logv () at /lib64/libglib-2.0.so.0
#1 0x00007ffff4fa930f in g_log () at /lib64/libglib-2.0.so.0
#2 0x00007ffff529b3ea in g_type_check_instance () at /lib64/libgobject-2.0.so.0
#3 0x00007ffff528fa94 in g_signal_handlers_disconnect_matched () at /lib64/libgobject-2.0.so.0
#4 0x000000000041ae4e in activate_connection_info_finish (info=0x7b5490) at connections.c:2197
#5 0x00007ffff5279470 in g_cclosure_marshal_VOID__OBJECTv () at /lib64/libgobject-2.0.so.0
#6 0x00007ffff5276617 in _g_closure_invoke_va () at /lib64/libgobject-2.0.so.0
#7 0x00007ffff5290ea9 in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0
#8 0x00007ffff52914ff in g_signal_emit () at /lib64/libgobject-2.0.so.0
#9 0x00007ffff52763e8 in g_closure_invoke () at /lib64/libgobject-2.0.so.0
#10 0x00007ffff52884a2 in signal_emit_unlocked_R () at /lib64/libgobject-2.0.so.0
#11 0x00007ffff529112d in g_signal_emit_valist () at /lib64/libgobject-2.0.so.0
#12 0x00007ffff52919ab in g_signal_emit_by_name () at /lib64/libgobject-2.0.so.0
#13 0x00007ffff78fc9b1 in deferred_notify_cb (data=<optimized out>) at nm-object.c:243
#14 0x00007ffff4fa2703 in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#15 0x00007ffff4fa2ab0 in g_main_context_iterate.isra () at /lib64/libglib-2.0.so.0
#16 0x00007ffff4fa2dd2 in g_main_loop_run () at /lib64/libglib-2.0.so.0
#17 0x00000000004146e3 in main (argc=<optimized out>, argv=<optimized out>) at nmcli.c:618
(gdb) print info->device
Re-enable the check on ambiguos properties but this time manage perfect
matches (i.e., the full property name has been typed) that are prefix
of other properties.
Test case:
nmcli --complete-args connection add type wifi wifi.
Here "wifi" is a property alias that is also prefix of the property
alias "wifi-sec".
When parsing arguments of "connection add" we first read the available
property-value pairs and then check if the --ask option was passed in
order to aid in the fill process of a new connection.
Anyway, if there are no property-value tuples at all, we don't even
check the --ask option, returning with error.
Fix this just checking if any arg is there (argc) before invoking
read_connection_properties().
If we found that setting name prefix is in fact unambiguous and return
the completion string for that setting we were freeing the string upon
the return. That looks like a typo.
Fixes "nmcli --complete-args add type wifi wifi."
^^^^ not ambiguous