On 11/17/26 5:39 PM, Luke Schlather wrote:
Maybe I should back up and describe my actual problem. I think I had
assumed the problem was something slightly different from what it actually
is, and this shopt does fix the problem I have. My actual problem (which I
view as a bug) is that often I will have several ssh sessions open, my
connection drops, and the commands I just executed are not in the history
when I reconnect, even though I have histappend on.
OK. The ssh connection dropping should result in the bash process receiving
a SIGHUP, at which point the shell's fatal signal handler
(sig.c:termsig_handler)
will write the history to $HISTFILE:
if (interactive_shell &&
(interactive || parse_and_execute_level || sourcelevel) &&
(sig == SIGHUP || sig == SIGTERM) &&
(remember_on_history || enable_history_list))
maybe_save_shell_history ();
There have been a couple of updates to that code since bash-5.3, mostly
the result of https://savannah.gnu.org/bugs/?68122, but I doubt that these
changes are related.
I'm realizing now that my understanding was a little incomplete - once the
server notices that the clients timed out, it should in fact write the
history for each shell and everything is fine. But to me this looks like my
history is lost forever because my new shell will never pick up that
history.
Are all your shells using the same $HISTFILE?
It seems to me that by default history should be there when I
reconnect when histappend is on, and if it's not it's a bug.
Let's see if we can identify the actual problem here.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/