X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org MIME-Version: 1.0 Date: Thu, 8 Nov 2012 11:30:12 +0100 Message-ID: Subject: Info for the item "does patch.exe work different than other unx patch tools?" (i.e. "hunk 1 out of 3 hunks failed") From: =?ISO-8859-1?Q?Thomas_H=F6henleitner?= To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hello, using Cygwin patch.exe in a batch file I ran into the problem that patch failed for some reason ("hunk 1 out of 3 hunks failed"): Investigating this issue I found that inserting "unix2dos my.patch" before applying the patch was my friend! Being paranoid I tried "dos2unix my.patch" before applying the patch - and it was my friend too! Than I tried to run my batch script again without any unix2dos or dos2unix commands and I had my problem back. I have to say here, that my.patch is generated using diff inside my batch. So now I had a closer look to the diff generated my.patch file and I found out, that the file had somehow hybrid line endings: * the header with the file names was unix-like * the body with the diff info was dos-like The reason probably is, that my sources are with dos-like line endings. I assume, diff starts creating the my.patch with unix-like line-endings and than adds the diff info as it is. Than, when patch.exe gets the my.patch to execute it it sees unix-like line endings at the beginning of the my.patch, assumes all is that way and gets later trouble applying the patch info. I do not regard this as a bug, but I guess I am not the only one spending a few hours with that issue. I would like to propose an additional command line switch for the Cygwin diff.exe and/or patch.exe to tell about the line-endings. Thomas -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple