Subject: Re: Ad: fast-import problem importing dos format files under cygwin

From: Jan Hudec <[email-masked]>
Date: Wed, 3 Dec 2008 19:05:50 +0100

Hi,

On Wed, Dec 03, 2008 at 17:20:54 +0100, Johannes Schindelin wrote:
> Hi,
> On Wed, 3 Dec 2008, Shawn O. Pearce wrote:
> > Jan Hudec <[email-masked]> wrote:
> > > Dne 3 Prosinec 2008, 13:18, Johannes Sixt napsal(a):
> > > > Jan Hudec schrieb:
> > > >> On 3 December 2008, 08:51, Jan Hudec wrote:
> > > >>>
> > > >>> I have been playing with fast-import in cygwin and I have problems 
> > > >>> importing files with CR/LF line-endings. The size in data command 
> > > >>> is calculated including the CRs and than the file is copied binary 
> > > >>> to the fast-import input stream. However fast-import skips the CRs 
> > > >>> when reading, overreads by that number of bytes and fails when it 
> > > >>> tries to read the next command from the middle.
> >
> > [...] 
> > fast-import under-reading near CRs and getting misaligned on its input 
> > indicates that the stdio library has given us a FILE* for stdin which is 
> > converting CRLF pairs into LFs, even within an fread() call.
> > 
> > My guess here is fast-import's stdin is set in text mode, but it really 
> > needs to be in binary mode.  fast-import.c never attempts to correct 
> > that when it starts, so on DOS based systems we are probably totally 
> > screwed from the beginning...

Yes, it does indeed sound so. Strange thing is why it would be that way, when
it does not seem to be the case for any other process (eg. the shell will
complain loudly if I feed it a DOS formatted script). The standard input is
simple shell redirect from a file on a binary-mounted filesystem. I'll do
some more cross-checks tomorrow.

> I think you need to set the environment variable
> 
> 	CYGWIN=binmode

Will try. Thanks.

-- 
						 Jan 'Bulb' Hudec <[email-masked]>