This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Info for the item "does patch.exe work different than other unx patch tools?" (i.e. "hunk 1 out of 3 hunks failed")


On Thu, Nov 8, 2012 at 5:30 AM, Thomas HÃhenleitner wrote:

>
> 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.
>

Possibly.  Maybe your new file has the CRLF and the old file has only LF.

> 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.
>

That depends.  If the patch executable has the file modes in _O_TEXT
then it will be capable of reading the mixed line endings fine.  If
the patch executable has the file modes in _O_BINARY then it will read
the patch file in binary mode receiving the CR as part of the patched
line.

> I do not regard this as a bug, but I guess I am not the only one
> spending a few hours with that issue.
>

It is not a bug, that is correct.

> 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.

If you use the --help argument to patch, you'll find one already that fits.

-- 
Earnie
-- https://sites.google.com/site/earnieboyd

--
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]