bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CVS Keyword expansion patch


From: Scott James Remnant
Subject: Re: CVS Keyword expansion patch
Date: 12 Mar 2003 15:52:08 +0000

On Wed, 2003-03-12 at 15:12, Mark D. Baushke wrote:

> I was not aware that the filename My::results.txt was generally illegal.
> It seems to work fine on my GNU/Linux and FreeBSD machines. Perhaps
> there are systems where this is not true? What operating system are you
> using?
> 
I think you misunderstand the intent of the patch, it only looks at the
colon immediately after the keyword.

Consider the following content for a file called "test"

----8<--------8<--------8<--------8<--------8<--------8<--------8<----
$Header$
$Header: random garbage$
$Header::fields{$foo}
---->8-------->8-------->8-------->8-------->8-------->8-------->8----

After CVS keyword expansion, the standard CVS code will replace all
three lines as follows (note the really bad thing that happens to the
last line):

----8<--------8<--------8<--------8<--------8<--------8<--------8<----
$Header: /cvsroot/example/test,v 1.1 2003/03/12 15:45:00 sjr Exp $
$Header: /cvsroot/example/test,v 1.1 2003/03/12 15:45:00 sjr Exp $
$Header: /cvsroot/example/test,v 1.1 2003/03/12 15:45:00 sjr Exp $foo}
---->8-------->8-------->8-------->8-------->8-------->8-------->8----

With the patch it would only replace the first two, because the third
was obviously Perl code (:: following the keyword name)

----8<--------8<--------8<--------8<--------8<--------8<--------8<----
$Header: /cvsroot/example/test,v 1.1 2003/03/12 15:45:00 sjr Exp $
$Header: /cvsroot/example/test,v 1.1 2003/03/12 15:45:00 sjr Exp $
$Header::fields{$foo}
---->8-------->8-------->8-------->8-------->8-------->8-------->8----

CVS always appends ": " after the keyword when creating the expansion
(rcs.c:3804-3805) therefore there's no (afaik) valid reason why
$Header:: /cvsroot....$ would validly indicate a keyword needing to be
expanded.

The :: in a filename doesn't immediately follow the keyword name, so
wouldn't get expanded (just to verify with the patch):

----8<--------8<--------8<--------8<--------8<--------8<--------8<----
$Header: /cvsroot/foo/::test,v 1.1 2003/03/12 15:48:45 sjr Exp $
$Header: /cvsroot/foo/::test,v 1.1 2003/03/12 15:48:45 sjr Exp $
$Header::fields{$foo}
---->8-------->8-------->8-------->8-------->8-------->8-------->8----

> Consider this case:
>   
>   mkdir -p /tmp/cvs-sanity/header
>   cd /tmp/cvs-sanity/header
>   cvs -d /tmp/cvs-sanity/cvsroot init
>   echo '$'Header'$' > My::results.txt
>   cvs -d /tmp/cvs-sanity/cvsroot -Q import -m newimport header vendor ver1
>   cvs -d /tmp/cvs-sanity/cvsroot -Q checkout header
>   cd header
>   cat My::results.txt
> 
construx-8 foo$ cat My\:\:results.txt 
$Header: /cvsroot/foo/My::results.txt,v 1.1 2003/03/12 15:50:24 sjr Exp $

>   echo more data >> My::results.txt
>   cvs -Q commit -m newtext
>   cat My::results.txt
> 
construx-8 foo$ cat My\:\:results.txt 
$Header: /cvsroot/foo/My::results.txt,v 1.2 2003/03/12 15:50:52 sjr Exp $
more data

> Would your patch allow the above expected results?
> 
Yup (see above).

Scott
-- 
sjr  software and systems engineer
     demon internet, thus plc




reply via email to

[Prev in Thread] Current Thread [Next in Thread]