X-Spam-Check-By: sourceware.org Date: Fri, 16 Dec 2005 10:37:27 +0200 Message-Id: From: Eli Zaretskii To: Lennart Borgman CC: dave DOT korn AT artimi DOT com, cygwin AT cygwin DOT com In-reply-to: <43A20542.1050405@student.lu.se> (message from Lennart Borgman on Fri, 16 Dec 2005 01:07:30 +0100) Subject: Re: Patch and Cygwin Reply-to: Eli Zaretskii References: <43A1ACC1 DOT 9090805 AT student DOT lu DOT se> <43A1B2A1 DOT 2020907 AT student DOT lu DOT se> <43A20542 DOT 1050405 AT student DOT lu DOT se> Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com > Date: Fri, 16 Dec 2005 01:07:30 +0100 > From: Lennart Borgman > CC: cygwin AT cygwin DOT com, Emacs Devel , > Eli Zaretskii I urge people who participate in this thread to please keep emacs-devel off the list of the addressees, as this issue is off-topic there. > This is a summary of my tests with Cygwin patch and different line > ending styles. (Only LF and CRLF are tested here.) > > I have downloaded patch 2.5.9 from > ftp://alpha.gnu.org/gnu/diffutils/patch-2.5.9.tar.gz and compiled it > using Cygwin. I have used this patch and the patch that currently comes > with Cygwin to do some tests of patch and diff when the files to compare > and patch have different line ending styles. I have also made this test > using MSYS and GnuWin32 utilities. > > 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? 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: D:\gnu\patches>gnuwin32-test.cmd D:\gnu\patches\tempGNUWIN32 D:/usr/bin/diff.EXE D:/usr/bin/patch.EXE (Stripping trailing CRs from patch.) <<<<<<<<<<<<<<========= 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 <<<<<<======== no ^M characters with different line endings. the name of this file is file-cr-lf.txt and it has cr-lf line ending. No this is diffed against the other file using GnuWin32 diff. **** 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> 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. You need to use a coherent set of ported utilities that behave similarly wrt the line-endings issue, otherwise you _will_ get weird and unexpected failures. (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!) -- 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/