[Bug 283310] /bin/sh history is not saved unless exit is used

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 13 Dec 2024 13:50:46 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283310

            Bug ID: 283310
           Summary: /bin/sh history is not saved unless exit is used
           Product: Base System
           Version: 14.2-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: justine@smithies.me.uk

sh only saves its history if you end the session with an explicit exit command.
If the sh session is closed via a signal (reboot, ssh connection drop/timeout,
terminal emulator closes tab/window, etc.) sh does not appear to save its
history.
I have tested this with others, we have set our HISTFILE and HISTSIZE so that's
not the issue.
I can recreate it by opening a foot terminal window in my river wayland
compositor and entering a command. If I then type fc -l I see the command typed
in the history. But if I close that window without typing exit and then open a
new terminal window all the history from that last terminal session is gone.
The same happens via an ssh connection or if I close down my window manager,
the history is lost. The only way to save the history is to type exit before
closing the window. This issue doesn't just happen in a wayland compositor it
could be an X session too.
I see this has been reported before but ignored due to lack of information.
Hopefully I have provided enough info.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213705

-- 
You are receiving this mail because:
You are the assignee for the bug.