On Oct 6, 2010, at 05:10:29 PDT, Richard Hipp wrote: > 2010/10/6 Lluís Batlle i Rossell <[email protected]> > On Wed, Oct 06, 2010 at 12:39:15PM +0200, Emil Totev wrote: > > Hello > > This is fossil version [b48f78964e] 2010-09-18 15:51:43 UTC > > on Windows XP SP3 > > > > When I create a patch file using > > fossil diff > patch.txt > > > > the resulting file cannot be used for patching. It seems there is an > > extra 0D line separator (0d 0d 0a) for the actual source lines. > (---, > > +++, @@ lines are OK). > > > > The source files have normal Windows line endings, 0d 0a. > I saw the same annoyance in fossil built for cygwin. > I use "fossil diff | tr -d '\r'" to overcome that. > You may also want to set a gdiff-tool, and use 'fossil gdiff', if > you have > GNU diffutils available for example. I use that to get diffs in > unified format. > > Fossil is not taking any steps to insert extra CR characters in the > output. The output of "fossil diff" is generated using printf(). > Do you suppose that the windows implementation of printf() is trying > to be "helpful" by converting NL to CRNL?
Yup. One of the "benefits" of using that OS. The patch file must have been written in text mode. Here are some references: <http://msdn.microsoft.com/en-us/library/yeby3zcb(v=VS.80).aspx> In addition to the above values, the following characters can be included in mode to specify the translation mode for newline characters: t Open in text (translated) mode. In this mode, CTRL+Z is interpreted as an end-of-file character on input. In files opened for reading/writing with "a+", fopen checks for a CTRL+Z at the end of the file and removes it, if possible. This is done because using fseek and ftell to move within a file that ends with a CTRL+Z, may cause fseek to behave improperly near the end of the file. Also, in text mode, carriage return–linefeed combinations are translated into single linefeeds on input, and linefeed characters are translated to carriage return–linefeed combinations on output. <http://msdn.microsoft.com/en-us/library/ktss1a9b(v=VS.80).aspx> The stdin, stdout, and stderr streams always open in text mode by default; you can also override this default when opening any of these files. Use _setmode to change the translation mode using the file descriptor after the file is open. --Kyle _______________________________________________ fossil-users mailing list [email protected] http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

