bash history not restored

Earnie Boyd
Mon May 24 10:40:00 GMT 1999

--- Ian Zimmerman <> wrote:
> Earnie Boyd wrote:
> > 
> > --- Ian Zimmerman <> 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

Perhaps you could download the current bash and modify the write of the history
file in binary format.  Bash will build OOB.
"Earnie Boyd" < >
       DLLHELP: < >
                < >
Do You Yahoo!?
Free instant messaging and more at

Want to unsubscribe from this list?
Send a message to

More information about the Cygwin mailing list