diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2014-06-18 09:49:28 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2014-06-24 10:45:37 +0200 |
commit | 433c067522ff4aca921dbcaf0c326dc6f57b6e53 (patch) | |
tree | 4c6a2ce1a726a76470eba1a20eb1e7242e4832e0 | |
parent | 512fe08c7e87db93486ceaf9b15a13383a71699a (diff) | |
download | NetworkManager-433c067522ff4aca921dbcaf0c326dc6f57b6e53.tar.gz |
cli: mitigate slowness of readline() for some broken versions
There was a bug in readline-6.2 causing very slow processing when
rl_event_hook was used [1]. This was fixed later after 6.2 was out.
Unfortunately some distributions don't include the fix. Fedora is one
example [2].
So we lower keyboard input timeout from 0.1s to 0.01s. This makes readline
more responsive. On the other hand it causes more interrupts, calling
rl_event_hook callback more often and thus slightly higher CPU usage.
[1] https://lists.gnu.org/archive/html/bug-readline/2012-06/msg00005.html
[2] related: https://bugzilla.redhat.com/show_bug.cgi?id=1109946
Note: this commit could (should) be reverted later when we check that most
distributions have the readline bug fixed.
-rw-r--r-- | cli/src/nmcli.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cli/src/nmcli.c b/cli/src/nmcli.c index 50746efbbf..5aa9aab03f 100644 --- a/cli/src/nmcli.c +++ b/cli/src/nmcli.c @@ -481,6 +481,10 @@ main (int argc, char *argv[]) /* readline init */ rl_event_hook = event_hook_for_readline; + /* Set 0.01s timeout to mitigate slowness in readline when a broken version is used. + * See https://bugzilla.redhat.com/show_bug.cgi?id=1109946 + */ + rl_set_keyboard_input_timeout (10000); nmc_init (&nm_cli); g_idle_add (start, &args_info); |