[OpenAFS-devel] patch format?

Jeffrey Hutzelman jhutz@cmu.edu
Tue, 30 Jan 2007 13:40:17 -0500


On Tuesday, January 30, 2007 11:44:35 AM +0100 Roland Kuhn 
<rkuhn@e18.physik.tu-muenchen.de> wrote:

> Hi!
>
> Maybe I'm missing something way too obvious, but I can't apply the
> 1.4.3rc1 patch:
>
> rkuhn@othello:/afs/e18/sw/compile/kernel/linux-2.6.19.2-modules/ openafs$
> patch -u -p1 <../../PATCHES/openafs-1.4.3rc1-src.diff
> patch: **** Only garbage was found in the patch input.
> rkuhn@othello:/afs/e18/sw/compile/kernel/linux-2.6.19.2-modules/ openafs$
> patch -n -p1 <../../PATCHES/openafs-1.4.3rc1-src.diff
> patch: **** Only garbage was found in the patch input.
> rkuhn@othello:/afs/e18/sw/compile/kernel/linux-2.6.19.2-modules/ openafs$
> patch -c -p1 <../../PATCHES/openafs-1.4.3rc1-src.diff
> can't find file to patch at input line 5

If you don't give any of the -u, -n, or -c options, then patch will 
virtually always figure out what kind of patch you have.  I believe it's 
possible to construct a case where it gets it wrong, but such things 
generally do not occur in nature.

If you say -p1, then the current directory should be the top-level OpenAFS 
source directory; that is, the one where configure and the top-level 
Makefile live.  Otherwise patch will not be able to find the files to patch.

The incremental version patches distributed by the OpenAFS project apply to 
the entire tree.  If you are applying the patch to a directory tree which 
contains only a subset of the distributed source, such as that included in 
the openafs-modules-source or openafs-kernel-source packages, then you will 
need to modify the patch to elide the parts that modify files you don't 
have.

-- Jeffrey T. Hutzelman (N3NHS) <jhutz+@cmu.edu>
   Sr. Research Systems Programmer
   School of Computer Science - Research Computing Facility
   Carnegie Mellon University - Pittsburgh, PA