This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: HISTFILE in zsh


Eli Barzilay <eli@barzilay.org> writes:

> I'm having the same problem that is described at
> 
>   http://www.cygwin.com/ml/cygwin/2004-12/msg00195.html
> 
> I'm surprised that it was reported in 2004 -- I use cygwin on several
> machines with no problems, it's only a new one that is having the
> above symptom.
> 
> (Which is related to saving/loading the history file -- `fc -R foo'
> and `fc -W foo' also hang.  Using strace, it looks like the problem is
> some kind of an infinite loop that is related to a lock file for the
> history file.)

In case anyone else runs into this problem -- the best solution I
could find is to just avoid loading/saving the history, and do it
instead using my own hack -- listed below for reference:

  MYHISTFILE="$HISTFILE"
  unset HISTFILE
  
  while read L; do
    print -s "$L"
  done < "$MYHISTFILE"
  
  TRAPEXIT() {
    if [[ "$HISTCMD" != "0" ]]; then
      echo "Saving history..."
      if [[ ! -e "$MYHISTFILE" ]]; then touch "$MYHISTFILE"; fi
      fc -ln 0 -1 >> "$MYHISTFILE"
      rm -f "$MYHISTFILE-$$"
      tail -n "$SAVEHIST" "$MYHISTFILE" > "$MYHISTFILE-$$"
      cat "$MYHISTFILE-$$" > "$MYHISTFILE"
      rm -f "$MYHISTFILE-$$"
    fi
  }

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]