[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: |
Graham Jones |
Subject: |
Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53 |
Date: |
Wed, 5 Nov 2014 08:44:32 +1100 |
> On 5 Nov 2014, at 12:54 am, Chet Ramey <chet.ramey@case.edu> wrote:
>
> On 11/3/14 5:08 PM, Graham Jones wrote:
>> These are for:
>> bash --version
>> GNU bash, version 4.3.30(1)-release (x86_64-apple-darwin14.0.0)
>
> This trace looks pretty reasonable. Maybe you could temporarily move your
> history file to some other name and see if you can reproduce this behavior
> starting fresh with an empty history file.
As you may have seen from the other email, the history file is relatively
small.
I did just remove it and start afresh, and the issue still occurs.
Whilst attempting to reproduce it, I noticed that is doesn’t reoccur
immediately.
In my first test, I deleted the history file and closing that session (the only
one). When I created a single terminal session, I could su to root and hit
return a large number of times without it reproducing the error. I need created
another terminal session and (without suing) after issue just a single command,
the next command on the root terminal exhibited the behaviour.
I retried a similar experiment, again after removing the history file, and
again it wasn’t immediately reproducible. This time I didn’t create a second
session but left the terminal along for 3 or 4 minutes. When I next entered a
command the behaviour has returned.
In both cases the line count in $HISTFILE was low = ~40.
Now after performing these to experiments I just tried to create a new session
and found my $HISTFILE owned by root (or at least permission denied, I didn’t
actually check the file mode and owner before chmoding it). This seems strange
given I never log in as root only su so presumably the first command executed
must always be by my own user.
After chmoding it, I notice this:
graham@zebedee:~$ wc -l $HISTFILE
500001 /Users/graham/.bash_history
I have obviously not entered that many commands!
Immediately after I go to check the contents and it’s owned by root again
graham@zebedee:~$ wc -l $HISTFILE
wc: /Users/graham/.bash_history: open: Permission denied
graham@zebedee:~$ l $HISTFILE
-rw------- 1 root staff 1500000 4 Nov 21:36 /Users/graham/.bash_history
graham@zebedee:~$ ps aux |grep bash
graham 99600 0.0 0.0 2432772 648 s000 S+ 9:40pm 0:00.00
grep bash
graham 99555 0.0 0.5 2492596 39076 s000 S 9:36pm 0:00.49
-bash
But yet there is only my bash running non-priveledge.
Now I was expecting a hole in the file, but when I finally get to see the
contents, I have 500,000 ls commands in there (one of my test commands from
above)
graham@zebedee:~$ wc -l $HISTFILE
wc: /Users/graham/.bash_history: open: Permission denied
graham@zebedee:~$ sudo chown graham $HISTFILE
Password:
graham@zebedee:~$ sort $HISTFILE | uniq -c | sort -n
1 sudo chown graham $HISTFILE
1 vi $HISTFILE
500000 ls
>
> 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/
- Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53, Graham Jones, 2014/11/03
- Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53, Graham Jones, 2014/11/03
- Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53, Chet Ramey, 2014/11/04
- Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53,
Graham Jones <=
- Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53, Piotr Grzybowski, 2014/11/04
- Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53, Chet Ramey, 2014/11/05
- Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53, Piotr Grzybowski, 2014/11/05
- Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53, Graham Jones, 2014/11/05
- Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53, Graham Jones, 2014/11/05
- Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53, Chet Ramey, 2014/11/05
- Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53, Piotr Grzybowski, 2014/11/06
- Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53, Greg Wooledge, 2014/11/06
- Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53, Chet Ramey, 2014/11/06