On 8/9/10 2:07 PM, Bruce Korb wrote:
> My history file isn't being updated as I am led to believe it ought to be.
> Is there some shopt or other thingey that keeps the history unwritten?
> I've googled the issue and the answer is supposed to be "history -a",
> on occasion, but that isn't working:

The current code in bashhist.c:maybe_append_history() (which has existed
for at least 15 years) seems to not handle the case where the number of
history lines in the current session is equal to the number of history
list entries.  That is, the code won't append new lines if it doesn't
think there were any lines read from the history file when the shell
started.  That seems wrong, and I've attached a patch that fixes it.
However, the code has existed in its current form for so long that I'm
wondering whether or not there is some other reason for it.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.1-patched/bashhist.c      2009-08-14 15:33:02.000000000 -0400
--- bashhist.c  2010-08-13 21:09:08.000000000 -0400
***************
*** 373,377 ****
  
    result = EXECUTION_SUCCESS;
!   if (history_lines_this_session && (history_lines_this_session < 
where_history ()))
      {
        /* If the filename was supplied, then create it if necessary. */
--- 377,381 ----
  
    result = EXECUTION_SUCCESS;
!   if (history_lines_this_session && (history_lines_this_session <= 
where_history ()))
      {
        /* If the filename was supplied, then create it if necessary. */

Reply via email to