Guy Harris wrote:
Ulf Lamping wrote:
Given the file "new.diff" containing a unified diff, what is the
right way to call the patch tool?
That depends on what the pathnames in "new.diff" look like.
There are "usually" two pathnames in the patch, what does the patch tool
do, if they have different "lengths", e.g.:
diff -ur ../ethereal-0.10.6/epan/dissectors/packet-dcerpc.c
./epan/dissectors/packet-dcerpc.c
--- ../ethereal-0.10.6/epan/dissectors/packet-dcerpc.c 2004-08-12
15:42:26.000000000 -0700
+++ ./epan/dissectors/packet-dcerpc.c 2004-08-19 18:48:32.000000000 -0700
Will the patch tool use the shorter path (in this case the second one)?
I think I would have to call "patch -p0 <new.diff" in the ethereal
source root dir to patch my sources, am I correct here?
Is there a difference when the diff file contains one file "diff -u"
or more files "diff -ur"?
There isn't a difference in the arguments to "patch".
(However, there is a difference in the number of times you have to run
"patch" - and the number of times you have to save a patch file from
mail - so I, at least, prefer it when people send a single patch file
with patches for all the files to be changed.)
missunderstanding: I meant in both cases one diff file containing one
file with diffs in one case and multiple files with diffs in the other
case. From the answer you gave I would guess that there is no difference
on how to call the patch tool.
At which position in the filesystem has the patch tool to be called?
If the pathnames are relative to the top-level source directory, or to
a directory above that directory, you'd run it in the top-level source
directory.
If they're relative to a *subdirectory* - for example, if somebody did
a patch to "packet-ip.c" and ran "diff" or "svn diff" in the
"epan/dissectors" directory - you'd run it in that subdirectory. (I
would really prefer that people *NOT* submit patches like that -
especially if they're only patching files that exist in multiple
directories, such as "Makefile.am".)
Well, I think, the main reason why people do it that way is just that we
don't have any good documentation how to make a "correct" diff file, but
I'm currently working exactly on this :-)
I've took parts of your mail formatted it into docbook and put it into
the developer's guide, I hope your fine with it (like the lot of
information before, coming from you :-)))
Regards, ULFL