[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.1

From: Chet Ramey
Subject: Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53
Date: Wed, 05 Nov 2014 21:25:07 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 11/4/14 5:16 PM, Piotr Grzybowski wrote:
>  Chet: for reasons unexplained calls to read_history_range at
> history.def:219
> 219           result = read_history_range (filename, history_lines_in_file, 
> -1);
> return more and more records (77824 is above my HISTFILESIZE):

There is an issue with this particular, relatively infrequent, set of

2. Actual size of the history file > HISTSIZE
3. history list contains HISTSIZE entries
4. the user executes a sequence of `history -a; history -n'.  Even
   `history -a; history -r' would probably prevent this, at the cost
   of more malloc/free operations.

In this case, history_lines_in_file (which, despite its name, is supposed
to keep track of how many lines bash has read from the history file) is
calculated incorrectly.  The result is that bash reads way too many lines
from the history file each time.

There are a couple of ways to fix it: one that uses facilities the history
library provides today and one that changes the history library to expose
the values more directly.  One will appear in the next snapshot.


``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]