Subject: Re: bash history not restored
From: Ian Zimmerman <[email-masked]>
To: Cygnus tools mailing list <[email-masked]>
Date: Mon, 24 May 1999 14:54:08 -0700

Earnie Boyd wrote:
> 
> --- Ian Zimmerman <[email-masked]> wrote:
> > Earnie Boyd wrote:
> > >
> > > --- Ian Zimmerman <[email-masked]> wrote:
> > > > So, HOW do I make history work AND have text opens/fopens by default?
> > > > Is this a lose/lose situation?  After all, text mount is still the
> > > > default behavior, so this would make history not work out of the box.
> > > > (I can't test that because my setup has gotten too far outside the box.
> > > > :)
> > > >
> > > > Text mount is absolutely necessary for me; without it, I can't use Emacs
> > > > (or any other Cygwin program) to handle non-Cygwin originated files.
> > >
> > > This is a bug in the readline/history libraries used by bash.  I haven't
> > > tracked them down as yet.  I hope to get some time this week to take a look
> > at
> > > it.  The data is saved but with extra ^M's.  It appears that there is a ^M
> > on
> > > each line for each time the history file is written to.  So when `exit' is
> > > written it is written as `exit^M'. The next time the history is saved the
> > > previous `exit^M' becomes `exit^M^M'.  The routines must error on the ^M if
> > > binmode isn't set in the CYGWIN variable.
> > >
> > > I've found that if I have binmode set and remove any existing
> > ~/.bash_history
> > > file that the ^M's aren't written to the file.  Therefore, as a workaround
> > > until the problem can be fixed, set the binmode switch in the CYGWIN
> > > environment variable.  This is supposed to be the default and I don't have
> > a
> > > clue as to why specifying the switch vs not specifying the switch makes a
> > > difference but it does.
> >
> > But the documentation contains this Big Fat Warning:
> >
> > In b20.1 only, a file will be opened in binary mode if any of the
> > following conditions hold:
> >
> >           1.binary mode is specified in the open call
> >
> >           2.CYGWIN contains binmode
> >
> >           3.the file resides in a binary mounted partition
> >
> > So, it seems to me if I have binmode on, I lose text opens regardless of
> > mount type.  Or is the warning misleading?
> 
> Not misleading.  The warning is as stated.  However, the Jan 15th snapshot
> fixes this bug.
> 
> As for the history, as has already been stated, if you remove the \r from the
> .bash_history file it works with the Jan 15th snapshot regardless of the
> binmode switch.  However, you'll have to remove the \r everytime you start
> bash.
> 

I downloaded the January 15 snapshot, I set CYGWIN=binmode, and I
deleted the .bash_history file.  No dice; it STILL gets written with
^M's, and sure enough, it cannot be read by a new shell.

:-[

-- 
Ian Zimmerman
Lightbinders, Inc.
2325 3rd Street #324, San Francisco, California 94107

--
Want to unsubscribe from this list?
Send a message to [email-masked]