Dear Readline people (and Chet Ramey), I'm trying to help fix some bugs in the R interpreter, involving signals not being received by GNU Readline.
R currently has problems which stem from ignoring SIGWINCH <https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16604>, and failing to correctly reset the Readline state upon receiving SIGINT <https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16603>. I understand from reading about a similar bug in Python <https://bugs.python.org/issue23735> that the problem may stem from signal handling changes made in Readline 6.3. According to the Python bug (which quotes Chet), the solution is for the application itself to trap SIGWINCH, and then set a flag to call "rl_resize_terminal()" before the next "select()". However, the need to do this is apparently not yet noted in the Readline documentation, for instance the "Alternate interface example" <http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC43> seems to lack the extra code for SIGWINCH (and, presumably, SIGINT). Delving a bit deeper, I'm wondering why it was necessary for Readline to make application writers do all this extra work. For instance, why not go back to installing signal handlers (via "rl_set_signals()") in "rl_callback_handler_install()", and extend the callback interface with a function - e.g. "rl_check_for_signal()" - that queries _rl_caught_signal to see if a signal is pending? Then ask application writers to call this function before/after "select()": while(running) { ... r = select (FD_SETSIZE, &fds, NULL, NULL, NULL); if (r < 0 && errno != EINTR) { /* Handle possible errors */ } rl_check_for_signal(); /* <--- the new function */ if (FD_ISSET (fileno (rl_instream), &fds)) rl_callback_read_char (); } This way python, gdb, R, etc. would only need a one-line change. Wouldn't this be simpler than asking everyone to install their own SIGINT and SIGWINCH handlers manually? Sorry for the delay, I know Chet asked for "Thoughts?" in 2011... <https://lists.gnu.org/archive/html/bug-readline/2011-07/msg00012.html> Thank you, Frederick Eaton _______________________________________________ Bug-readline mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-readline
