Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jan 1998 18:56:20 -0500 (EST)
From:      woods@most.weird.com (Greg A. Woods)
To:        Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de>
Cc:        =?iso-8859-1?Q?=E1=CE=C4=D2=C5=CA_=FE=C5=D2=CE=CF=D7?= <ache@nagual.pp.ru>, Peter Wemm <peter@netplex.com.au>, FreeBSD-current <current@freebsd.org>, info-cvs@gnu.org
Subject:   Re: CVS DIFF fix for review (-L added)
Message-ID:  <m0xrtiO-00077aC@most.weird.com>
In-Reply-To: J. Wunsch's message of "Mon, January 12, 1998 08:20:22 %2B0100" regarding "Re: CVS DIFF fix for review (-L added)" id <19980112082022.30571@uriah.heep.sax.de>
References:  <199801111457.WAA06475@spinner.netplex.com.au> <Pine.BSF.3.96.980111232840.17312A-100000@lsd.relcom.eu.net> <19980112082022.30571@uriah.heep.sax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
[ On Mon, January 12, 1998 at 08:20:22 (+0100), J. Wunsch wrote: ]
> Subject: Re: CVS DIFF fix for review (-L added)
>
> The idea of Index: was great, but there has never been a patch utility
> supporting it the way CVS did expect. :-O  Again, all the pre-existant
> ``support'' for Index: lines taking precedence over context-diff
> headers was _incidentally_.

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:

     If no original file origfile is  specified  on  the  command
     line,  patch  tries  to  figure out from the leading garbage
     what the name of the file to edit is,  using  the  following
     rules.

      + If the header is that of a context diff, patch takes  the
        old  and  new  file  names  in the header.  Any /dev/null
        names are ignored.

      + If there is an Index: line in the leading garbage and  if
        either  the  old  and  new  names  are both absent or the
        POSIXLY_CORRECT environment variable is set, patch  takes
        the name in the Index: line.

      + For the purpose of the following  rules,  the  names  are
        considered  to be in the order (old, new, index), regard-
        less of the order that they appear in the header.

      + If some of the named files exist, patch  uses  the  first
        name  if the POSIXLY_CORRECT environment variable is set,
        and the best name otherwise.

      + If patch is not ignoring RCS and SCCS (see the -g num  or
        --get=num option), and no named files exist but an RCS or
        SCCS master is found, patch uses  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 not set, and the
        patch appears to create a file, patch uses the best  name
        requiring the creation of the fewest directories.

Unfortunately POSIX has made life difficult yet again (rule three seems
to make the "Index:" header have the least precedence even when it would
be more logical to have it the most precedence)....  At least now it's
all documented and "standard".

-- 
							Greg A. Woods

+1 416 443-1734      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m0xrtiO-00077aC>