delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/12/24/16:34:53

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Eli Barzilay <eli AT barzilay DOT org>
Subject: Re: HISTFILE in zsh
Date: 24 Dec 2006 16:34:02 -0500
Lines: 41
Message-ID: <m3zm9d567p.fsf@winooski.ccs.neu.edu>
References: <m34prm7ebt DOT fsf AT winooski DOT ccs DOT neu DOT edu>
Mime-Version: 1.0
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Eli Barzilay <eli AT barzilay DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019