Patch and Cygwin

Eli Zaretskii
Fri Dec 16 19:09:00 GMT 2005

> Date: Fri, 16 Dec 2005 16:31:19 +0100
> From: Lennart Borgman <>
> CC:
> Eli Zaretskii wrote:
> >What's wrong with the patched file having CRLF on Windows?
> >  
> >
> It is the default line endings on Windows so normally that is what you 
> want. However if you have a file with LF line endings instead then don't 
> you probably have that for a reason?

Whatever my reasons are (see below), Patch supports that setup as
well: just make sure all the patch files are in Unix format, and use
the "--binary" switch to Patch.

> I am not for example convinced that all cvs implementations on Windows 
> can handle that a checked out file has got changed line end format.

The ports I've seen all strip CRs when they send files to the server,
and add CRs when they checkout files.  However, the desire not to
depend on that is one of the reasons I checkout with -kb.  That, and
the fact that the ported CVS adds an extra CR to each line of batch
files and other files stored in DOS EOL format, which causes all kinds
of strange failures during Emacs build (I'm sure you remember these
problems discussed on the Emacs development list).

> >But why should I care about these strange combinations on Windows?
> >Why isn't it enough that patching Unix-style files with Unix-style
> >patch files works (using --binary) and preserves the EOL type, and
> >patching DOS-style files with DOS-style patch files also works?
> >  
> >
> I do not know if you should care, but I do. It just happened to me that 
> things did not work because of one of these other non-working 
> combinations did occur for me.

There are two combinations that work: when all files have DOS EOLs,
and when they all have Unix EOLs (and you use --binary switch).  Stick
to these two simple combinations (use dos2unix or unix2dos if you have
other mixtures of file formats), and you should be safe.

> >Why the perfectionism?  If the usual cases work so well, why do we
> >want to insist on looking for trouble at all costs?
> >
> I hope it is not perfectionism. If you like me do many different things 
> with a computer you are likely to get into cases like those I have as 
> test cases. I can hardly touch a computer without finding something that 
> does not work on it ;-)

Do you need to do actual work on the computers you play with?  I do,
and I value my time, so I try to keep out of pitfalls that can take a
better part of the day to get out of.

> >Because I can find no other explanation for the fact that the test
> >that failed for you worked for me.  Maybe you should try installing
> >all the utilities again, make sure what Diff and what Patch runs in
> >each command, and see whether gnuwin32-test.cmd indeed fails for you.
> >  
> >
> Could we be misunderstanding each other? Which test case worked for you 
> but failed for me?

The file gnuwin32-results.txt indicates that the gnuwin32-test.cmd
test failed for you; it did not for me (I reported my results

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list