[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-patch] patch cannot handle >3 lines of context
From: |
Jörn Engel |
Subject: |
Re: [bug-patch] patch cannot handle >3 lines of context |
Date: |
Sat, 18 Jul 2015 12:04:49 -0700 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hello Andreas!
On Sat, Jul 18, 2015 at 09:19:27AM +0200, Andreas Grünbacher wrote:
> 2015-07-17 19:49 GMT+02:00 Jörn Engel <address@hidden>:
> > Noticed the problem trying to apply the hunk below. It applies just
> > fine with git, but fails to apply with GNU patch. Cutting the 7-line
> > context above the patch down to 3-line context fixes the issue. Cutting
> > it down to 5-line context makes it apply with fuzz 2.
>
> The reason is that there are more lines of prefix context than suffix context,
> which makes patch assume that the hunk must apply at the end of the
> file. (Without this heuristic, hunks from the beginning or end of a file
> misapply very easily.)
>
> Once two lines of a hunk with five prefix context lines and three suffix
> context lines are stripped (fuzz 2), the number of context lines balances
> out again, and the hunk will apply anywhere in the file.
Not sure how to interpret your answer. Given that git or a human can
apply the patch just find, I would consider it a legal patch. As such,
I would be unhappy about an answer that implied "there is no bug". An
answer of "this is hard, send a patch if you care" would be fine. I had
a brief look at the code and decided to work on something else instead.
I mainly sent this bug report for documentation. We only get into this
situation when humans hand-edit patches. In my case I removed a "-"
line between 3-line context and 4-line context. That is exceedingly
rare, even for crazy people that manually edit patches.
Jörn
--
Unless something dramatically changes, by 2015 we'll be largely
wondering what all the fuss surrounding Linux was really about.
-- Rob Enderle