httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@znep.com>
Subject Re: CVS DIFF fix for review (-L added) (fwd)
Date Wed, 14 Jan 1998 07:13:31 GMT
(FYI, related to occasional rants around here about patch and cvs diff...)

---------- Forwarded message ----------
Date: Tue, 13 Jan 1998 03:31:32 +0300 (MSK)
From: "[KOI8-R] Андрей Чернов" <ache@nagual.pp.ru>
To: "Greg A. Woods" <woods@weird.com>
Cc: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de>,
    Peter Wemm <peter@netplex.com.au>,
    FreeBSD-current <current@freebsd.org>, info-cvs@gnu.org
Subject: Re: CVS DIFF fix for review (-L added)

On Mon, 12 Jan 1998, Greg A. Woods wrote:

> Oh, I beg to differ!  It was upon my request that "Index:" was
> originally added to the `cvs diff' output, specifically to support
> patch.  I think even the last release of patch by Larry Wall contained
> support for "Index:".  However versions of GNU Patch since 2.3.7 have
> only supported the "Index:" tag when requested by setting the
> environment variable POSIXLY_CORRECT (or completely omitting filenames
> in the context header) [see note rule 2].  This from 2.4's manual:

Even POSIX isn't means simple Index: precedence taken, it is treated
differently for existent and non-existent files, here is following comment
from GNU patch 2.5 (latest) source: 

    /* To intuit `inname', the name of the file to patch,
       use the algorithm specified by POSIX 1003.2b/D11 section 5.22.7.2
       (with some modifications if posixly_correct is zero):

       - Take the old and new names from the context header if present,
	 and take the index name from the `Index:' line if present and
	 if either the old and new names are both absent
	 or posixly_correct is nonzero.
	 Consider the file names to be in the order (old, new, index).
       - If some named files exist, use the first one if posixly_correct
	 is nonzero, the best one otherwise.
^^^^^^^^^^^^^^^^^^^^^^ old (first one) taken if posixly_correct !=0 ^^^^^^
       - If patch_get is nonzero, and no named files exist,
	 but an RCS or SCCS master file exists,
	 use the first named file with an RCS or SCCS master.
       - If no named files exist, no RCS or SCCS master was found,
	 some names are given, posixly_correct is zero,
	 and the patch appears to create a file, then use the best name
	 requiring the creation of the fewest directories.
       - Otherwise, report failure by setting `inname' to 0;
	 this causes our invoker to ask the user for a file name.  */

In any case CVS must not relay on such complex things just because any
mistake here (or different environment) easily cause the same file patched
many times or file from upper level patched instead of lower one; some of
such errors are hard to detect. 

The method which works in any case with any patch and in any environment
is adding -L option for diff to make consistent ***/--- (old,new) names.
Index: line is good only for ed-style diffs (with absent file names).

-- 
Andrey A. Chernov
<ache@nietzsche.net>
http://www.nagual.pp.ru/~ache/


Mime
View raw message