Mail Archives: cygwin/2005/12/16/04:05:30
Eli Zaretskii wrote:
>>The result is that the only option that seems to be able to handle the
>>mix of line endings is Cygwin using DOS line endings with patch 2.5.9.
>>(The only thing that did not work was preservation of line endings in
>>the patched file, but that seems to be a small problem here.)
>>
>>To see more of the result see here:
>>http://ourcomments.org/GNU/patchcrlf/readme.txt
>>
>>
>
>I don't use Cygwin, but I tried your tests with the GnuWin32 ports of
>Diff and Patch (and `cat' from GnuWin32 port of Coreutils), and the
>tests worked for me as I expected. Here are the results:
>
> D:\gnu\patches>gnuwin32-test.cmd
> D:\gnu\patches\tempGNUWIN32
>
> D:/usr/bin/diff.EXE
> D:/usr/bin/patch.EXE
>
> patching file file-lf.txt
> patching file file-cr-lf.txt
>
> **** PATCHED file-cr-lf.txt: ********
> This is a test comparing two files^M
> with different line endings.^M
> the name of this file is file-lf.txt^M
> and it has lf line ending.^M
> No this is diffed against the other file^M
> using GnuWin32 diff.^M
>
> **** PATCHED file-lf.txt: ***********
> This is a test comparing two files^M
> with different line endings.^M
> the name of this file is file-cr-lf.txt^M
> and it has cr-lf line ending.^M
> No this is diffed against the other file^M
> using GnuWin32 diff.^M
>
> **** THE PATCH: ***********
> 3,4c3,4^M
> < the name of this file is file-lf.txt^M
> < and it has lf line ending.^M
> ---^M
> > the name of this file is file-cr-lf.txt^M
> > and it has cr-lf line ending.^M
>
> D:\gnu\patches>
>
>I think this is the result you expected. Is that true?
>
>
I think so. The file file-lf.txt has CRLF line endings after patching,
otherwise everything is fine. But this is just one of the tests for
GnuWin32. Please run all-cmd-tests.cmd and then checkresults.sh (in
whatever sh you have).
>If you wanted the patched file-lf.txt to retain its Unix-style EOL
>format, then gnuwun32-test.cmd should be modified to say
>
> patch --binary file-lf.txt temp.diff
>
>instead of
>
> patch file-lf.txt temp.diff
>
>and then Patch will remove the CR characters from the patch file
>temp.diff and produce a LF-only EOLs:
>
>
Thanks for the suggestion, but maybe you are misunderstanding me. I want
this to work for all the test cases, not just for one of them.
>The files on your site indicate that the GnuWin32 test failed, but I
>think this is because you used a port of Diff that is not the GnuWin32
>port.
>
>
Why do you think that? I have written in the readme.txt file what
version of diff I believe am using. I have tried to be rather careful here.
If you run all-cmd-tests.cmd and then checkresults.sh do you get
different results from those I got?
>(Btw, when I downloaded file-cr-lf.txt from your site by
>right-clicking on it and selecting "Save target as...", it wound up on
>my machine with Unix-style LF-only EOLs. So I'm afraid some people
>that will try your tests might get incorrect results if they are not
>careful enough to convert file-cr-lf.txt to DOS EOL format first.
>Caveat emptor!)
>
>
Oh thanks! I forgot to upload this file as binary.
In the sh-tests I have added tests for line ending style for
file-cr-lf.txt and file-lf.txt. I will find out a way to do that for the
GnuWin32 tests too.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -