Groups | Search | Server Info | Login | Register


Groups > alt.os.linux > #80340

Re: patch command not work

From "J.O. Aho" <user@example.net>
Newsgroups alt.os.linux
Subject Re: patch command not work
Date 2024-08-29 12:05 +0200
Message-ID <ljavekFbjs5U1@mid.individual.net> (permalink)
References <vamud2$3eld1$1@dont-email.me> <van5jp$3eoh2$1@dont-email.me> <vanc8o$3gn7k$1@dont-email.me> <vann41$3hajf$1@dont-email.me> <vapca7$3tepm$1@dont-email.me>

Show all headers | View raw


On 29/08/2024 10.42, alex wrote:
> Il 28/08/24 19:34, marrgol ha scritto:
>>>> (for / -p0 should work too)
>>> ????
>> Let me rephrase:
>> To use your file.patch as is change your working directory to / and run
>> 'patch' with -p1 (-p0 should work too).  Or change your working directory
>> to/tmp/  and run 'patch' with -p2.  Or change your working directory to
>> /tmp/tmp.YI0xO6M46g/  and run 'patch' with -p3.  Clear now?
>>
>>
> 
> 
> mmmhhhh...
> 
> $ pwd
> /tmp/tmp.YI0xO6M46g
> 
> $ patch --dry-run < patched/file.patch
> checking file file
> 
> and so far so good, but
> 
> $ (cd / && patch --dry-run -p1 < /tmp/tmp.YI0xO6M46g/patched/file.patch)
> checking file tmp/tmp.YI0xO6M46g/patched/file
> Reversed (or previously applied) patch detected!  Assume -R? [n]
> Apply anyway? [n]
> Skipping patch.
> 1 out of 1 hunk ignored
> 
> $ (cd / && patch --dry-run -p0 < /tmp/tmp.YI0xO6M46g/patched/file.patch)
> checking file /tmp/tmp.YI0xO6M46g/patched/file
> Reversed (or previously applied) patch detected!  Assume -R? [n]
> Apply anyway? [n]
> Skipping patch.
> 1 out of 1 hunk ignored
> 

You did run a  "diff /tmp/tmp.YI0xO6M46g/bugged/file 
/tmp/tmp.YI0xO6M46g/patched/file" (ignoring what ever options you provided)

The patch file (file.patch) will have the instruction of making the 
/tmp/tmp.YI0xO6M46g/patched/file based on your 
/tmp/tmp.YI0xO6M46g/bugged/file, so when you run the patch command it 
will notice that the changes already has been applied to 
/tmp/tmp.YI0xO6M46g/patched/file and asking if you want to remove the 
changes so that you get a /tmp/tmp.YI0xO6M46g/patched/file that is 
looking like  /tmp/tmp.YI0xO6M46g/bugged/file.

I guess you want to patch the /tmp/tmp.YI0xO6M46g/bugged/file then it's 
simplest to go into /tmp/tmp.YI0xO6M46g/bugged and use the -p option to 
make the patch command to ignore the directories.

Another alternative could be "cp -a /tmp/tmp.YI0xO6M46g/patched/file 
/tmp/tmp.YI0xO6M46g/bugged/file"

-- 
  //Aho

Back to alt.os.linux | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

patch command not work alex <1j9448a02@lnx159sneakemail.com.invalid> - 2024-08-28 12:33 +0200
  Re: patch command not work marrgol <marrgol@address.invalid> - 2024-08-28 14:36 +0200
    Re: patch command not work alex <1j9448a02@lnx159sneakemail.com.invalid> - 2024-08-28 16:29 +0200
      Re: patch command not work marrgol <marrgol@address.invalid> - 2024-08-28 19:34 +0200
        Re: patch command not work alex <1j9448a02@lnx159sneakemail.com.invalid> - 2024-08-29 10:42 +0200
          Re: patch command not work "J.O. Aho" <user@example.net> - 2024-08-29 12:05 +0200
            Re: patch command not work alex <1j9448a02@lnx159sneakemail.com.invalid> - 2024-08-29 15:37 +0200
              Re: patch command not work alex <1j9448a02@lnx159sneakemail.com.invalid> - 2024-08-31 10:05 +0200
                Re: patch command not work alex <1j9448a02@lnx159sneakemail.com.invalid> - 2024-08-31 10:24 +0200
                Re: patch command not work marrgol <marrgol@address.invalid> - 2024-08-31 13:37 +0200
                Re: patch command not work alex <1j9448a02@lnx159sneakemail.com.invalid> - 2024-08-31 15:09 +0200
                Re: patch command not work alex <1j9448a02@lnx159sneakemail.com.invalid> - 2024-09-02 09:24 +0200
                Re: patch command not work marrgol <marrgol@address.invalid> - 2024-09-02 18:41 +0200
                Re: patch command not work alex <1j9448a02@lnx159sneakemail.com.invalid> - 2024-09-03 11:22 +0200
                Re: patch command not work alex <1j9448a02@lnx159sneakemail.com.invalid> - 2024-09-06 09:08 +0200
          Re: patch command not work marrgol <marrgol@address.invalid> - 2024-08-29 12:08 +0200
            Re: patch command not work alex <1j9448a02@lnx159sneakemail.com.invalid> - 2024-08-29 15:48 +0200

csiph-web