Package: rlfe Version: 6.0-3 Severity: normal Tags: patch I found rlfe sometimes doesn't save its command history as expected. I tracked this down to the two different ways rlfe can exit. (Search for "exit (0)" in the source.) The first is SIGCHLD from its inferior, the second is read error from its inferior. History was not being saved in the second case. The attached patch fixes this.
It seems that normally the first path is run. I don't know exactly why I caused the second path, but perhaps it happens when the inferior closes its output then takes a while longer to exit. If you don't think the change is legitimate, I'll do some more digging to figure out what triggers this case. Andrew -- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.30-1-686 (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages rlfe depends on: ii libc6 2.9-25 GNU C Library: Shared libraries ii libncurses5 5.7+20090803-2 shared libraries for terminal hand ii libreadline6 6.0-4 GNU readline and history libraries rlfe recommends no packages. rlfe suggests no packages. -- no debconf information
--- rlfe.c.orig 2009-09-03 13:42:35.000000000 -0700 +++ rlfe.c 2009-09-03 13:41:06.000000000 -0700 @@ -154,21 +154,27 @@ static pid_t child = -1; static void -sig_child (int signo) +finish_up() { - int status; - wait (&status); if (hist_file != 0) { write_history (hist_file); if (hist_size) history_truncate_file (hist_file, hist_size); } - DPRINT0 ("(Child process died.)\n"); tcsetattr(STDIN_FILENO, TCSANOW, &orig_term); exit (0); } +static void +sig_child (int signo) +{ + int status; + wait (&status); + DPRINT0 ("(Child process died.)\n"); + finish_up(); +} + volatile int propagate_sigwinch = 0; /* sigwinch_handler @@ -703,8 +709,7 @@ if (count <= 0) { DPRINT0 ("(Connection closed by foreign host.)\n"); - tcsetattr(STDIN_FILENO, TCSANOW, &orig_term); - exit (0); + finish_up(); } old_count = buf_count;