[Top][All Lists]

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

Re: [bug-patch] Clarification on patch tool

From: Arockia Adaikalaraj
Subject: Re: [bug-patch] Clarification on patch tool
Date: Mon, 15 Feb 2010 15:21:32 +0530

Hi Marty,

Thanks for the information shared. I guess I have missed to tell one information like I am having only one patch file which has 4 hunks of code to be applied. So when i use -f option it is totally skipping the patch by displaying "No file to patch". Let me know if you need any info on this.


On Mon, Feb 15, 2010 at 12:31 PM, Martin Panter <address@hidden> wrote:
On 11/02/2010, Arockia Adaikalaraj <address@hidden> wrote:
> Hi,
> I am new to patch tool. I have some issue in patch tool. Please let me know
> whether this is a bug or I am doing the wrong steps.
> Let me explain the steps what I do.
> 1. I have a diff file (full_diff.txt) with 5 hunks of code to be patched to
> a file sample.txt
>  2. I have copied the first hunk of code to another file named
> first_hunk_diff.txt
> 3. I have copied the second hunk of code to one more file named
> second_hunk_diff.txt
> 4. I ran patch -N  -b -s < first_hunk_diff.txt
>  The patch applied.
> 5. Now I am trying to apply the full_diff.txt file to sample.txt file using
> patch command.
> patch -N -b -s < full_diff.txt
> It is failing with the below message.
> Reversed (or previously applied) patch detected!  Skipping patch.
>  5 out of 5 hunks ignored -- saving rejects to file sample.txt.rej
> 6. I have reversed the changes applied to sample.txt to be clean.
> 7. Now I ran patch -N -b -s < second_hunk_diff.txt
> The patch applied.
>  8. Now I am again applying the full_diff.txt to sample.txt using patch
> command.
> patch -N -b -s < full_diff.txt
> It has failed with the below error.
> File to patch: sample.txt
> 1 out of 5 hunks FAILED -- saving rejects to file sample.rej
> So What I guess is that when the first hunk of code is applied already it is
> totally skipping the patch. But when the second hunk of code is applied
> already it is not skipping the entire diff changes to be applied. I guess
> there is some issue with the patch tool.

I think Patch uses the first hunk only to decide if the entire patch
is already applied or not. I've never used the -N option but
apparently it's for skipping over "already-applied" patches

Normally Patch asks some questions if you don't use -N and it thinks
the patch is already applied. If you want it to apply the rest of the
patch I'd suggest trying the --force (-f) option.

> Please let me know if this is kind of a bug. Let me know if my explanation
> makes you clear.

I suspect that's how Posix says it's supposed to be so it's probably
not technically a bug, just an annoyance. But I'm no Posix expert.


reply via email to

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