bug-patch
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-patch] two different hunks erroneously get applied to the very


From: Benno Schulenberg
Subject: Re: [bug-patch] two different hunks erroneously get applied to the very same spot
Date: Wed, 6 Sep 2017 21:27:47 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1


Op  6-09-2017 om 18:45 schreef Andreas Grünbacher:
I've pushed a fix to the repository on Savannah. Patch will now handle
this case more reasonably:

$ patch testor.c < goes-wrong.patch
patching file testor.c
Hunk #1 succeeded at 44 (offset 37 lines).
Hunk #2 FAILED at 48.
1 out of 2 hunks FAILED -- saving rejects to file testor.c.out.rej

Confirmed.

It would have been nice, though, to have added a "Reported by" in the
commit message.

The test suite still passes, and I can't think of any legitimate
patches that this fix would now cause to fail.

The only case I can think of is that: since the patch was made, all
the lines between the last plusline of the first hunk and the first
plusline of the second hunk have been deleted from the target file.
Which would mean that the correct thing to do would be to apply the
second hunk with fuzz 2 after the first hunk has been applied.

Current git fails to apply the second hunk in that case, whereas
patch-2.7.5 does the right thing but does *not* speak of any fuzz:

Hunk #2 succeeded at 11 (offset -37 lines).


By the way, would it be possible to tell 'patch' to limit the area in
which it will search for a context match?  So that the user could do
something like --within=20, which would make 'patch' accept an offset
of at most twenty lines?

Benno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]