This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch and Cygwin

> Date: Fri, 16 Dec 2005 10:05:14 +0100
> From: Lennart Borgman <>
> CC:,
> I think so. The file file-lf.txt has CRLF line endings after patching, 
> otherwise everything is fine.

What's wrong with the patched file having CRLF on Windows?

> But this is just one of the tests for GnuWin32. Please run
> all-cmd-tests.cmd and then (in whatever sh you
> have).

The other test fails with Unix-style patch file temp.diff, unless you
use --binary switch to Patch, and with --binary it works only for
file-lf.txt.  Sounds like a bug in fseek in the Windows runtime used
by MinGW.

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?

> >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.

Why the perfectionism?  If the usual cases work so well, why do we
want to insist on looking for trouble at all costs?

> >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?

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.

> If you run all-cmd-tests.cmd and then do you get 
> different results from those I got?

all-cmd-tests.cmd just runs gnuwin32-test.cmd and
gnuwin32-lf-patchfile.cmd; I ran those two by hand, and I already
described what they did.  I didn't run the shell scripts because
there's no GnuWin32 port of Bash, and because I didn't want to mix the
Diff/Patch issue with the shell behavior.

> 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.

That will not be easy using the techniques you tried in sh-tests, I
suspect.  Perhaps "od -c" is a good start.

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]