home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.os.linux      Getting to be as bloated as Windows!      107,822 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 106,416 of 107,822   
   marrgol to All   
   Re: patch command not work   
   31 Aug 24 13:37:45   
   
   From: marrgol@address.invalid   
      
   On 2024-08-31 at 10:05 alex wrote:   
   >> To fix this, in the file /tmp/tmp.YI0xO6M46g/patched/file.patch I replaced   
   >>   
   >> --- /tmp/tmp.YI0xO6M46g/patched/file    2024-08-29 10:03:43.376723286   
   +0200   
   >>   
   >> with   
   >>   
   >> --- /tmp/tmp.YI0xO6M46g/file    2024-08-29 10:03:43.376723286 +0200   
   >>   
   >> Let's try again...   
   >>   
   >> + pwd   
   >> /tmp/tmp.YI0xO6M46g   
   >> + patch --dry-run   
   >> checking file file   
   >> + patch -d / --dry-run -p1   
   >> checking file tmp/tmp.YI0xO6M46g/file   
   >> + patch -d / --dry-run -p0   
   >> checking file /tmp/tmp.YI0xO6M46g/file   
   >>   
   >> Perfect!!!   
      
   Lucky guess.   
      
   > Anyway, in the /tmp/tmp.YI0xO6M46g/patched/file.patch file, the second line   
   >   
   > +++ /tmp/tmp.YI0xO6M46g/patched/file 2024-08-28 12:15:27.908571446 +0200   
   >   
   > what is it for?   
   >   
   > For example, if I tamper with it like this   
   >   
   > +++ TAMPERED WITH   
   >   
   > the command   
   >   
   > $ (cd /tmp/tmp.YI0xO6M46g && patch --dry-run   
   > checking file file)   
   >   
   > works normally.   
   >   
   > Strange...   
      
   No it's not.  Have you read the doc?  Because you still don't comprehend   
   how 'patch' makes use of the filenames found in .patch files…   
      
   Here's something to add to your confusion:   
      
   $ pwd   
   /tmp/tmp.RWLuja73rs   
   $   
   $ tree   
   .   
   ├── bugged   
   │   └── file   
   └── patched   
       └── file   
   $   
   $ diff -u /tmp/tmp.RWLuja73rs/bugged/file /tmp/tmp.RWLuja73rs/patched/file |   
   tee patched/patch1   
   --- /tmp/tmp.RWLuja73rs/bugged/file	2024-08-28 17:37:44.985682038 +0200   
   +++ /tmp/tmp.RWLuja73rs/patched/file	2024-08-28 17:37:36.961734539 +0200   
   @@ -1 +1 @@   
   -BUGGED   
   +PATCHED   
   $   
   $ patch -d/ -p0 --dry-run < /tmp/tmp.RWLuja73rs/patched/patch1   
   checking file /tmp/tmp.RWLuja73rs/bugged/file   
   $   
   $ mv bugged/ not-patched/   
   $   
   $ diff -u /tmp/tmp.RWLuja73rs/not-patched/file   
   /tmp/tmp.RWLuja73rs/patched/file | tee patched/patch2   
   --- /tmp/tmp.RWLuja73rs/not-patched/file	2024-08-28 17:37:44.985682038 +0200   
   +++ /tmp/tmp.RWLuja73rs/patched/file	2024-08-28 17:37:36.961734539 +0200   
   @@ -1 +1 @@   
   -BUGGED   
   +PATCHED   
   $   
   $ patch -d/ -p0 --dry-run < /tmp/tmp.RWLuja73rs/patched/patch2   
   checking file /tmp/tmp.RWLuja73rs/patched/file   
   Reversed (or previously applied) patch detected!  Assume -R? [n]   
   Apply anyway? [n]   
   Skipping patch.   
   1 out of 1 hunk ignored   
   $   
      
   As you can see the only difference is the name of the directory in which   
   the bugged file resides, so why 'patch' behaves differently?   
   RTFM, the answer is there…   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca