Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

HISTFILE in zsh on Cygwin



I posted this question on the cygwin list, but got no replies, so
trying here too.  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.  I can provide the strace if it will help.)

My solution for now, is to hack my own history read/write (which works
for my, but it would be nice if the shell was doing what it is
supposed to do...).

  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!



Messages sorted by: Reverse Date, Date, Thread, Author