[OK, as for quotes my instinct is to maintain the status quo for messages which we are not changing. No point in trying to convert things without some clear notion of what the desirable state is. Comment for the status == -1 thing; don't assume two's complement ("status |= "). Check all RCS_tag2rev callers for dealing with the return status. RCS_tag2rev -> "return NULL" not "return 0". Likewise assignments to rev. The wording should probably be "tag does not exist in ". Certainly we shouldn't introduce the legacy rcs->path junk in cases where we had been printing a nice message. Probably want to explicitly run the testsuite under CVS 1.9 so we can compare. -kingdon] Date: Fri, 21 Aug 1998 22:59:14 -0700 From: Dan Wilder To: Jim Kingdon Subject: Re: Another cvs admin matter Content-Type: multipart/mixed; boundary=8t9RHnE3ZwKMSgU+ In-Reply-To: <199808211604.MAA19804@harvey.cyclic.com>; from Jim Kingdon on Fri, Aug 21, 1998 at 12:04:04PM -0400 --8t9RHnE3ZwKMSgU+ Content-Type: text/plain; charset=us-ascii On Fri, Aug 21, 1998 at 12:04:04PM -0400, Jim Kingdon wrote: > > cvs would merely print an error message reporting the missing tag, and > > continue tagging any additional files that had OLD_TAG. > > Seems reasonable. > > > leave the quotes around the tag, or delete them? > > Personally, I don't have much of an opinion. For the most part, CVS > isn't particularly consistent this way. Ok, please find attached, the patch. I've made at least the warnings that immediately pertain consistent, using quotes: `rev'. Sanity.sh runs to OK completion, and the patched version has withstood some days of operation at work. -- Dan Wilder --8t9RHnE3ZwKMSgU+ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch Index: src/ChangeLog =================================================================== RCS file: /cvs/cvs/src/ChangeLog,v retrieving revision 1.1.1.1 retrieving revision 1.4 diff -u -r1.1.1.1 -r1.4 --- ChangeLog 1998/08/20 05:23:51 1.1.1.1 +++ ChangeLog 1998/08/22 05:33:48 1.4 @@ -1,3 +1,22 @@ +Tue Aug 18 23:38:22 1998 Dan Wilder + + * Revert the code to CVS 1.9 (and earlier) behavior in the + case where valid but nonexistant `old' tag is given in + cvs admin -nnew:old + command. Previously, cvs would print a warning and + continue with any remaining files, exiting finally with 0. + In cvs-1.10 instead quits immediately, with exit code 1. + + * rcs.c: Change RCS_tag2rev() so that it returns 0 for + undefined tag instead of exiting. + + * admin.c: In admin_fileproc(), return status 0 for + undefined tag. Internally, use status -1 to flag + undefined tag, changing this to 0 at return time. + + * sanity.sh: modify admin-26-1 through admin-26-5 to + reflect changed messages and result codes. + Thu Aug 13 11:15:24 1998 Noel Cragg * version.c: Change version number to 1.10 and name to `Halibut'. Index: src/admin.c =================================================================== RCS file: /cvs/cvs/src/admin.c,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- admin.c 1998/08/20 05:23:52 1.1.1.1 +++ admin.c 1998/08/20 12:53:05 1.3 @@ -497,7 +497,7 @@ branch = RCS_whatbranch (rcs, admin_data->branch + 2); if (branch == NULL) { - error (0, 0, "%s: Symbolic name %s is undefined.", + error (0, 0, "%s: Symbolic name `%s' is undefined.", rcs->path, admin_data->branch + 2); status = 1; } @@ -678,10 +678,10 @@ { if (RCS_deltag (rcs, arg + 2) != 0) { - error (0, 0, "%s: Symbolic name %s is undefined.", + error (0, 0, "%s: Symbolic name `%s' is undefined.", rcs->path, arg + 2); - status = 1; + status = -1; continue; } break; @@ -718,9 +718,9 @@ else { error (0, 0, - "%s: Symbolic name or revision %s is undefined", + "%s: Symbolic name or revision `%s' is undefined", rcs->path, p); - status = 1; + status = -1; } free (tag); break; @@ -824,6 +824,8 @@ exitfunc: freevers_ts (&vers); + if (status == -1) + status = 0; return status; } Index: src/rcs.c =================================================================== RCS file: /cvs/cvs/src/rcs.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rcs.c 1998/08/20 05:23:53 1.1.1.1 +++ rcs.c 1998/08/20 06:02:04 1.2 @@ -2364,8 +2364,8 @@ * returns the magic branch number. * -- If tag is a branch tag, returns the branch number, not * the revision of the head of the branch. - * If tag or revision is not valid or does not exist in file, - * exit with error. + * If tag or revision is not valid (illegal characters, etc) exit with error. + * If tag or revision does not exist in file, return 0. */ char * RCS_tag2rev (rcs, tag) @@ -2375,6 +2375,7 @@ char *rev, *pa, *pb; int i; + rev = 0; assert (rcs != NULL); if (rcs->flags & PARTIAL) @@ -2398,7 +2399,8 @@ if (i == 1 || *(pa-1) != RCS_MAGIC_BRANCH || *(pa-2) != '.') { free (rev); - error (1, 0, "revision `%s' does not exist", tag); + rev = 0; + return rev; } } @@ -2416,9 +2418,12 @@ (void) sprintf (pb, "%s.%d.%s", rev, RCS_MAGIC_BRANCH, pa); free (rev); rev = pb; - if (RCS_exist_rev (rcs, rev)) - return rev; - error (1, 0, "revision `%s' does not exist", tag); + if (RCS_exist_rev (rcs, rev) == 0) + { + free (rev); + rev = 0; + } + return rev; } @@ -2430,13 +2435,8 @@ /* If valid tag let translate_symtag say yea or nay. */ rev = translate_symtag (rcs, tag); - - if (rev) - return rev; - error (1, 0, "tag `%s' does not exist", tag); - /* NOT REACHED -- error (1 ... ) does not return here */ - return 0; + return rev; } /* Index: src/sanity.sh =================================================================== RCS file: /cvs/cvs/src/sanity.sh,v retrieving revision 1.1.1.1 retrieving revision 1.4 diff -u -r1.1.1.1 -r1.4 --- sanity.sh 1998/08/20 05:23:51 1.1.1.1 +++ sanity.sh 1998/08/22 05:33:48 1.4 @@ -13728,10 +13729,10 @@ # try a bad symbolic revision dotest_fail admin-10c "${testcvs} -q admin -bBOGUS" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v -${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/file1,v: Symbolic name BOGUS is undefined. +${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/file1,v: Symbolic name .BOGUS. is undefined. ${PROG} [a-z]*: cannot modify RCS file for .file1. RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v -${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/file2,v: Symbolic name BOGUS is undefined. +${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/file2,v: Symbolic name .BOGUS. is undefined. ${PROG} [a-z]*: cannot modify RCS file for .file2." # Note that -s option applies to the new default branch, not @@ -14340,22 +14341,24 @@ "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v done" - # Fail on some bogus operations # Try to attach to nonexistant tag # - dotest_fail admin-28-1 "${testcvs} admin -ntagsix:tagfive file2" \ + dotest admin-28-1 "${testcvs} admin -ntagsix:tagfive file2" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v -${PROG} \[[a-z]* aborted\]: tag .tagfive. does not exist" +${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/file2,v: Symbolic name or revision .tagfive. is undefined +${PROG} [a-z]*: cannot modify RCS file for .file2." - # Try a some nonexisting numeric target tags + # Try some nonexistant numeric target tags # - dotest_fail admin-28-2 "${testcvs} admin -ntagseven:2.1 file2" \ + dotest admin-28-2 "${testcvs} admin -ntagseven:2.1 file2" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v -${PROG} \[[a-z]* aborted\]: revision .2\.1. does not exist" +${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/file2,v: Symbolic name or revision .2\.1. is undefined +${PROG} [a-z]*: cannot modify RCS file for .file2." - dotest_fail admin-28-3 "${testcvs} admin -ntageight:2.1.2 file2" \ + dotest admin-28-3 "${testcvs} admin -ntageight:2.1.2 file2" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v -${PROG} \[[a-z]* aborted\]: revision .2\.1\.2. does not exist" +${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/file2,v: Symbolic name or revision .2\.1\.2. is undefined +${PROG} [a-z]*: cannot modify RCS file for .file2." # Try some invalid targets # @@ -14363,9 +14366,12 @@ "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v ${PROG} \[[a-z]* aborted\]: tag .1\.a\.2. must start with a letter" - dotest_fail admin-28-5 "${testcvs} admin -ntagten:BO+GUS file2" \ + # FIXME: apparently BO+GUS is a valid target. Or is it? + # + dotest admin-28-5 "${testcvs} admin -ntagten:BO+GUS file2" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v -${PROG} \[[a-z]* aborted\]: tag .BO${PLUS}GUS. does not exist" +${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/file2,v: Symbolic name or revision .BO${PLUS}GUS. is undefined +${PROG} [a-z]*: cannot modify RCS file for .file2." dotest_fail admin-28-6 "${testcvs} admin -nq.werty:tagfour file2" \ "RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v --8t9RHnE3ZwKMSgU+--