diff...patch...help...

stirling

Member
Oct 29, 2001
127
0
0
I'm trying to apply a diff patch that was made with 'diff -P -r olddir newdir'
but I can't seem to find the right combination of patch switches to get it to take.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Whats this a patch for? Are there any instructions with the patch (in OpenBSD there are application instructions at the beginning of each patch).
 

stirling

Member
Oct 29, 2001
127
0
0
Instructions?

It's a patch to the sane-backend source (scanners - mostang.org).
Someone has finally written a driver for for my old pos scanner.

The patch is just the raw output from a diff.
Normally, you just apply a patch with something like 'patch -Np1 -i file.patch' but they're usually made with different diff options.
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
Your not giving much to go on, what do you get if you just do

patch -p0 <patchfile

in the parent directory of the directory you're trying to patch?

Take a look at the patchfile itself and see what the filename paths look like. You might have to fool around with the patch -p argument a bit.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0


<< Holy post-count n0cman ... you need a life :) >>



Yeah, women arent too impressed when I tell them my AT postcount at the bar...
 

stirling

Member
Oct 29, 2001
127
0
0
I think he's got an automated reply system that refreshes the site, parses the pages, pulls sarcastic answers from a DB and posts on his behalf.

Anyway...

I haven't tried sucking the patch file in with <
I have tried:
patch -Np0 -i file
...
patch -Np5 -i file

cd dir && patch -Np0 -i ../file
...
cd dir && patch -Np5 -i ../file

without the --N, without the -i, with all the above and none of the above but with -c
and with various directory namings, mostly with the first one in the diff output:

[edit:] sometimes patch hangs doing nothing (w/o -i), sometimes it complains about not find the location/file to patch (most other times)

diff -P -r sane-backends-1.0.7.org/AUTHORS sane-teco-1.07/AUTHORS
55a56
> teco: Frank Zago (*)
diff -P -r sane-backends-1.0.7.org/backend/Makefile.in sane-teco-1.07/backend/Makefile.in
64c64
< st400 tamarack umax umax_pp umax1220u @V4L@
---
> st400 tamarack teco umax umax_pp umax1220u @V4L@
116c116,117
< tamarack.conf tamarack.desc tamarack.h template.desc. umax-scanner.c \
---
> tamarack.conf tamarack.desc tamarack.h teco.desc teco.c teco.h \
> teco.conf umax-scanner.c \
328a330,332
> libsane-teco.la: ../sanei/sanei_config2.lo
> libsane-teco.la: ../sanei/sanei_constrain_value.lo
> libsane-teco.la: ../sanei/sanei_scsi.lo
diff -P -r sane-backends-1.0.7.org/backend/dll.conf sane-teco-1.07/backend/dll.conf
37a38
> teco
diff -P -r sane-backends-1.0.7.org/backend/teco.c sane-teco-1.07/backend/teco.c
0a1,1787
> /* sane - Scanner Access Now Easy.

...

 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
-P When comparing directories, if a file appears only
in the second directory of the two, treat it as
present but empty in the other.
-r When comparing directories, recursively compare any
subdirectories found.


Thats what the flags mean. Every patch Ive applied before followed the same pattern:

patch -p0 < file.patch

So cd into the working directory and try "patch -p0 < ../file.patch". If that doesnt work, try -p1.