monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] "mtn cat" text/binary impedence mismatch


From: Larry Hastings
Subject: Re: [Monotone-devel] "mtn cat" text/binary impedence mismatch
Date: Mon, 06 Nov 2006 05:40:51 -0800
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)

Brian May wrote:
    Larry> If I check in a text file on Windows, then use "mtn cat" to
    Larry> stream it to the console, all the \r\n line endings get
    Larry> converted into \r\r\n.  Maybe it could not do that?

Maybe I am mistaken, but I didn't think monotone supported converting
text mode formats yet? As in all files are treated as binary on all
platforms.

In any case, converting \r\n --> \r\r\n seems broken, shouldn't it be
converting to just \n?
  
Sorry, I should have been more explicit.  The problem is that it doesn't convert the file, but stdout does.

When mtn.exe writes out a file, it does so in binary mode.  However, stdout is always implicitly opened in text mode, which on Windows means "any time you see \n, write out \r\n".  Up go the lights, out go the flags, on come the dancers, bang! goes the drum, and now when the file contains "\r\n" stdout flushes the "\r", sees the "\n", and writes out "\r\n", thus giving you (or me really) "\r\r\n" every time... and the show has begun.

I'll try to contribute a fix (using _setmode() on _fileno(stdout)), but lacking any sort of build environment it'll be rather like building a ship in a bottle.  Still, poking around at MinGW header files gives me some hope that this will work.

Cheers,


larry

reply via email to

[Prev in Thread] Current Thread [Next in Thread]