[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Another bug in "admin -m"
From: |
Mark D. Baushke |
Subject: |
Re: Another bug in "admin -m" |
Date: |
Sat, 18 Oct 2003 11:30:23 -0700 |
Rodolfo Schulz de Lima <rodolfo@rodsoft.org> writes:
> There's a minor bug when you do, for instance,
>
> cvs admin -mSOME_TAG:another-message
>
> to change the log of revision SOME_TAG of all files in the current
> directory. It changes the first file, but then for the next ones it fails
> with an error saying that a revision number is missing (or something like
> that). I've traced down the bug and the attached patch will correct it.
>
> This patch is to be applied in the official release of cvs-1.11.9. Note that
> this patch includes my last patch about 'admin -m' changing the log message
> of wrong files.
>
> Regards,
> Rodolfo Lima
To me it appears that this problem will arise only if SOME_TAG does not
exist in all of the files provided as an argument to the cvs admin
command. Still it should work on any file that does have SOME_TAG in it
and not fail on those that do not.
Of course, the problem will only arise in cvs-1.11.9.1 at present which
contains your previous patch as an unpatched cvs-1.11.9 will just change
the log message for the some other revision rather than failing. :-)
While looking at this problem, I noticed another problem that may exist
if the SOME_TAG points to a version that does not exist. This can cause
a core dump of cvs to arise.
I'll be checking in this change after the full sanity check is complete.
Enjoy!
-- Mark
PS: Here is the revised patch against a stock cvs-1.11.9 version.
2003-10-18 Mark D. Baushke <mdb@cvshome.org>
* admin.c (admin_fileproc): Restore the ':' character in the
-mtag:message admin argument even if the tag does not exist so
that other files with the tag will be found. Also, be more
paranoid that a symbolic tag actually points to a version that
exists.
(Reported by Rodolfo Schulz de Lima <rodolfo@rodsoft.org>.)
* sanity.sh (admin): Test these changes.
Index: admin.c
===================================================================
RCS file: /cvs/ccvs/src/admin.c,v
retrieving revision 1.80.4.1
diff -u -p -r1.80.4.1 admin.c
--- admin.c 19 Feb 2003 17:38:15 -0000 1.80.4.1
+++ admin.c 18 Oct 2003 18:19:30 -0000
@@ -856,19 +856,31 @@ admin_fileproc (callerdat, finfo)
status = 1;
continue;
}
- *p = '\0';
- rev = RCS_gettag (rcs, arg + 2, 0, NULL);
+ *p = '\0'; /* temporarily make arg+2 its own string */
+ rev = RCS_gettag (rcs, arg + 2, 1, NULL); /* Force tag match */
if (rev == NULL)
{
- error (0, 0, "%s: no such revision %s", rcs->path, rev);
+ error (0, 0, "%s: no such revision %s", rcs->path, arg+2);
status = 1;
+ *p = ':'; /* restore the full text of the -m argument */
continue;
}
- *p++ = ':';
- msg = p;
+ msg = p+1;
n = findnode (rcs->versions, rev);
+ /* tags may exist against non-existing versions */
+ if (n == NULL)
+ {
+ error (0, 0, "%s: no such revision %s: %s",
+ rcs->path, arg+2, rev);
+ status = 1;
+ *p = ':'; /* restore the full text of the -m argument */
+ free (rev);
+ continue;
+ }
+ *p = ':'; /* restore the full text of the -m argument */
free (rev);
+
delta = (RCSVers *) n->data;
if (delta->text == NULL)
{
Index: sanity.sh
===================================================================
RCS file: /cvs/ccvs/src/sanity.sh,v
retrieving revision 1.752.2.41
diff -u -p -r1.752.2.41 sanity.sh
--- sanity.sh 8 Oct 2003 21:18:27 -0000 1.752.2.41
+++ sanity.sh 18 Oct 2003 18:19:30 -0000
@@ -21040,7 +21040,30 @@ text
@a0 1
add a line on the branch
@"
- dotest admin-14 "${testcvs} -q admin -aauth3 -aauth2,foo \
+ dotest_fail admin-14-1 "${testcvs} -q admin \
+-m1.1.1.1:changed-bogus-log-message file2" \
+"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
+cvs admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: no such revision 1\.1\.1\.1
+cvs admin: RCS file for .file2. not modified."
+ dotest admin-14-2 "${testcvs} -q log file2" "
+RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
+Working file: file2
+head: 1\.1
+branch:
+locks: strict
+access list:
+symbolic names:
+ br: 1\.1\.0\.2
+keyword substitution: kv
+total revisions: 1; selected revisions: 1
+description:
+----------------------------
+revision 1\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
+add
+============================================================================="
+
+ dotest admin-14-3 "${testcvs} -q admin -aauth3 -aauth2,foo \
-soneone:1.1 -m1.1:changed-log-message -ntagone: file2" \
"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
done"
@@ -21653,7 +21676,141 @@ text
@d2 1
@"
+ dotest_fail admin-30 "${testcvs} admin -mbr:another-log-message \
+file2 aaa file3" \
+"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v
+${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/file2,v: no such revision br: 1\.1
+${PROG} admin: RCS file for .file2. not modified.
+RCS file: ${CVSROOT_DIRNAME}/first-dir/aaa,v
+${PROG} admin: ${CVSROOT_DIRNAME}/first-dir/aaa,v: no such revision br
+${PROG} admin: RCS file for .aaa. not modified.
+RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v
+done"
+ dotest admin-31 "${testcvs} log" \
+"cvs log: Logging \.
+
+RCS file: /tmp/cvs-sanity/cvsroot/first-dir/aaa,v
+Working file: aaa
+head: 1\.4
+branch:
+locks: strict
+access list:
+symbolic names:
+ br1: 1\.3\.0\.2
+keyword substitution: kv
+total revisions: 5; selected revisions: 5
+description:
+----------------------------
+revision 1\.4
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
+fourth
+----------------------------
+revision 1\.3
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
+branches: 1\.3\.2;
+third
+----------------------------
+revision 1\.2
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
+second
+----------------------------
+revision 1\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
+first
+----------------------------
+revision 1\.3\.2\.4
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}4 -0
+branch-four
+=============================================================================
+
+RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file1,v
+Working file: file1
+head: 1\.1
+branch:
+locks: strict
+access list:
+ foo
+ auth2
+symbolic names:
+ tagten: 1\.1
+ BO${PLUS}GUS: 1\.1
+keyword substitution: kv
+total revisions: 2; selected revisions: 2
+description:
+----------------------------
+revision 1\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
+branches: 1\.1\.2;
+add
+----------------------------
+revision 1\.1\.2\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: foo; lines: ${PLUS}1 -0
+modify-on-branch
+=============================================================================
+
+RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file2,v
+Working file: file2
+head: 1\.4
+branch:
+locks: strict
+access list:
+ auth3
+ auth2
+ foo
+symbolic names:
+ tagfour: 1\.3
+ br4: 1\.1\.0\.2
+ br2: 1\.1\.0\.2
+ tagthree: 1\.1
+ br1: 1\.1\.0\.2
+ tagtwo: 1\.1
+ tagone: 1\.1
+ br: 1\.1\.0\.2
+keyword substitution: kv
+total revisions: 3; selected revisions: 3
+description:
+----------------------------
+revision 1\.4
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
+yet_another
+----------------------------
+revision 1\.3
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
+nuthr_line
+----------------------------
+revision 1\.2
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
+modify
+=============================================================================
+
+RCS file: /tmp/cvs-sanity/cvsroot/first-dir/Attic/file3,v
+Working file: file3
+head: 1\.1
+branch:
+locks: strict
+access list:
+symbolic names:
+ br: 1\.1\.0\.2
+keyword substitution: kv
+total revisions: 2; selected revisions: 2
+description:
+----------------------------
+revision 1\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: dead;
+branches: 1\.1\.2;
+file file3 was initially added on branch br\.
+----------------------------
+revision 1\.1\.2\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
+another-log-message
+============================================================================="
+
cd ../..
+ if $keep; then
+ echo Keeping ${TESTDIR} and exiting due to --keep
+ exit 0
+ fi
+ # clean up our after ourselves
rm -r 1
rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
Re: Another bug in "admin -m", Paul Edwards, 2003/10/18