cvs-cvs
[Top][All Lists]
Advanced

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

[Cvs-cvs] ccvs/src ChangeLog add.c sanity.sh


From: Derek Robert Price
Subject: [Cvs-cvs] ccvs/src ChangeLog add.c sanity.sh
Date: Wed, 22 Aug 2007 19:56:37 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Changes by:     Derek Robert Price <dprice>     07/08/22 19:56:36

Modified files:
        src            : ChangeLog add.c sanity.sh 

Log message:
        * add.c (add): Check last component of argument paths instead of the
        entire argument.
        (add_directory): Change error messages to assertions since the check
        in add() should prevent the problems.
        * sanity.sh (add-restricted): Test indirect paths to `CVS' dir with
        add.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/ChangeLog?cvsroot=cvs&r1=1.3519&r2=1.3520
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/add.c?cvsroot=cvs&r1=1.129&r2=1.130
http://cvs.savannah.gnu.org/viewcvs/ccvs/src/sanity.sh?cvsroot=cvs&r1=1.1182&r2=1.1183

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/ChangeLog,v
retrieving revision 1.3519
retrieving revision 1.3520
diff -u -b -r1.3519 -r1.3520
--- ChangeLog   22 Aug 2007 13:55:01 -0000      1.3519
+++ ChangeLog   22 Aug 2007 19:56:35 -0000      1.3520
@@ -1,5 +1,12 @@
 2007-08-22  Derek Price  <address@hidden>
 
+       * add.c (add): Check last component of argument paths instead of the
+       entire argument.
+       (add_directory): Change error messages to assertions since the check
+       in add() should prevent the problems.
+       * sanity.sh (add-restricted): Test indirect paths to `CVS' dir with
+       add.
+
        * cvs.h, server.c: Remove references to obsolete headers.
        * subr.c: Ditto.  Include <sys/time.h>.
        (format_cmdline): Assume long double type as per GNULIB.

Index: add.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/add.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -b -r1.129 -r1.130
--- add.c       30 May 2007 23:20:42 -0000      1.129
+++ add.c       22 Aug 2007 19:56:36 -0000      1.130
@@ -132,7 +132,7 @@
        strip_trailing_slashes (argv[i]);
        if (strcmp (argv[i], ".") == 0
            || strcmp (argv[i], "..") == 0
-           || fncmp (argv[i], CVSADM) == 0)
+           || fncmp (last_component (argv[i]), CVSADM) == 0)
        {
            if (!quiet)
                error (0, 0, "cannot add special file `%s'; skipping", argv[i]);
@@ -771,18 +771,8 @@
     int nonbranch;
     char *attrs;
 
-    if (strchr (dir, '/') != NULL)
-    {
-       /* "Can't happen".  */
-       error (0, 0,
-              "directory %s not added; must be a direct sub-directory", dir);
-       return 1;
-    }
-    if (fncmp (dir, CVSADM) == 0)
-    {
-       error (0, 0, "cannot add a `%s' directory", CVSADM);
-       return 1;
-    }
+    assert (strchr (dir, '/') == NULL);
+    assert (fncmp (dir, CVSADM));
 
     /* before we do anything else, see if we have any per-directory tags */
     ParseTag (&tag, &date, &nonbranch);

Index: sanity.sh
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/sanity.sh,v
retrieving revision 1.1182
retrieving revision 1.1183
diff -u -b -r1.1182 -r1.1183
--- sanity.sh   21 Aug 2007 22:35:19 -0000      1.1182
+++ sanity.sh   22 Aug 2007 19:56:36 -0000      1.1183
@@ -2225,6 +2225,7 @@
        tests="version basica basicb basicc basic1 deep basic2 ls"
        tests="$tests parseroot parseroot2 parseroot3 files spacefiles"
        tests="${tests} commit-readonly commit-add-missing"
+       tests="$tests add-restricted"
        tests="${tests} status"
        # Branching, tagging, removing, adding, multiple directories
        tests="${tests} rdiff rdiff-short"
@@ -33097,6 +33098,34 @@
 
 
 
+       add-restricted)
+         # Verify that `sdir/CVS' may not be explicitly added.
+         mkdir add-restricted; cd add-restricted
+
+         mkdir import; cd import
+         : > junk
+         dotest add-restricted-init-1 \
+"$testcvs -Q import -m. add-restricted X Y"
+         cd ..
+
+         dotest add-restricted-init-2 "$testcvs -Q co add-restricted"
+         cd add-restricted
+
+         # errmsg2-3 tests the specific message here.
+         dotest_fail add-restricted-1 "$testcvs -Q add CVS"
+
+         mkdir sdir
+         dotest add-restricted-2 "$testcvs -Q add sdir"
+         dotest_fail add-restricted-3 "$testcvs add sdir/CVS" \
+"$CPROG add: cannot add special file \`sdir/CVS'; skipping"
+
+         dokeep
+         cd ../..
+         rm -rf add-restricted $CVSROOT_DIRNAME/add-restricted
+       ;;
+
+
+
        commit-d)
          # Check that top-level commits work when CVS/Root
          # is overridden by cvs -d.




reply via email to

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