Bug 1109946

Summary: readline in Fedora is very slow when rl_event_hook is used
Product: [Fedora] Fedora Reporter: Jirka Klimes <jklimes>
Component: readlineAssignee: Jan Chaloupka <jchaloup>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: c.david86, jchaloup, lnykryn, rkhan
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: readline-6.2-10.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-23 02:59:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
[PATCH] patch for Fedora 20 to fix the problem described none

Description Jirka Klimes 2014-06-16 17:26:40 UTC
When a program uses rl_event_hook to install a callback called by readline, the processing is very slow. It is best viewed by pasting a text as an input. The characters appears one by one, very slowly. See [1] for details.
A fix was pushed upstream on 2012-07-10, as "patch 3" for 6.2 release [2]. Fedora packages should include the patch to fix the issue.

You can easily reproduce the problem using any Fedora readline (6.2) package with this program:

cat << EOF > /tmp/rl-event-test.c
#include <stdio.h>
#include <stdlib.h>
#include <readline/readline.h>

int my_event_hook(void)
{
    return 0;
}

int main(void)
{
    char *str;
    rl_event_hook = &my_event_hook;
    str = readline("> ");
    printf("got '%s'\n", str);
    free(str);
    return 0;
}
EOF

$ gcc -g -lreadline /tmp/rl-event-test.c -o /tmp/rl-event-test
$ /tmp/rl-event-test
>
... and paste a text with mouse at the prompt. You will see the characters slowly appear one by one.
I suggest you pasted this text: "Jumping Jack is quick and bold. With skill his story will unfold.". It will remind you the old good Jumping Jack ZX Spectrum game [3] :-)

[1] https://lists.gnu.org/archive/html/bug-readline/2012-06/msg00008.html
[2] http://git.savannah.gnu.org/cgit/readline.git/commit/?id=e8b937f06bb4a88d68e96c81f63ead20892ea9b8
[3] http://www.youtube.com/watch?v=Ai-ocyGR_LQ&t=0m41s

Comment 1 Jirka Klimes 2014-06-16 17:34:20 UTC
Created attachment 909200 [details]
[PATCH] patch for Fedora 20 to fix the problem described

Fedora 20 scratch build:
http://koji.fedoraproject.org/koji/taskinfo?taskID=7048484

Comment 2 Fedora Admin XMLRPC Client 2014-06-17 06:30:59 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 3 Jirka Klimes 2014-06-18 08:18:18 UTC
The slowness can be somewhat mitigated by lowering keyboard input timeout
rl_set_keyboard_input_timeout (10000);
But this makes the event hook to be called more often, causing higher CPU usage.

So please include the patch (comment #1) to Fedora (all releases) and also to RHEL.
Or maybe better, rebase to readline 6.3 with all upstream patches - bug 1071336.

Comment 5 Fedora Update System 2014-06-19 11:32:08 UTC
readline-6.2-8.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/readline-6.2-8.fc19

Comment 6 Fedora Update System 2014-06-19 11:34:11 UTC
readline-6.2-10.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/readline-6.2-10.fc20

Comment 7 Fedora Update System 2014-06-19 22:59:17 UTC
Package readline-6.2-10.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing readline-6.2-10.fc20'
as soon as you are able to, then reboot.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-7523/readline-6.2-10.fc20
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2014-07-23 02:59:09 UTC
readline-6.2-10.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2014-12-07 04:32:15 UTC
readline-6.2-8.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.