[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CVS Keyword expansion patch
From: |
Mark D. Baushke |
Subject: |
Re: CVS Keyword expansion patch |
Date: |
Wed, 12 Mar 2003 07:12:30 -0800 |
Hi Scott,
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?
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
echo more data >> My::results.txt
cvs -Q commit -m newtext
cat My::results.txt
which produces the results:
$Header: /tmp/cvs-sanity/cvsroot/header/My::results.txt,v 1.1.1.1 2003/03/12
15:03:09 mdb Exp $
Checking in My::results.txt;
/tmp/cvs-sanity/cvsroot/header/My::results.txt,v <-- My::results.txt
new revision: 1.2; previous revision: 1.1
done
$Header: /tmp/cvs-sanity/cvsroot/header/My::results.txt,v 1.2 2003/03/12
15:06:16 mdb Exp $
more data
Would your patch allow the above expected results?
If not, then that would seem to be a problem that the rcs keyword
expansion does not always work as expected based on the name of the
file...
Thanks,
-- Mark
Scott James Remnant <sjr@demon.net> writes:
> A simple patch for you to consider,
>
> It's possible to trip over Keyword expansion when using Perl because
> code like " $Header::fields{$value} " ends up being quite a common
> occurrence.
>
> CVS would see the "$Header:.....$" in the above and you end up with
> bogus code. Simply setting -kb isn't the right thing, because you
> generally DO want keyword expansion in the comments at the top, amongst
> other places.
>
> I therefore submit this patch, basically it prevents keyword expansion
> if the keyword ends in "::"
>
> ----8<--------8<--------8<--------8<--------8<--------8<--------8<----
> diff -urN cvs-1.11.5.orig/src/rcs.c cvs-1.11.5/src/rcs.c
> --- cvs-1.11.5.orig/src/rcs.c Thu Jan 16 15:10:55 2003
> +++ cvs-1.11.5/src/rcs.c Wed Mar 12 11:39:08 2003
> @@ -3689,6 +3689,11 @@
> keyword after all. */
> if (*s == ':')
> {
> + /* If the keyword ends with '::', then this wasn't a keyword
> + after all, but a Perl variable! */
> + if (*(s + 1) == ':')
> + continue;
> +
> for (; s < send; s++)
> if (*s == '$' || *s == '\n')
> break;
> ---->8-------->8-------->8-------->8-------->8-------->8-------->8----
>
> Scott
> --
> sjr software and systems engineer
> demon internet, thus plc
>
>
> _______________________________________________
> Bug-cvs mailing list
> Bug-cvs@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-cvs
>