delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/11/08/08:03:12

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <CAGCLmzztLn88uAcD5RzZAyYoPv8mLd0-Kx9gntmbdSObkG44Gg@mail.gmail.com>
References: <CAGCLmzztLn88uAcD5RzZAyYoPv8mLd0-Kx9gntmbdSObkG44Gg AT mail DOT gmail DOT com>
Date: Thu, 8 Nov 2012 08:02:50 -0500
Message-ID: <CA+sc5mkWc-CE3bgX8=QDJpOS-bHXPdYJNeUgMNJhhSDugFvufw@mail.gmail.com>
Subject: Re: Info for the item "does patch.exe work different than other unx patch tools?" (i.e. "hunk 1 out of 3 hunks failed")
From: Earnie Boyd <earnie AT users DOT sourceforge DOT net>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id qA8D380T005138

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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019