bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible Readline bug


From: Hans Lub
Subject: Re: Possible Readline bug
Date: Sat, 9 Jan 2021 10:50:08 +0100

As you don't give example code I can only guess, but in general, calling readline from a signal handler is a bit iffy, as readline may be busy with its internal affairs (and hence in an inconsistent state) when the signal fires.

A simple technique would be to set a global variable remember_to_do_something from the signal handler, and then check it's value in the main loop. To get this main loop to run outside readline itself you would have to use readline's alternate  callback interface
which is not at all complicated to use.


Op za 9 jan. 2021 om 03:05 schreef Cosmin Petrescu <cosmin.petrescu59@gmail.com>:
Hello

      I was working with the Readline library on a linux basic shell and i found some unexpected behaviour with the unix_line_discard, kill_backward_line and kill_full_line functions. The program i am writing has a signal handler for ctrl+c and the purpose of it would be to "clear" the previous input considering that everything behind the ctrl+c is redundant. It all seems to work normally until i try to type the same letter as the one before the ctrl+c. For example, if i write x^C, the signal handler calls one of the functions (i tried with all of them) and then in the new line i can start typing anything but the letter x. It only allows writing the letter x after multiple keypresses. I am not 100% sure if this is a bug or a just a wrong way of using those functions but i am just making sure. 



--
Hans Lub +31 (0)6 14818149         PGP key
Dolomieten 74, NL 3524 VH Utrecht  hanslub42@gmail.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]