Weblog entry #456 for simonw
#456
Cygwin "patch" feature
Posted by simonw on Mon 14 May 2012 at 15:33
Trying to merge trivial set of changes using Cygwin got nonsensical difference as if the white space was changed.
Poked around and came to the conclusion "patch" was broken on Cygwin, and a quick Google gave:
http://cygwin.com/ml/cygwin/2010-03/msg00559.html
So two files with the same DOS line ending convention, diff fine. Applying that diff to a third file with the same line endings always fails with "Hunk failed" for each hunk. Forcing it is seems to change the line ending convention of similar.
I know my brain wouldn't handle trying to patch patch for this edge case, but annoying.
Poked around and came to the conclusion "patch" was broken on Cygwin, and a quick Google gave:
http://cygwin.com/ml/cygwin/2010-03/msg00559.html
So two files with the same DOS line ending convention, diff fine. Applying that diff to a third file with the same line endings always fails with "Hunk failed" for each hunk. Forcing it is seems to change the line ending convention of similar.
I know my brain wouldn't handle trying to patch patch for this edge case, but annoying.
[ Send Message | View Weblogs ]
diff, which generates hybrid patch files (mixing LF-terminated and CRLF-terminated lines), and then withpatch, which fails to handle them. Purely DOS-style patch files (with only CRLF-terminated lines) seem to work flawlessly.The easiest solution is to sanitize the patch file through
dos2unix(or evenunix2dosif you wish) before feeding it topatch:[ Parent | Reply to this comment ]