bug-bash
[Top][All Lists]
Advanced

[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 08:57:15 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:24.0) Gecko/20100101 Thunderbird/24.6.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):
> 
> 1: history_lines_in_file = 77824
> 
> the loop at histfile.c:269 in read_history_range is the one that hangs.
>  code at
> commit ca6a2ba40c709c2b45a56e49d21d0dfc66e21974
> Date:   Sun Oct 5 19:12:20 2014 -0400

I still can't reproduce it on OS X 10.10:

(1)$ ./bash --rcfile bashrc
(2)$ echo $BASH_VERSION
4.3.30(22)-release
(2)$ ls -l $HISTFILE
-rw-------  1 chet  staff  402 Nov  5 08:49 history-file
(2)$ wc -l < $HISTFILE
      20
(2)$ echo $HISTSIZE $HISTFILESIZE
500000 500000
(2)$ for (( i = 0; i < 30 ; i++ )); do history -a ; history -n ; done
(2)$ wc -l < $HISTFILE
      25
(2)$ tail $HISTFILE
ls
ls
exit
PROMPT_COMMAND='history -a ; history -n'
PROMPT_COMMAND='history -a ; history -n'
echo $BASH_VERSION
ls -l $HISTFILE
wc -l < $HISTFILE
echo $HISTSIZE $HISTFILESIZE
for (( i = 0; i < 30 ; i++ )); do history -a ; history -n ; done
(2)$ i=0; while [ $i -lt 30 ]; do history -a ; history -n; let i++; done
(2)$ wc -l < $HISTFILE
      28
(2)$ tail $HISTFILE
PROMPT_COMMAND='history -a ; history -n'
PROMPT_COMMAND='history -a ; history -n'
echo $BASH_VERSION
ls -l $HISTFILE
wc -l < $HISTFILE
echo $HISTSIZE $HISTFILESIZE
for (( i = 0; i < 30 ; i++ )); do history -a ; history -n ; done
wc -l < $HISTFILE
tail $HISTFILE
i=0; while [ $i -lt 30 ]; do history -a ; history -n; let i++; done

There are issues with keeping track of the number of lines currently in
the history file, but those occur at the boundary conditions where the
number of commands in the history list approaches $HISTFILESIZE.  That
doesn't explain your results.

Chet
-- 
``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]