Hi all,

I've been working with different patches and trying to move patches back and forth between different Unix and Windows machines for testing and it's a bit of a pain. Going either way, line-ending conversion is necessary.

When going from Unix to Windows, it requires changing the LFs to CRLFs by opening in wordpad (but not notepad) and saving to change the line endings or doing "perl -p -e 's/\r/\n\r/g' < in.patch | patch".

When going from Windows to Unix, you have to convert the line endings with "perl -p -e 's/\n/\r\n/g' < in.patch | patch -p0". This would seem to be adding another carriage return to the CRLF, but that's what works for me. And sometimes I can't get it to work at all, and it seems to depend on how forgiving that particular machine's patch command can be. (Unix here refers to Linux, Mac OS X, or Solaris, I get pretty much the same results on any platform)

Applying patches from mail is usually not a problem, but only because my native mail programs converts the line endings for me. However, some mail programs word wrap the patch and truncate the lines where patch does not expect them to be broken, thus causing patch to choke at the first place where word wrap occurs. This just may be user error on my part, or maybe the mail program isn't paying enough attention to the headers.

So, question is: is there a way to get around having to convert the line endings? Some magic option to patch to tell it to ignore the line endings in the patch and affected files? Or is this just the pain of working in a mixed Windows/Unix environment?

Thanks,
andrew



Reply via email to