[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Bulit-in patch is needed when --patch-cmd option of 'svn patch' is omitted

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Mon, 22 Sep 2008 07:51:34 +0300 (Jerusalem Daylight Time)

masaru tsuchiyama wrote on Mon, 22 Sep 2008 at 08:55 +0900:
> Hi.
>
> Thanks for the reply.
>
> I get GNU patch from http://gnuwin32.sourceforge.net/packages/patch.htm
> and run "svn patch --patch-cmd=patch.exe out.txt".
>
> But I get the following error.
> patching file build.conf
> patching file www/hacking.html
> Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354
>
> This application has requested the Runtime to terminate it in an unusual way.
> Please contact the application's support team for more information.
> svn: 'patch.exe' returned error exitcode 3
>
> I open the patch file with a text editor and find that the file has
> CRs and CR-LFs.
> Then I convert the line endings to CR-LF and re-try 'svn patch'. I can
> successfully
> apply the patch.
>
> It seems GNU patch can't handle mixed line endings and 'svn diff --svnpatch'
> produces a mixed-line-ending result on Windows.
>

In my experience, it is LF line endings that GNU patch can't handle.
(i.e., if you take a patch file with only LF line endings, you'll still
get that assertion.) And, yes, the output of 'svn diff' has mixed EOLs on
Windows.

So on Windows I just convert patches to CRLF before I apply them. But
this sometimes has the effect of corrupting a file that uses other line
endings too. (I don't remember what happens if the file being patched
has non-CRLF lines -- whether it asserts or works or silently converts
those lines to CRLF.) But mixed-EOLs file is the rare case, 90% of the
time the CRLF'd patch just works.

Daniel

> Regards.
> Masaru.
>
> 2008/9/22 Arfrever Frehtes Taifersar Arahesis <arfrever.fta_at_gmail.com>:
> > 2008-09-21 04:11:27 masaru tsuchiyama napisaƂ(a):
> >> Hi.
> >>
> >> I tried svnpatch-diff branch on Windows XP.
> >>
> >> I got the followging error when patching.
> >> ---------------------------------------------------------------------
> >> D:\...>svn patch out.txt
> >> patching file build.conf
> >> patching file www/hacking.html
> >> Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354
> >>
> >> This application has requested the Runtime to terminate it in an unusual way.
> >> Please contact the application's support team for more information.
> >> svn: No 'patch' program was found in your system. Please try
> >> to use --patch-cmd or 'patch-cmd' run-time configuration
> >> option or manually use an external tool to apply Unidiffs.
> >> svn: External program is missing
> >> ---------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-09-22 06:51:59 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.