[readline/f20] input: fix rl_read_key slowness when using rl_event_hook

Jan Chaloupka jchaloup at fedoraproject.org
Thu Jun 19 11:04:54 UTC 2014


commit b27f03b89069843dbfe9cf1bc252dd40e14996cd
Author: jchaloup <jchaloup at redhat.com>
Date:   Thu Jun 19 13:02:33 2014 +0200

    input: fix rl_read_key slowness when using rl_event_hook
    
    - resolves: #1109946

 readline-6.2-slow-event-hook.patch |   62 ++++++++++++++++++++++++++++++++++++
 readline.spec                      |   11 ++++++-
 2 files changed, 72 insertions(+), 1 deletions(-)
---
diff --git a/readline-6.2-slow-event-hook.patch b/readline-6.2-slow-event-hook.patch
new file mode 100644
index 0000000..9045e27
--- /dev/null
+++ b/readline-6.2-slow-event-hook.patch
@@ -0,0 +1,62 @@
+From e8b937f06bb4a88d68e96c81f63ead20892ea9b8 Mon Sep 17 00:00:00 2001
+From: Chet Ramey <chet.ramey at case.edu>
+Date: Tue, 10 Jul 2012 09:47:21 -0400
+Subject: [PATCH] Readline-6.2 patch 3
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+
+Signed-off-by: Jiří Klimeš <jklimes at redhat.com>
+---
+ input.c    | 12 ++++++++----
+ patchlevel |  2 +-
+ 2 files changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/input.c b/input.c
+index 7c74c99..b49af88 100644
+--- a/input.c
++++ b/input.c
+@@ -409,7 +409,7 @@ rl_clear_pending_input ()
+ int
+ rl_read_key ()
+ {
+-  int c;
++  int c, r;
+ 
+   rl_key_sequence_length++;
+ 
+@@ -429,14 +429,18 @@ rl_read_key ()
+ 	{
+ 	  while (rl_event_hook)
+ 	    {
+-	      if (rl_gather_tyi () < 0)	/* XXX - EIO */
++	      if (rl_get_char (&c) != 0)
++		break;
++		
++	      if ((r = rl_gather_tyi ()) < 0)	/* XXX - EIO */
+ 		{
+ 		  rl_done = 1;
+ 		  return ('\n');
+ 		}
++	      else if (r == 1)			/* read something */
++		continue;
++
+ 	      RL_CHECK_SIGNALS ();
+-	      if (rl_get_char (&c) != 0)
+-		break;
+ 	      if (rl_done)		/* XXX - experimental */
+ 		return ('\n');
+ 	      (*rl_event_hook) ();
+diff --git a/patchlevel b/patchlevel
+index 7cbda82..ce3e355 100644
+--- a/patchlevel
++++ b/patchlevel
+@@ -1,3 +1,3 @@
+ # Do not edit -- exists only for use by patch
+ 
+-1
++2
+-- 
+1.7.11.7
+
diff --git a/readline.spec b/readline.spec
index 53892c1..3741a3e 100644
--- a/readline.spec
+++ b/readline.spec
@@ -1,7 +1,7 @@
 Summary: A library for editing typed command lines
 Name: readline
 Version: 6.2
-Release: 9%{?dist}
+Release: 10%{?dist}
 License: GPLv3+
 Group: System Environment/Libraries
 URL: http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
@@ -21,6 +21,10 @@ Patch23:  readline-6.2-gdb.patch
 Patch24: readline-aarch64.patch
 # BZ1077026, security fix for temporary file
 Patch25: readline-6.2-debug_fncs_security_fix.patch
+# fix slow processing when using rl_event_hook
+# https://lists.gnu.org/archive/html/bug-readline/2012-06/msg00008.html
+Patch26: readline-6.2-slow-event-hook.patch
+
 Requires(post): /sbin/install-info
 Requires(preun): /sbin/install-info
 BuildRequires: ncurses-devel
@@ -66,6 +70,7 @@ library.
 %patch23 -p1 -b .gdb
 %patch24 -p1 -b .arm
 %patch25 -p1 -b .debug_fncs_security_fix
+%patch26 -p1 -b .rl_read_key
 
 pushd examples
 rm -f rlfe/configure
@@ -143,6 +148,10 @@ fi
 %{_libdir}/lib*.a
 
 %changelog
+* Mon Jun 16 2014 Jiří Klimeš <jklimes at redhat.com> 6.2-10
+- resolves: #1109946
+  input: fix rl_read_key slowness when using rl_event_hook
+
 * Mon May 26 2014 jchaloup <jchaloup at redhat.com> - 6.2-9
 - resolves: #1077026
   Security patch for debug functions


More information about the scm-commits mailing list