Menu

patch/diff on files mixed line endings

Help
2005-05-10
2012-07-26
  • Nobody/Anonymous

    This isn't to my knowledge specifically related to the Win32 port of patch, but I'm wondering if anyone is aware of an existing port of patch and/or diff that properly handles newlines on text files of different origins. Or am I missing an option that allows one to specify that e.g., CRLF and LF should be treated as equal?

    I just preprocess the text files as a workaround at the present...

     
    • GnuWin

      GnuWin - 2005-05-10

      See http://gnuwin32.sourceforge.net/packages/patch.htm, under Installation and Usage.

      Patch has an option --binary, which makes it read patchfiles and input files in binary mode. This should solve your problem.

       
    • Nobody/Anonymous

      I just did a test on this, see http://ourcomments.org/GNU/patchcrlf/readme.txt

      Unfortunately I did not find any alternative that handled everything the way I would want. GnuWin32 patch seems to read the patch file (the file containing the output from diff) incorrect. The patch file must have CRLF line endings. However GnuWin32 diff can handle LF line endings too.

      It would be good if GnuWin32 patch was corrected. I tried to recompile it. The instructions for recompiling seems incorrect. I could not recompile with MSYS so I installed Cygwin. Not even with Cygwin was I able to recompile, but this time I got a bit further.

      BTW, Cygwin setup with the not recommended option to have text mode as default had the same problem. It seems to be a problem with the sources for GNU patch program.

       
MongoDB Logo MongoDB