Re: Why from there?

Vladimir Volovich (
14 May 1998 23:39:01 +0400


here are my $0.02 wrt to this topic. :-)

IMHO the current situation with patches is not 100% satisfactory,
because of two things:

1) the timestamps of files are not in UTC [patch is able to set
timestamps according to the values in diff file, but because the
timestamps are not in UTC, the timestamps become useless].

2) the number of directories in `old' tree and `new' tree is
different: the `old' tree begins with `v?.?.?/linux/', but the `new'
begins with `linux' and lacks the `v?.?.?/'. This causes problems when
patching. In particular, try to do the following (assuming you have
patch-2.5.1 or above; I haven't tested this with earlier versions of

tar xfz /tmp/linux-2.1.72.tar.gz
mv linux linux-2.1.72
cd linux-2.1.72
zcat /tmp/patch-2.1.73.gz | patch -p1

ONLY because linux patches have different numbers of directories in
`old' and `new' tree, you will get the following:

patching file `include/asm-mips/vector.h'
patching file `include/asm-mips/watch.h'
patching file `include/linux/blkdev.h'
The next patch would create the file `linux/include/linux/dmascc.h',
which already exists! Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to linux/include/linux/dmascc.h.rej
patching file `include/linux/fs.h'
patching file `include/linux/hdreg.h'
patching file `include/linux/ip_fw.h'

I.e., the patch to linux/include/linux/dmascc.h produces a reject,
which goes to /usr/src/linux-2.1.72/linux/include/linux/dmascc.h.rej

If one compares the patched tree with `clean' 2.1.73, then the
difference will exist exactly in two places:

1) in the tree patched with "-p1", the file
exists, while in clean 2.1.73 tree it does not exist;
2) in the tree patched with "-p1", the file
does not exist, while in the clean 2.1.73 tree it does exist.

Note, that if one will try to patch using "-p0" (from /usr/src), then
there will be NO rejects. This is NOT a bug of `patch', and this is
NOT an incorrectness of the contents of `patch-2.1.73' (although, the
source tree 2.1.72 contained a file dmascc.h in a wrong place which
was corrected by patch-2.1.73). This is a problem of patch generation
procedure (different number of directory depth in `old' and `new'

To avoid such unpredictable behavior when applying patches, it would
be reasonable to make patches using e.g. "diff -ruN v2.1.72 v2.1.73"
but not "diff -ruN v2.1.72 linux".

Best regards, -- Vladimir.

Go away, I'm all right.
		-- H.G. Wells' last words.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to