bug-cvs
[Top][All Lists]
Advanced

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

Re: Tags with slash character


From: Jim Hyslop
Subject: Re: Tags with slash character
Date: Wed, 03 Aug 2005 22:35:17 -0400
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Alan Harder wrote:
I was going by the message I received when I first tried to create a tag
with a "." in it...

% cvs tag tag.test file
cvs [tag aborted]: tag `tag.test' must not contain the characters `$,.:;@'

I've written a small patch to change the test, and resulting error message. The sanity.sh changes aren't quite working right under Cygwin - it's complaining about the output not matching (it seems to be a line-ending issue). Could someone with a *NIX box please test the patch to make sure it does what it's supposed to:


Index: rcs.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/rcs.c,v
retrieving revision 1.348
diff -u -r1.348 rcs.c
--- rcs.c       27 May 2005 18:07:48 -0000      1.348
+++ rcs.c       4 Aug 2005 02:27:28 -0000
@@ -3347,7 +3347,6 @@
 void
 RCS_check_tag (const char *tag)
 {
-    char *invalid = "$,.:;@";                /* invalid RCS tag characters */
     const char *cp;

     /*
@@ -3359,12 +3358,9 @@
     {
        for (cp = tag; *cp; cp++)
        {
-           if (!isgraph ((unsigned char) *cp))
-               error (1, 0, "tag `%s' has non-visible graphic characters",
-                      tag);
-           if (strchr (invalid, *cp))
-               error (1, 0, "tag `%s' must not contain the characters `%s'",
-                      tag, invalid);
+           if (!isalnum ((unsigned char) *cp) && *cp != '_' && *cp != '-' )
+               error (1, 0, "tag `%s' may contain only letters, numbers, _ and 
-",
+                      tag );
        }
     }
     else
Index: sanity.sh
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/sanity.sh,v
retrieving revision 1.1070
diff -u -r1.1070 sanity.sh
--- sanity.sh   4 Aug 2005 01:04:32 -0000       1.1070
+++ sanity.sh   4 Aug 2005 02:27:51 -0000
@@ -1606,7 +1606,7 @@
        tests="${tests} rdiff2 diff diffnl death death2"
        tests="${tests} rm-update-message rmadd rmadd2 rmadd3 resurrection"
        tests="${tests} dirs dirs2 branches branches2 branches3"
-       tests="${tests} branches4 tagc tagf tag-space"
+       tests="${tests} branches4 tagc tagf tag-space tag-valid"
        tests="${tests} rcslib multibranch import importb importc importX"
        tests="$tests importX2 import-CVS import-quirks"
        tests="${tests} update-p import-after-initial branch-after-import"
@@ -8515,6 +8515,81 @@
          ;;


+       # Test for valid characters in tags
+       tag-valid)
+         # Setup; check in first-dir/file1
+         mkdir 1; cd 1
+         dotest tag-valid-init-1 "$testcvs -q co -l ."
+         mkdir first-dir
+         dotest tag-valid-init-2 "$testcvs add first-dir" \
+"Directory $CVSROOT_DIRNAME/first-dir added to the repository"
+         cd first-dir
+         touch file1
+         dotest tag-valid-init-3 "$testcvs add file1" \
+"$SPROG add: scheduling file \`file1' for addition
+$SPROG add: use \`$SPROG commit' to add this file permanently"
+         dotest tag-valid-init-4 "$testcvs -Q ci -m add"
+
+         dotest tag-valid-1 "$testcvs -Q tag abcdefghijklmnopqrstuvwxyz"
+         dotest tag-valid-2 "$testcvs -Q tag ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+         dotest tag-valid-3 "$testcvs -Q tag a0123456789-_"
+
+         dotest_fail tag-valid-4 "$testcvs -Q tag _a" \
+"$SPROG [tag aborted]: tag \`_a' must start with a letter"
+
+         dotest_fail tag-valid-5 "$testcvs -Q tag a$" \
+"$SPROG [tag aborted]: tag \`a$' may contain only letters, numbers, _ and -"
+
+         dotest_fail tag-valid-6 "$testcvs -Q tag a." \
+"$SPROG [tag aborted]: tag \`a.' may contain only letters, numbers, _ and -"
+
+         dotest_fail tag-valid-7 "$testcvs -Q tag a:" \
+"$SPROG [tag aborted]: tag \`a:' may contain only letters, numbers, _ and -"
+
+         dotest_fail tag-valid-8 "$testcvs -Q tag a." \
+"$SPROG [tag aborted]: tag \`a.' may contain only letters, numbers, _ and -"
+
+         dotest_fail tag-valid-9 "$testcvs -Q tag a," \
+"$SPROG [tag aborted]: tag \`a,' may contain only letters, numbers, _ and -"
+
+         dotest_fail tag-valid-10 "$testcvs -Q tag a;" \
+"$SPROG [tag aborted]: tag \`a;' may contain only letters, numbers, _ and -"
+
+         dotest_fail tag-valid-11 "$testcvs -Q tag a@" \
+"$SPROG [tag aborted]: tag \`a@' may contain only letters, numbers, _ and -"
+
+         dotest_fail tag-valid-12 "$testcvs -Q tag a/" \
+"$SPROG [tag aborted]: tag \`a/' may contain only letters, numbers, _ and -"
+
+         dotest_fail tag-valid-13 "$testcvs -Q tag a!" \
+"$SPROG [tag aborted]: tag \`a!' may contain only letters, numbers, _ and -"
+
+         dotest_fail tag-valid-14 "$testcvs -Q tag a#" \
+"$SPROG [tag aborted]: tag \`a#' may contain only letters, numbers, _ and -"
+
+         dotest_fail tag-valid-15 "$testcvs -Q tag a%" \
+"$SPROG [tag aborted]: tag \`a%' may contain only letters, numbers, _ and -"
+
+         dotest_fail tag-valid-16 "$testcvs -Q tag a^" \
+"$SPROG [tag aborted]: tag \`a^' may contain only letters, numbers, _ and -"
+
+         dotest_fail tag-valid-17 "$testcvs -Q tag a(" \
+"$SPROG [tag aborted]: tag \`a(' may contain only letters, numbers, _ and -"
+
+         dotest_fail tag-valid-18 "$testcvs -Q tag a)" \
+"$SPROG [tag aborted]: tag \`a)' may contain only letters, numbers, _ and -"
+
+         if $keep; then
+               echo Keeping $TESTDIR and exiting due to --keep
+               exit 0
+         fi
+
+         cd ../..
+         rm -r 1
+         modify_repo rm -rf $CVSROOT_DIRNAME/first-dir
+
+
+         ;;

        rcslib)
          # Test librarification of RCS.



--
Jim





reply via email to

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