[texworks] Patching on Windows

Stefan Löffler st.loeffler at gmail.com
Thu Jun 11 17:21:46 CEST 2009

Hi again,

I finally booted into my Windows partition again and tried out all the
things that recently caused problems. I'm happy to announce that I found
solutions ;).

On 2009-06-10 07:21, Stefan Löffler wrote:
> Hi,
> On 2009-06-09 11:06, Alain Delmotte wrote:
>> PS. ** I had to do the patch manually :-(  (for this one OK, but for
>> Lua it will take more time!)
>> When I try using the program patch I get:
>> patching file PDFDocument.cpp
>> Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354
> This seems to be a common problem. Googling reveals a few pages dealing
> with the issue.
> On http://www.nabble.com/Applying-patches-on-Windows-td16023740.html and
> http://www.edugeek.net/forums/windows/20938-patching-things-nix-style.html,
> it is suggested to use the dos2unix utility (which seems to be available
> e.g. from http://www.jostjahn.de/software/dos2uni.html or
> http://www.bastet.com/).
> From what I gather, you must first run
> dos2unix your-patch-file.diff
> and then as before
> patch -p0 < your-patch-file.diff

This is not entirely correct. The tool that is needed is not dos2unix,
it's its counterpart: unix2dos. So the correct procedure for applying a
patch is:
unix2dos your-patch-file.diff
patch -p0 < your-patch-file.diff

If it says that no files were patched, try running the same from the
src/ subdirectory. Maybe I (or someone else) accidentally created the
patch in there.

> I'm not sure why the line endings are a problem, and more specifically
> why they aren't the Unix ones (after all I wrote the patch on Linux),
> but who cares if it works ;).

Seems to be cleared up now. Apparently the patch tool for Windows
expects Windows (=Dos) line endings and is not able to cope with those
of Linux. Hence it can't even find the beginning of the first patch and
dies with an error. After using the unix2dos utility, everything went


More information about the texworks mailing list