summaryrefslogtreecommitdiffstats
path: root/contrib/cvs/src
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/cvs/src')
-rw-r--r--contrib/cvs/src/ChangeLog1445
-rw-r--r--contrib/cvs/src/ChangeLog-973249
-rw-r--r--contrib/cvs/src/Makefile.in6
-rw-r--r--contrib/cvs/src/add.c343
-rw-r--r--contrib/cvs/src/admin.c721
-rw-r--r--contrib/cvs/src/buffer.c438
-rw-r--r--contrib/cvs/src/buffer.h4
-rw-r--r--contrib/cvs/src/checkin.c16
-rw-r--r--contrib/cvs/src/checkout.c540
-rw-r--r--contrib/cvs/src/classify.c54
-rw-r--r--contrib/cvs/src/client.c1253
-rw-r--r--contrib/cvs/src/client.h28
-rw-r--r--contrib/cvs/src/commit.c196
-rw-r--r--contrib/cvs/src/create_adm.c66
-rw-r--r--contrib/cvs/src/cvs.h118
-rwxr-xr-xcontrib/cvs/src/cvsbug.sh2
-rw-r--r--contrib/cvs/src/cvsrc.c15
-rw-r--r--contrib/cvs/src/diff.c144
-rw-r--r--contrib/cvs/src/edit.c59
-rw-r--r--contrib/cvs/src/entries.c282
-rw-r--r--contrib/cvs/src/error.c8
-rw-r--r--contrib/cvs/src/expand_path.c21
-rw-r--r--contrib/cvs/src/fileattr.c84
-rw-r--r--contrib/cvs/src/fileattr.h11
-rw-r--r--contrib/cvs/src/filesubr.c37
-rw-r--r--contrib/cvs/src/find_names.c25
-rw-r--r--contrib/cvs/src/hash.c51
-rw-r--r--contrib/cvs/src/hash.h4
-rw-r--r--contrib/cvs/src/history.c13
-rw-r--r--contrib/cvs/src/ignore.c51
-rw-r--r--contrib/cvs/src/import.c325
-rw-r--r--contrib/cvs/src/lock.c8
-rw-r--r--contrib/cvs/src/log.c135
-rw-r--r--contrib/cvs/src/login.c81
-rw-r--r--contrib/cvs/src/logmsg.c29
-rw-r--r--contrib/cvs/src/main.c268
-rw-r--r--contrib/cvs/src/mkmodules.c44
-rw-r--r--contrib/cvs/src/modules.c70
-rw-r--r--contrib/cvs/src/myndbm.c11
-rw-r--r--contrib/cvs/src/no_diff.c2
-rw-r--r--contrib/cvs/src/options.h.in82
-rw-r--r--contrib/cvs/src/parseinfo.c185
-rw-r--r--contrib/cvs/src/patch.c105
-rw-r--r--contrib/cvs/src/rcs.c3345
-rw-r--r--contrib/cvs/src/rcs.h111
-rw-r--r--contrib/cvs/src/rcscmds.c617
-rw-r--r--contrib/cvs/src/recurse.c92
-rw-r--r--contrib/cvs/src/release.c21
-rw-r--r--contrib/cvs/src/remove.c19
-rw-r--r--contrib/cvs/src/repos.c60
-rw-r--r--contrib/cvs/src/root.c80
-rw-r--r--contrib/cvs/src/rtag.c30
-rw-r--r--contrib/cvs/src/run.c97
-rwxr-xr-xcontrib/cvs/src/sanity.sh7878
-rw-r--r--contrib/cvs/src/scramble.c157
-rw-r--r--contrib/cvs/src/server.c1209
-rw-r--r--contrib/cvs/src/server.h6
-rw-r--r--contrib/cvs/src/status.c27
-rw-r--r--contrib/cvs/src/subr.c241
-rw-r--r--contrib/cvs/src/tag.c26
-rw-r--r--contrib/cvs/src/update.c342
-rw-r--r--contrib/cvs/src/vers_ts.c64
-rw-r--r--contrib/cvs/src/version.c2
-rw-r--r--contrib/cvs/src/watch.c2
-rw-r--r--contrib/cvs/src/wrapper.c54
-rw-r--r--contrib/cvs/src/zlib.c193
66 files changed, 20222 insertions, 5080 deletions
diff --git a/contrib/cvs/src/ChangeLog b/contrib/cvs/src/ChangeLog
index 0c8b0f6..96540fb 100644
--- a/contrib/cvs/src/ChangeLog
+++ b/contrib/cvs/src/ChangeLog
@@ -1,1376 +1,199 @@
-Tue Jun 17 22:48:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+Thu Jan 22 10:05:55 1998 Jim Kingdon <kingdon@harvey.cyclic.com>
- * main.c (main): Add --allow-root=ROOT argument; call
- root_allow_add for each time it is specified. Call
- root_allow_free before exiting.
- * root.c, cvs.h (root_allow_add, root_allow_free, root_allow_ok):
- New function.
- * server.c (pserver_authenticate_connection): If root_allow_ok
- doesn't like the CVSROOT directory, don't allow access.
+ * server.c (serve_kopt): Check for length of arg. Based on
+ inspection of the code, plugs a buffer overrun security hole which
+ was introduced Monday.
-Tue Jun 17 14:30:14 1997 Jim Kingdon (unknown@beezley)
+ * server.c (serve_is_modified): Don't call xmalloc; we aren't
+ allowed to call error() here. Remove duplicate (and potentially
+ confusing) variable 'p'.
- * client.c: Add "copyright" notice. If NO_EXT_METHOD, omit
- start_rsh_method.
- * client.c (update_entries): Cast argument to MD5Update from
- char * to unsigned char *.
+ * log.c (log_fileproc): Look for first character of version
+ '0' AND second character '\0', rather than OR. I didn't try to
+ come up with a test case but this looks like a simple thinko
+ (albeit one which would show up in obscure cases if at all).
-Mon Jun 16 16:46:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+Tue Jan 20 19:37:53 1998 Jim Kingdon <kingdon@harvey.cyclic.com>
- * run.c (piped_child, filter_stream_through_program):
- If USE_SETMODE_BINARY, then put the pipes into binary mode.
- * find_names.c, ignore.c, lock.c, wrapper.c: Change fnmatch to
- CVS_FNMATCH.
- * client.c (start_server): If NO_EXT_METHOD, then give a fatal
- error on any use of :ext:.
+ * client.c (send_dirent_proc): Don't send nonexistent directories
+ unless noexec.
+ * sanity.sh (modules2): New tests modules2-13 through modules2-18
+ test for this fix.
-Sun Jun 15 22:30:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+Mon Jan 19 11:17:51 1998 Jim Kingdon <kingdon@harvey.cyclic.com>
- * sanity.sh (toplevel): Match U CVSROOT/* lines with DOTSTAR in
- test toplevel-9.
+ * server.c (serve_kopt): New function.
+ (requests): Add "Kopt" request.
+ (kopt): New variable.
+ (serve_is_modified): Write kopts from there into entries.
+ (serve_modified): Call serve_is_modified so we do the same.
+ Declare serve_modified and serve_is_modified.
+ * vers_ts.c (Version_TS): Set ->options even for a dummy ("D"
+ timestamp) entry.
+ * import.c (process_import_file): Check for -k options.
+ * client.c (client_process_import_file): Send Kopt request.
+ (send_fileproc): Likewise, for "cvs add".
+ * sanity.sh: Enable test binwrap3-sub2-add1 for remote.
+ Add -I .cvswrappers to binwrap3-2a; adjust binwrap3-2d
+ accordingly. Tests for this fix.
-Thu Jun 12 10:27:51 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+Mon Jan 19 08:48:59 1998 Larry Jones <larry.jones@sdrc.com>
- * sanity.sh (toplevel): Remove Emptydir before starting.
+ * sanity.sh (errmsg1): Append test 168 output to log file.
- * sanity.sh: Change "rm -rf" to "rm -r" when deleting working
- directories (except a few watches cases). Helps detect cases
- where the testsuite has cd'd to somewhere other than where we
- think it has.
- (basic2): Remove "rm -r first-dir" between tests 49 and 50. The
- directory was already deleted in test 45.5.
- (rcs): Add "cd .." at end of tests.
- (stamps): No longer cd to TESTDIR; shouldn't be necessary with
- fix to "rcs" test.
+Sat Jan 17 08:01:51 1998 Jim Kingdon <kingdon@harvey.cyclic.com>
-Wed Jun 11 22:28:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+ * sanity.sh (ann-10, ann-11): Don't make assumptions about the
+ number of characters in the username.
- * sanity.sh (basicb): Also remove CVSROOT/Emptydir at end of
- test. Otherwise it affects the toplevel-9 test for remote.
+Fri Jan 16 15:34:02 1998 Larry Jones <larry.jones@sdrc.com>
-Tue Jun 10 14:03:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+ * diff.c (diff_fileproc): Free label1 and label2 when finished.
- * sanity.sh (toplevel): Change "update" and "checkout" to "[a-z]*"
- as these read "server" instead for "make remotecheck". Change
- expect strings for toplevel-9 to accept the behavior of remote CVS
- (see comments for more discussion).
+ * edit.c (editor_set): Don't free edlist until after we're
+ done using it.
- * sanity.sh: New tests stamps-9 through stamps-11 test timestamp
- behavior on cvs update.
+ * rcscmds.c (RCS_merge): Free xrev1 and xrev2 when finished.
-Mon Jun 9 22:42:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+ * subr.c (make_message_rcslegal): Don't access uninitialized or
+ unallocated memory; only strip trailing blank lines.
+ * sanity.sh (log-3): Enhance to test this fix.
- * sanity.sh: Remove "#! /bin/zsh" line at end. I assume it was
- added accidentally.
+Fri Jan 16 12:41:03 1998 Jim Kingdon <kingdon@harvey.cyclic.com>
-Tue Jun 10 03:08:46 1997 Norbert Kiesel <nk@psycho.de>
+ * sanity.sh: Add keywordlog to list of tests run by default.
- * sanity.sh: new tests "toplevel" for the new toplevel CVS
- directory creation (including one test which shows an error in
- this area).
+ * rcs.c (RCS_deltas): Don't call cvs_output if length is zero;
+ passing zero length to cvs_output does not mean output zero
+ bytes. The 27 Dec 1997 change to no longer '\0'-terminate the
+ ->text field turned this from a time bomb to a user-visible bug.
+ * sanity.sh (ann): New tests, test for this fix and other annotate
+ behaviors.
-Sun Jun 8 20:52:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+Thu Jan 15 23:52:00 1998 Jim Kingdon <kingdon@harvey.cyclic.com>
- * rcs.c (getrcsrev): Before printing error, check whether it was
- feof or ferror.
+ * root.c (root_allow_ok): If inetd.conf didn't specify an
+ --allow-root options at all, we know we are in trouble. Give a
+ specific error message.
- * rcs.h, import.c (add_rcs_file): No longer static. New arguments
- add_vbranch, add_vhead, and add_logfp replace access to static
- variables vbranch, vhead, and logfp.
- * mkmodules.c: Call it instead of RCS_CI.
- * import.c (process_import_file): Adjust call to add_rcs_file.
+Thu Jan 15 21:24:59 1998 Ian Lance Taylor <ian@cygnus.com>
-Tue Jun 3 10:18:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+ * sanity.sh (dotest_sort): New variant of dotest which sorts the
+ output, for use when the output depends upon details of the file
+ system, typically when doing an import.
+ (rdiff): Use dotest_sort for rdiff-1.
+ (ignore): Use dotest_sort for 188a, 188b, 189d, 190, and 191.
- * sanity.sh (basicb): Match "." with "\." not ".".
+ * sanity.sh: (TESTSHELL): New variable.
+ (editor, info, reserved): Use TESTSHELL in temporary script.
-Tue Jun 3 13:02:37 1997 Norbert Kiesel <nk@cosa.de>
+ * sanity.sh (ignore): Do all tests in subdirectory, to avoid
+ conflict between cvsroot and CVSROOT on Windows.
+ (binwrap3, mwrap, info, config): Likewise.
- * checkout.c (checkout): Removed restriction of not sending -k in
- remote export (I think this was introduced while the -k handling
- was still broken in remote mode). Give better error texts
- regarding -c and -s options. Use error() instead of usage() for
- reporting errors in all places. Reindented some lines. Free
- xmalloc'd space of options.
+ * sanity.sh (binfiles2): Correct test name binfile2-7-brmod to
+ binfiles2-7-brmod.
-Thu May 29 16:32:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+ * release.c (release_delete): If __CYGWIN32__ is defined, don't
+ worry about mismatched inodes. This is a hack, but then I think
+ the test is rather peculiar anyhow.
- * rcscmds.c (RCS_checkin), mkmodules.c (init): Pass -w option to
- "ci", specifying getcaller ().
- * server.h, server.c (CVS_Username): Now extern.
- * subr.c (getcaller): Return CVS_Username if it is set.
+Thu Jan 15 16:07:36 1998 Larry Jones <larry.jones@sdrc.com>
-Wed May 28 22:31:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+ * sanity.sh (reserved-9): Use ${PROG} instead of "cvs".
- * update.c (update_fileproc): If wrap_merge_is_copy and we would
- like to do a merge, give a fatal error. See comment for why.
- * sanity.sh (mwrap): New tests, tests for above fix.
+Wed Jan 14 15:43:13 1998 Jim Kingdon <kingdon@harvey.cyclic.com>
-Tue May 27 21:59:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+ * Split ChangeLog into ChangeLog-97 and ChangeLog.
+ * Makefile.in (DISTFILES): Add ChangeLog-97.
- * sanity.sh (stamps): cd to ${TESTDIR} before starting.
+13 Jan 1998 Jim Kingdon
-Mon May 26 15:31:30 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+ * client.c: Declare handle_mt.
- * client.c (handle_mod_time): New function.
- (responses): Add "Mod-time".
- (stored_modtime_valid, stored_modtime): New variables.
- (update_entries): If it is set, change the file's modtime.
- * server.c, server.h (server_modtime): New function.
- * vers_ts.c (Version_TS): Call it.
- * patch.c (patch_fileproc): Add comment about why we don't.
- * sanity.sh (stamps): Added, tests for above fix.
+Tue Jan 13 22:21:30 1998 Jim Kingdon <kingdon@harvey.cyclic.com>
-Fri May 16 13:14:30 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+ * sanity.sh: Add comment about how pwd and /bin/pwd often differ
+ in behavior (but are not guaranteed to).
- * subr.c (free_names): Update documentation to reflect fact that
- free_names is now called to free vectors allocated by expand_wild
- as well as by line2argv.
+Tue Jan 13 13:49:53 1998 Ian Lance Taylor <ian@cygnus.com>
- * main.c (main): Use "xstrdup (foo)" not "xstrdup(foo)" as
- specified in HACKING.
+ * sanity.sh: When setting TMPPWD use just pwd, not /bin/pwd.
-Fri May 16 15:10:37 1997 Norbert Kiesel <nk@cosa.de>
+ * update.c (checkout_file): Don't pass set_time as true to
+ Version_TS if the file is dead.
+ * sanity.sh (modules): Add tests modules-155c6 through
+ modules-155c8 to test for above patch (without the above patch,
+ modules-155c8 will fail when remote).
- * modules.c (do_module): initialize optind to 0. use local copies
- of optarg's (because they might me freed within free_names).
+Tue Jan 13 10:37:02 1998 Larry Jones <larry.jones@sdrc.com>
-Thu May 15 11:50:15 1997 Norbert Kiesel <nk@cosa.de>
+ * client.c (send_modified): Change bufsize and newsize from int
+ to size_t to avoid type clashes in call to read_and_gzip.
- * main.c (main): initialize optind to 0. use local copies of
- optarg's (because they might me freed within read_cvsrc).
+Tue Jan 13 10:33:02 1998 Larry Jones <larry.jones@sdrc.com>
- * cvsrc.c (read_cvsrc): free old argv after constructing a new
- one. This fixes a memory leak.
+ * zlib.c (read_and_gzip): Set finish to 0; it was uninitialized.
- * recurse.c (start_recursion): use free_names() instead of
- reimplementing it
+Tue Jan 13 10:26:43 1998 Larry Jones <larry.jones@sdrc.com>
- * rcs.c (RCS_deltas): free branchversion (memory leak).
+ * add.c, rcs.c: Plug memory leaks.
- * parseinfo.c (Parse_Info): free some vars (3 memory leaks).
+Mon Jan 12 10:45:27 1998 Larry Jones <larry.jones@sdrc.com>
- * logmsg.c (logfile_write): free str_list_format (memory leak).
+ * server.c (mkdir_p): Don't try to create nameless directories
+ (i.e., given "/foo//bar", don't try to create "/foo/",
+ just "/foo" and "/foo//bar") since it isn't necessary and
+ it fails on some systems in unexpected ways.
- * watch.c (watch_addremove), (watchers), update.c (update), tag.c
- (cvstag), status.c (status), rtag.c (rtag), remove.c (cvsremove),
- release.c (release), patch.c (patch), log.c (cvslog), import.c
- (import), history.c (history), edit.c (watch_onoff), (edit),
- (unedit), (editors), diff.c (diff), commit.c (commit), checkout.c
- (checkout), add.c (add): initialize optind to 0
+1998-01-11 enami tsugutomo <enami@but-b.or.jp>
- * diff.c (diff_fileproc): cosmetic change (whitespace added).
+ * rcs.c (linevector_copy): Delete lines before overwriting them.
- * checkout.c (checkout): move local variable definition into the
- block where the variable is used.
+Sat Jan 10 11:05:40 1998 Jim Kingdon <kingdon@harvey.cyclic.com>
- * client.c (update_entries): initialize some local variables to shut up
- gcc -O -Wall.
+ * cvsrc.c, entries.c, login.c, logmsg.c, myndbm.c, patch.c,
+ release.c, server.c: Check for errors from getline, CVS_FOPEN,
+ fprintf, CVS_UNLINK and fclose. Note that the new errors are
+ nonfatal. This is because of conservatism more than because
+ it is always the best thing.
+ * login.c (get_cvs_password): Close the file when done with it.
+ * client.c (notified_a_file): If -1 return from getline, check
+ feof rather than assuming errno is set.
- * buffer.c (buf_read_line): initialize a local variable to shut up
- gcc -O -Wall.
-
+Fri Jan 9 14:38:54 1998 Jim Kingdon <kingdon@harvey.cyclic.com>
-Wed May 14 16:29:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+ * server.c (expand_proc): Also output server_dir in
+ "Module-expansion", not just in output_dir ("Created", &c).
+ * sanity.sh (modules2): New tests modules2-9 through modules2-12
+ test for this.
- * admin.c (admin): When sending options to server, don't try to
- send av[ac]. It may contain one of the names that we'll send in
- send_file_names (which caused tests like keyword-6 to work,
- sort of accidentally), or it may contain NULL (which would tend to
- cause a coredump).
- * sanity.sh (basicb): New test basicb-21 tests for above fix.
+Thu Jan 8 12:56:55 1998 Yasutoshi Hiroe <hiroe@rgk.ricoh.co.jp>
-Mon May 12 16:22:00 1997 Larry Jones <larry.jones@sdrc.com>
+ * import.c (import): Don't strcat on uninitialized memory. Fixes
+ possible SIGSEGV with zero-length message.
- * add.c (add): Free message and repository in client code.
- * checkout.c (checkout): Don't free repository unless allocated.
- * client.c (start_rsh_server): Free command.
+Tue Jan 6 22:56:29 1998 Jim Kingdon <kingdon@harvey.cyclic.com>
-Sun May 11 11:43:54 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+ * sanity.sh (crerepos): Fix mistaken variable name which caused us
+ not to clean up at the end of the test.
- * client.c: Remove all references to USE_DIRECT_TCP; see
- ../ChangeLog for rationale.
+Mon Dec 22 01:40:57 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-Fri May 9 22:19:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+ * add.c (add): Also look for .cvswrappers files.
+ * sanity.sh (binwrap3): New tests binwrap3-2*, binwrap3-sub2-add*
+ test for this.
- * main.c (main): Add comment explaining why we call exit. Pass 0
- not EXIT_SUCCESS, because lib/system.h has portability cruft for
- EXIT_FAILURE but not EXIT_SUCCESS.
+Tue Jan 6 11:50:38 1998 Jim Kingdon <kingdon@harvey.cyclic.com>
-Fri May 9 17:25:00 1997 Larry Jones <larry.jones@sdrc.com>
+ * sanity.sh (crerepos): New tests crerepos-8 through crerepos-18
+ test behaviors when mixing repositories.
- Fix miscellaneous memory allocation problems:
- * add.c (add): Free repository.
- * client.c (notified_a_file): Free getline buffer.
- * edit.c (notify_check): Free getline buffer.
- * hash.c (dellist): Free header node when not caching.
- * login.c (login): Don't continually free & allocate getline
- buffer, use xstrdup instead of xmalloc/strcpy, free getline
- buffer before returning.
- * main.c (main): Call exit instead of returning so tools like
- Purify won't consider permanently allocated memory as leaks.
- * mkmodules.c (mkmodules): Free getline buffer.
- * modules.c (cat_module): Call close_module.
- * rcs.c (rcsvers_delproc): Free state.
- * recurse.c (start_recursion): Free files_by_dir.
- (unroll_files_proc): NULL out p->data after using it to set
- filelist to avoid multiple frees.
- * server.c (check_command_legal_p): Don't continually free &
- allocate getline buffer, free getline buffer before returning.
- (check_repository_password): Ditto, use xstrdup instead of
- xmalloc/strcpy.
- * wrapper.c (wrap_add_file): Free getline buffer.
+Sun Jan 4 17:40:22 1998 Jim Kingdon <kingdon@harvey.cyclic.com>
-Thu May 8 14:21:00 1997 Larry Jones <larry.jones@sdrc.com>
- and Jim Kingdon <kingdon@harvey.cyclic.com>
+ * version.c: Change version number to 1.9.23.
- * checkout.c (checkout_proc): Free finfo.rcs (memory leak).
+ * Version 1.9.22.
-8 May 1997 Larry Jones <larry.jones@sdrc.com>
- and Jim Kingdon <kingdon@harvey.cyclic.com>
- * hash.c: Add #ifdef's to disable caching. This makes it easier
- to track down memory allocation problems.
-
-Thu May 8 11:40:39 1997 Larry Jones <larry.jones@sdrc.com>
-
- * sanity.sh: In setting "tests" use a number of statements rather
- than one very long line.
-
-Thu May 8 11:40:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * cvsbug.sh: Remove $Id; we decided to get rid of these some time
- ago.
-
-Thu May 8 11:34:02 1997 Larry Jones <larry.jones@sdrc.com>
-
- * cvsbug.sh: Put separate statements on separate lines, so it
- works if awk is AT&T nawk.
-
-Tue May 6 16:56:00 1997 Larry Jones <larry.jones@sdrc.com>
- and Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * cvsrc.c (read_cvsrc): Fix various memory allocation problems:
- rearrange code to avoid leaks, use xrealloc instead of xmalloc/
- copy/free, make sure there's room for the remaining args before
- appending them.
-
-Tue May 6 14:20:00 1997 Larry Jones <larry.jones@sdrc.com>
-
- * edit.c (watch_onoff, edit, unedit, editors): Add -R like
- other things with -l.
- * watch.c (watch_addremove, watchers): Ditto.
-
-Mon May 5 18:10:37 1997 larry.jones@sdrc.com
- and Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh: Change all /tmp/cvs-sanity to TESTDIR. If TESTDIR
- environment variable is set, use it instead of /tmp/cvs-sanity.
- * sanity.sh: Make TMPPWD the pwd equivalent of TESTDIR, not of /tmp.
-
-4 May 1997 Larry jones <larry.jones@sdrc.com>
- and Jim Kingdon
-
- * checkout.c, diff.c, patch.c, rcs.c: Update usage messages.
- * rcs.c (annotate): Add -R like other things with -l.
-
-Sat May 3 14:57:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh (basic1): Rewrite test (use dotest, unroll the loops
- which IMHO makes the test a zillion times more understandable, and
- only do the variant which tests for 4 files at a time--we test one
- file at a time lots of places).
-
-2 May 1997 Ziv Gigus <ziv@rest.home.net>
- and Jim Kingdon
-
- * client.c, client.h (client_process_import_file): New argument
- all_files_binary means treat all files as binary.
- * import.c (import_descend): Pass it if -kb is specified.
- * client.c (client_process_import_file): In the
- non-all_files_binary case, call wrap_rcsoption to determine
- whether the file is binary.
-
-Thu May 1 13:44:51 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh (binfiles2): New tests, for update -j and binary files.
-
-Wed Apr 30 11:18:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * recurse.c (start_recursion): Also free reposfile.
- Don't look in repository if client_active (latter bug reported by Paul
- Sanders <p.sanders@dial.pipex.com>).
-
-Mon Apr 28 22:36:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * diff.c (diff_file_nodiff): Remove SERVER_SUPPORT ifdefs. They
- were not based on server_active, which doesn't really make any
- sense (it meant that compiling --disable-server could affect the
- behavior of the non-client/server CVS). This affected the output
- in tests death2-diff-11 and death2-diff-12 in the testsuite.
- * sanity.sh (newb-123j0): Also accept "Needs Checkout", for a
- --disable-server CVS.
-
- * main.c (cmd_usage): Change "run diffs" to "show differences";
- the former is jargon.
- * edit.c (edit_usage): Fix typo ("." -> ",").
- * edit.c (editors_usage), watch.c (watchers_usage): Mention -l.
- * checkout.c (export_usage): Say what -P does.
- * history.c (history_usg): Add comment about message wording.
-
-Mon Apr 28 14:47:45 1997 Norbert Kiesel <nk@cosa.de>
-
- * checkin.c (Checkin): use filename without path when calling
- wrapper (bug found by Michal Schmitz <ms@cosa.de>).
-
-Fri Apr 25 13:28:55 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * client.c (update_entries): In UPDATE_ENTRIES_RCS_DIFF case,
- write to a temporary file and then rename it.
-
-Thu Apr 24 11:35:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * subr.c, cvs.h (pathname_levels): New function, from a piece of
- send_file_names.
- * client.c (send_file_names): Call pathname_levels in place of the
- code which was moved there.
- * server.c, server.h (server_pathname_check): New function.
- * recurse.c (start_recursion): Call it.
- * sanity.sh (modules3): New test modules3-11b tests for above fix.
-
- * filesubr.c: Do not define L_tmpnam. It is in ANSI and SunOS4,
- so I don't think there will be a problem with it being missing.
- Defining it too small can cause memory corruption.
- (cvs_temp_name): Do not use L_tmpnam in the mktemp code; this
- could cause a buffer overflow if the -T global option was in use.
-
-Thu Apr 24 13:21:15 1997 Norbert Kiesel <nk@cosa.de>
-
- * filesubr.c (cvs_temp_name): Use tempnam if available, else
- mktemp, else tmpnam. See the comment for rationale.
-
- * sanity.sh: use "tar cf - ." instead of "tar cf - *" for
- directory copies.
-
-Wed Apr 23 23:41:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * server.c (serve_update_prog): If in readonly mode, give an error.
-
-Wed Apr 23 19:07:41 1997 Norbert Kiesel <nk@cosa.de>
-
- * subr.c (line2argv): Allocate at least 4 slots for argv.
-
- * checkout.c (checkout_proc): Add a comment which says why the
- above change was necessary to avoid writing to unallocated memory.
-
-Wed Apr 23 11:20:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * entries.c (ParseTag): Always set *NONBRANCHP.
-
-21 Apr 1997 Jim Kingdon
-
- * client.c (update_entries), rcs.c (expand_keywords): Rewrite
- test to avoid signed/unsigned warning.
-
-Mon Apr 21 09:02:22 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * update.c (patch_file): Add comment about whether auto-detecting
- features of the DIFF program is a good idea.
-
-Mon Apr 21 00:03:34 1997 Ian Lance Taylor <ian@cygnus.com>
-
- Don't require the patch program:
- * client.c (struct update_entries_data): Add
- UPDATE_ENTRIES_RCS_DIFF to contents enum.
- (update_entries): Handle UPDATE_ENTRIES_RCS_DIFF.
- (handle_rcs_diff): New static function.
- (responses): Add "Rcs-diff".
- * server.c (server_updated): Handle SERVER_RCS_DIFF.
- (server_use_rcs_diff): New function.
- * server.h (enum server_updated_arg4): Add SERVER_RCS_DIFF.
- (server_use_rcs_diff): Declare.
- * update.c (rcs_diff_patches): New static variable.
- (update): Set rcs_diff_patches.
- (update_fileproc): If rcs_diff_patches, pass SERVER_RCS_DIFF
- rather than SERVER_PATCHED to server_updated.
- (patch_file): Correct initial comment to say diff rather than
- rcsdiff. If rcs_diff_options, pass -n to diff rather than -c.
- * rcs.c (rcs_change_text): New function.
- * rcs.h (rcs_change_text): Declare.
-
-Mon Apr 21 00:08:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * diff.c (diff_fileproc): Add comment concerning updating the
- client timestamp.
-
-Sun Apr 20 23:20:37 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * commit.c (commit): Add comment regarding SEND_FORCE rationale.
-
-Sat Apr 19 17:10:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * server.c (dirswitch): If directory ends in '/', complain.
-
-Fri Apr 18 18:09:57 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * rcs.c (apply_rcs_changes): New static function, broken out of
- RCS_deltas.
- (RCS_deltas): Call it.
- (linevector_add): Change return type to int. Return an indication
- of an error for an invalid add, rather than calling error.
-
-Fri Apr 18 11:24:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * version.c: Change version number to 1.9.9.
-
- * version.c: Version 1.9.8.
-
- * commit.c (struct find_data): Add field force.
- (find_fileproc, commit): Use it instead of force_ci to decide
- whether to send files to server.
- (commit): Set it if either -f or -r is specified.
- * sanity.sh (basica): Add tests basica-8a0, basica-8a1, and
- basica-8a2; tests for above fix.
-
-Wed Apr 16 11:50:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * zlib.c: Remove paragraph with Free Software Foundation address.
- See 2 Jan 1997 entry in ../ChangeLog for rationale.
-
-Tue Apr 15 00:36:23 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * update.c (patch_file_write): Always assign to final_nl, so that
- it ends up reflecting whether the data from the last call had a
- newline, not whether the data from any of the calls ended in a
- newline. Doesn't matter with the current RCS_checkout
- implementation, but it will if RCS_checkout is changed to pass
- less than the entire file.
-
- * rcs.c (RCS_cmp_file): Change NULL to RUN_TTY in passing sout to
- RCS_checkout, for clarity.
-
- * import.c (update_rcs_file): Remove unused variable ierrno.
-
- * add.c, checkout.c, commit.c, diff.c, edit.c, import.c,
- history.c, log.c, main.c, patch.c, release.c, remove.c, rtag.c,
- status.c, tag.c, update.c, watch.c: Pass "+" to all calls to
- getopt. This ensures that we maintain existing behavior even with
- glibc2.
-
- * filesubr.c (fopen_case): Don't set *PATHP if we return an
- error. Since the 9 Apr 1997 change, the behavior has been to
- sometimes set it and sometimes not.
- * rcs.c (RCS_parse): Adjust callers to not free it. Without this
- change, they could call free() on an uninitialized variable.
-
- * checkout.c (checkout): Add comment about export -k.
-
- * root.c (check_root_consistent): Add comment about wording of
- message.
-
-Mon Apr 14 11:51:49 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * client.c (call_in_directory): If rdirp reaches the end of
- reposdirname, then just set it to NULL. If server does not create
- directories one at a time, give a warning.
- * sanity.sh (modules3): Enable tests modules3-8 through
- modules3-11 for remote; tests for above fix.
-
- * client.c (call_in_directory): Don't set short_pathname to
- pathname for a while; just use pathname itself (cleans up a relic
- of the old "Repository" (not "Directory") code). Add comment
- explaining short_pathname.
-
-Sun Apr 13 18:07:50 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * rcs.c (RCS_checkout): Add pfn and callerdat parameters. Change
- all callers. Move setting of expand after retrieval of file
- data.
- (struct cmp_file_data): Define.
- (RCS_cmp_file): New function.
- (cmp_file_buffer): New static function.
- * rcs.h (RCSCHECKOUTPROC): Define type.
- (RCS_checkout): Update declaration.
- (RCS_cmp_file): Define.
- * diff.c (diff_file_nodiff): Call RCS_cmp_file rather than
- RCS_checkout and xcmp.
- * import.c (update_rcs_file): Likewise.
- * no_diff.c (No_Difference): Likewise.
- * update.c (struct patch_file_data): Define.
- (patch_file): Just return if noexec, or if binary file. Pass
- patch_file_write to RCS_checkout. Don't check for newlines or
- compute checksums here. Stat RCS file to set modes.
- (patch_file_write): New static function.
-
- * update.c (patch_file): Checkout directly to file2, rather than
- to finfo->file followed by rename. Remove check for whether
- result of checkout is readable; that was for an old, obsolete,
- form of death support.
-
-Sun Apr 13 13:16:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * checkout.c (build_one_dir): New function.
- (struct dir_to_build): New structure.
- (build_dirs_and_chir): Rewritten to accept a linked list of struct
- dir_to_build rather than the silly string processing we had been
- doing before.
- (checkout_proc): Rewrite code that calls build_dirs_and_chdir
- accordingly.
- * sanity.sh: Enable tests modules3-10 and modules3-11 for local CVS;
- tests for above fix.
-
- * rcs.h (RCS_CO): Removed; no longer used.
-
-Sun Apr 13 00:04:34 1997 Ian Lance Taylor <ian@cygnus.com>
-
- Expand RCS keywords internally; never call co:
- * rcs.h (struct rcsversnode): Add state field.
- * rcs.c (kflags): Move out of RCS_check_kflag, and make file
- static.
- (enum kflag): Define.
- (RCS_reparsercsfile): Always save lock information. Save state in
- new state field, rather than other field.
- (struct rcs_keyword): Define.
- (keywords): New static variable.
- (enum keyword): Define.
- (printable_date, escape_keyword_value): New static functions.
- (expand_keywords): New static function.
- (RCS_checkout): Call expand_keywords. Don't call
- RCS_exec_checkout.
- (RCS_deltas): Add log and loglen parameters. Change all callers.
- * log.c (log_version_requested): Use new state field.
- (log_version): Likewise.
- * cvs.h (RCS_exec_checkout): Don't declare.
- * rcscmds.c (RCS_exec_checkout): Remove.
-
-Sat Apr 12 17:32:59 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * sanity.sh (modules3): Remove second-dir at end of tests.
- (sticky): Correct removal of directories at end of tests.
-
- * sanity.sh (keyword): New tests for RCS keyword expansion.
-
-Sat Apr 12 16:47:13 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh (basicb): New tests basicb-1b, basicb-1c, basicb-9b,
- basic-9c test current build_dirs_and_chdir behavior.
-
-Fri Apr 11 23:54:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh (modules3): New tests modules3-7* test for ability to
- supply a path in -d in modules. Similar to modules3-8 through
- modules3-11 except because the nesting is different, these ones
- work.
-
-Thu Apr 10 00:14:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh (modules3): New tests modules3-12 through modules3-15
- test use of a module name which contains a slash.
-
- * sanity.sh (basicb): New tests basicb-14 to basicb-20 test use of
- co -d with two or more arguments.
-
- * rcscmds.c: Refer to doc/RCSFILES in comment.
-
-Wed Apr 9 09:49:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh (basicb): New tests basicb-11 through basicb-13 test
- ability to specify several directory levels in co -d (commented
- out).
-
- * filesubr.c (fopen_case): If CVS_OPENDIR gives an
- existence_error, return it to the caller instead of giving a fatal
- error.
-
- * client.c (update_entries): Fix typo in call to error (1 -> errno).
-
-Tue Apr 8 23:02:22 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * error.h, error.c: Test for #ifdef __STDC__, not #if __STDC__.
- This is consistent with other parts of CVS; it means that the
- declaration for fperror will match the definition even if __STDC__
- is defined to 0 as the SunPro 4.0 compiler does. Reported by
- Richard Smith <rjsmith@cisco.com>.
-
-2 Apr 1997 Jim Kingdon
-
- * entries.c (ParseTag): Add "break;" after "default:" to avoid
- error from Visual C++.
-
-Wed Apr 2 12:06:44 1997 Vince Del Vecchio <vdelvecc@spd.analog.com>
- and Jim Kingdon
-
- * client.c: In reporting errors from socket calls, use
- SOCK_STRERROR and SOCK_ERRNO since strerror(errno) doesn't work
- for Win32.
-
-Tue Apr 8 10:45:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh (modules3): Add tests modules3-8 to modules3-11, to
- test for ability to supply a path to -d in modules. Mostly
- commented out as CVS is buggy in this area.
-
-Mon Apr 7 12:41:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * add.c (add): Add comment about SEND_NO_CONTENTS.
-
-Sun Apr 6 21:46:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * update.c (update): Add comment about noexec and SEND_NO_CONTENTS.
-
-Sun Apr 6 17:34:08 1997 Robert Bihlmeyer <robbe@orcus.priv.at>
-
- * Pass +f not f to getopt_long to prevent options from being
- permuted with glibc 2.0.1.
-
-Sun Mar 30 00:07:05 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * cvs.h (struct vers_ts): Adjust comment regarding ts_user.
- * server.c (serve_is_modified): New function. Set entries to show
- that the file is modified but we don't know the contents.
- * server.c (requests): Add "Is-modified" request.
- * vers_ts.c (time_stamp_server): If the timestamp in entdata is
- "M" or "D", just copy that over into ts_user.
- * vers_ts.c (Version_TS): If timestamp is "D", use the entries
- line for the sole purpose of passing it to time_stamp_server.
- * no_diff.c (No_Difference): If ts_user is "M", conclude the files
- are different.
- * client.h, client.c (send_files): Replace arguments build_dirs
- and force with argument flags. Add flag SEND_NO_CONTENTS and add
- to struct send_data.
- (send_fileproc): If no_contents, then send Is-modified instead of
- Modified.
- * add.c, admin.c, client.c, commit.c, diff.c, edit.c, log.c,
- rcs.c, remove.c, status.c, tag.c, update.c, watch.c: Change all
- send_files callers.
-
-Fri Mar 28 22:32:25 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * server.c (requests): Change "Repository" to rq_optional. I'm
- not sure whether I overlooked this when I removed support for
- Repository, or whether I was thinking that servers would need to
- support it anyway, for CVS 1.5 to 1.9 clients, but making it
- optional doesn't prevent the server from supporting it and it
- seems silly for the client to complain about absence of a request
- that it never will use.
-
-Fri Mar 28 10:06:59 1997 Steven Miller <Miller@wingra.com>
-
- * entries.c (Subdirs_Known): Don't create Entries.Log if noexec.
-
-Thu Mar 27 18:14:12 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * sanity.sh (death2): Remove commented out test death2-21. It
- would now pass, but it duplicates the new test sticky-11.
-
-Thu Mar 27 10:21:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh (dotest_internal): Write test output to logfile even
- if test succeeds. This was the behavior prior to 30 Sep 1996.
- See the comment for rationale.
-
-Tue Mar 25 13:26:52 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * cvs.h, entries.c (WriteTag): Add arguments nonbranch,
- update_dir, and repository. Move the server_set_sticky call from
- callers to here.
- * cvs.h, create_adm.c (Create_Admin): New argument nonbranch.
- * cvs.h, entries.c (ParseTag): Add argument nonbranchp.
- * cvs.h (struct stickydirtag): Add field nonbranch.
- * entries.c (Entries_Open): Set it.
- * cvs.h (Vers_TS): Add field nonbranch.
- * vers_ts.c (Version_TS): Copy it from struct stickydirtag.
- * server.c, server.h (server_set_sticky): Add argument nonbranch.
- * add.c, client.c, checkout.c, modules.c, update.c, create_adm.c,
- commit.c: Update callers.
- * add.c (add): If nonbranch, don't add the file on that "branch".
- * commit.c (write_dirnonbranch): New variable.
- (commit_fileproc, commit): Set it.
- (commit_dirleaveproc): Pass it to WriteTag.
- * update.c (rewrite_tag, nonbranch): New variables.
- (update, update_dirent_proc, update_fileproc): Set them.
- (update_filesdoneproc): If rewrite_tag, call WriteTag.
- * sanity.sh (sticky): New tests, test for above fix.
-
- * version.c: Change version number to 1.9.7.
-
- * version.c: Version 1.9.6.
-
-Mon Mar 24 13:02:04 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * entries.c (ParseTag): Add comment about unrecognized characters
- in CVS/Tag file.
-
- * classify.c (Classify_File): Add comment about how specifying a
- tag (bogusly?) suppresses certain messages.
-
-Fri Mar 21 13:37:46 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * rcs.h (struct rcsnode): Add comment about case of PATH.
- * rcs.c (RCS_parse): If ign_case, then try opening the file with
- fopen_case.
- * ignore.c (ign_case): Adjust comment.
- * cvs.h, filesubr.c (cvs_casecmp, fopen_case): New functions.
-
-20 Mar 1997 Jim Kingdon
-
- * client.c (send_repository): When sending Directory request,
- send any ISDIRSEP character as '/'. Fixes
- "cvs log foo\bar\baz.c" on NT & friends.
-
- * client.c (send_file_names): Don't try to read Entries file if
- CVSADM directory does not exist. Fixes fairly serious regression
- (warning on all fresh checkouts) introduced by 1997-01-08 change.
-
-Tue Mar 18 13:03:33 1997 Jim Meyering <meyering@totoro.cyclic.com>
-
- * sanity.sh (RCSINIT): Define to be empty and export, to hide any
- existing value that might cause spurious failures.
-
- * Makefile.in: (install): Depend on installdirs.
- Remove `CYGNUS LOCAL' comment saying not to.
-
-Tue Mar 18 09:36:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * recurse.c (struct recursion_frame): Reindent.
- (do_dir_proc): Print message if we try to recurse into a CVSADM
- directory.
- * sanity.sh (basicb): New test basicb-4a tests for above fix.
-
-Sun Mar 16 10:18:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh (death2): Replace regexp matching temporary file name
- with new variable ${tempname}. For most of the tests this is a
- cosmetic change, but death2-diff-6 had been missing _ which caused
- it to fail on Solaris (at least sometimes).
-
- * sanity.sh (modes): Don't use export -n; it doesn't seem
- to be sufficiently portable.
-
- * version.c: Change version number to 1.9.5.
-
- * version.c: Version 1.9.4.
-
- * rcscmds.c (RCS_checkin): Preserve the mode of the rcsfile.
- RCS_CI usually, but not always, does this for us.
- * commit.c (fix_rcs_modes): Replace algorithm with a more
- CVSUMASK-friendly one.
- * sanity.sh (modes): Update tests modes-5, modes-7, modes-10, and
- modes-15 so they test that CVSUMASK is honored.
-
-Sun Mar 16 10:18:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh (modes): New tests modes-7a and modes-7b test behavior
- if one manually changes the modes in the repository.
-
- * server.c (server): Revise code which checks for errors creating
- temporary directory. This won't solve the intermittent
- can't create temporary directory
- Unknown error -1
- but it will mean (a) the right message based on errno gets
- printed, instead of "unknown error -1", and (b) the message says
- that it happened in chmod instead of mkdir_p.
-
-Sat Mar 15 16:47:12 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh (modes): New tests. Note that (for now) these are
- just testing how CVS already behaves; I want to record that before
- I move on to changing CVS's behavior with modes of RCS files.
-
-13 Mar 1997 Jim Kingdon
-
- * subr.c (line2argv): Change argv_allocated from size_t to int.
-
-Wed Mar 12 22:16:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * add.c (add_directory): If repository has an extraneous "."
- directory at the end, strip it off. This fixes a bug which was
- introduced when strip_path was nuked (this fix is much more
- limited in scope than strip_path was; I _think_ that is a good
- thing).
- (add): Likewise, for client.
- (combine_dir): New function, helps with above.
- * sanity.sh (modules3): Reenable tests for this behavior.
- (basica-0b, basicb-0e): Adjust test to reflect "foo/bar" instead
- of "foo/./bar" in message. As with the rest of this, I believe
- this is just restoring the behavior prior to the strip_path nuking
- (I tried it with CVS 1.9).
-
-Sun Mar 9 10:06:29 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * root.c (parse_cvsroot), server.c (serve_root, serve_init):
- If CVSroot_directory is not an absolute pathname, give a fatal error.
- * sanity.sh (crerepos): New tests crerepos-6* test for above fixes.
-
-Sat Mar 8 22:06:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- This cleans up the last known code which can overflow its buffers
- (except the Mac client). I've skimmed through much of CVS looking
- for other such places; but I didn't read everything. If I missed
- any please report it to bug-cvs.
- * logmsg.c (logfile_write, title_proc): Realloc str_list as
- needed; don't assume MAXLISTLEN is enough.
- * cvs.h (MAXLISTLEN, MAXFILEPERDIR): Removed; no longer used.
- * add.c, myndbm.c, parseinfo.c, update.c: Nuke MAXLINELEN limit.
- * parseinfo.c, update.c, mkmodules.c: Check for errors reading file.
- * cvs.h (MAXLINELEN): Removed; no longer used.
- * logmsg (MAXHOSTNAMELEN): Removed; not used.
- * main.c (cmd_synonyms): Allocate based on fullname, nick1, and
- nick2, just in case someone makes those big enough so that 100
- bytes is not enough.
- (Make_Date): Use MAXDATELEN rather than our own fixed size.
- * mkmodules.c (mkmodules): Nuke arbitrary limit on line length.
- * rcs.c (ALLOCINCR): Remove; not used.
- (RCS_check_kflag): Add comment concerning karg size.
- * run.c: Allocate run_prog to the needed size, rather than
- allocating a fixed size buffer.
-
-Fri Mar 7 22:39:08 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * logmsg.c (logfile_write): Allocate prog to needed length rather
- than assuming MAXPROGLEN is enough.
- * cvs.h (MAXPROGLEN): Removed; no longer used.
- * subr.c (MIN_INCR): Update comment to reflect MAXPROGLEN's demise.
-
- * subr.c (free_names): Fix comment: this function is not used to
- free memory allocated by Find_Names (at least it hasn't for a long
- time).
- * subr.c, cvs.h (line2argv): Change calling convention so that we
- allocate argv array rather than the caller. The previous one had
- no way of checking whether we overflowed the passed-in buffer.
- * subr.c (free_names): Free the argv array too.
- * modules.c (do_module, cat_module): Update callers.
-
-Thu Mar 6 12:44:42 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * import.c: Allocate vhead and vbranch dynamically; removes
- arbitrary limit.
- * history.c: Likewise (since_rev, since_tag, backto, rec_types).
- * ignore.c: Likewise (line). Also check for errors from getline
- and add 'copyright' notice to top of file.
- * wrapper.c (wrap_add_file): Likewise (line). Also check for
- errors from various calls and add 'copyright' notice to top of file.
-
-Tue Mar 4 17:39:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * client.c (update_entries): Add comment about "move away <file>"
- message.
-
-Mon Mar 3 21:51:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh (basicb): Clean up topfile,v at end of test. Fixes
- failure in modules-155b.
-
-Sun Mar 2 18:11:09 1997 Dan Wilder <dan@gasboy.com>
- and Jim Kingdon
-
- * admin.c (admin): Arrange to perform recursion if "cvs admin"
- is passed only options.
-
-Sun Mar 2 18:11:09 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh (basicb): New tests basicb-0* test for files at top
- level.
-
- * error.c (error): Add newline to "out of memory" message. I think
- that its omission probably could cause the message to be lost in
- the bowels of server.c and never passed to the user.
-
- * client.c (start_rsh_server): Add comment about "remsh" vs. "rsh".
-
- * cvs.h: Move copyright notice to top of file.
-
-Sun Mar 2 13:44:36 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * sanity.sh: Use -n when testing whether rsh works.
-
- * server.c (serve_root): Free path.
-
-Sun Mar 2 13:12:46 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- The following are things that I noticed in the process of trying
- to track down:
- can't create temporary directory
- Unknown error -1
- FAIL: test 28
- from nightly testing. I'm not sure that either item explains that
- message however.
- * server.c (server): Allocate pending_error_text;
- print_pending_error will try to free it so
- pending_error_text = "foo"
- won't work.
- (mkdir_p): Don't assume that isdir will leave errno unmolested.
-
-Thu Feb 27 15:29:58 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * remove.c (cvsremove): When forcing removal in client mode, use
- start_recursion rather than calling CVS_UNLINK on each argument.
- (remove_force_fileproc): New static function.
- * sanity.sh (deep): Add tests deep-rm7 through deep-rm10 for above
- patch.
-
- * sanity.sh (death): Enable death-76a0 and death-76a1 tests for
- remote, since they now work.
-
-Wed Feb 26 16:13:26 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * client.c (add_prune_candidate): Skip adding this directory if
- it is the same as the first directory already on the list.
-
-Mon Feb 24 21:36:43 1997 Noel Cragg <noel@gargle.rain.org>
-
- * main.c (lookup_command_attribute): Add the "init" command to the
- list of commands that don't use the current working directory.
-
-Sun Feb 23 09:54:49 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh (devcom3): Clean up at end of test.
-
- * sanity.sh (basicb): Add commented out test basicb-8a0, for
- whether CVS can print an error on bad numeric revision to diff.
- Commented out until we get around to fixing CVS.
- * diff.c (diff_file_nodiff): Add comment about this case.
-
- * fileattr.c (fileattr_read): If a filename is duplicated,
- continue to ignore subsequent lines but free the node so that we
- don't leak memory.
- * sanity.sh (devcom3): New tests devcom3-8 and devcom3-9 test for
- behavior on duplicated filenames.
-
- * fileattr.h: Add comment about unrecognized ENT-TYPE and order of
- lines in fileattr file.
- * fileattr.c (struct unrecog, unrecog_head): New variables, to
- record unrecognized lines.
- (fileattr_startdir): Assert that unrecog_head == NULL.
- (fileattr_read): Record unrecognized lines in unrecog_head linked
- list rather than ignoring them.
- (fileattr_write): Also write out unrecognized lines, if any.
- * sanity.sh (devcom3): New tests, test for above fix.
-
- * fileattr.h (fileattr_modify): Fix example in comment.
-
-Sat Feb 22 08:30:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh: Add variable username.
- (basica rdiff multibranch log log2): Use it instead of our own
- (inconsistent) ways of matching an author name.
-
- * filesubr.c, root.c, rtag.c, server.c, subr.c, update.c,
- wrapper.c: Nuke PATH_MAX.
- * cvs.h, wrapper.c (wrap_fromcvs_process_file): Now returns void
- (return value had been unused).
- * cvs.h: Adjust comment to reflect the fact that PATH_MAX is
- gone, at least from src/*.c (except safe_location, as noted).
-
-22 Feb 1997 patch by Tom Hageman <tom@basil.icce.rug.nl> (4 Jun 1996)
- updated and commented by Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * update.c (checkout_file): Call unlink_file_dir on backup, not
- unlink_file.
-
-Fri Feb 21 16:40:03 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * Makefile.in (DISTFILES): Remove NOTES.
-
- * NOTES: Removed. bcopy->memcpy is done. "static buffers" I
- assume refers to what is covered by reentrancy text in HACKING.
- Obstack idea moved to comment in hash.c (at nodecache). Checking
- system calls for error returns largely done, and isn't a very
- helpful suggestion unless you know where the bogus calls are
- anyway. Sizing limits--we're in the progress of removing them
- (assuming it meant things like PATH_MAX and earlier, already
- nuked, limits). Removed various items about changes which were
- done a long time ago (I realize that the ChangeLog's probably
- aren't reliable that far back, but I'm not convinced anyone cares
- anymore). CONFIRM_DIRECTORY_ADDS: I assume this is a
- reference to the #if 0'd code in add_directory which asks for
- confirmation--a better way of making it harder to accidentally add
- directories would be to have to add and commit directories like
- for files. I don't know what FORCE_MESSAGE_ON_ADD meant.
-
- * rcs.c (RCS_getrevtime): Fix documentation (in particular, the
- size of the array that DATE must point to, but many other things
- too).
- * patch.c, recurse.c, release.c, remove.c, repos.c: Nuke PATH_MAX.
- (patch_fileproc): Use MAXDATELEN not hardcoded 50.
-
-Sun Feb 16 12:00:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * client.c (client_process_import_file): New variable fullname;
- pass it to send_modified. This finishes the job of untangling the
- old short_pathname variable into update_dir vs. fullname.
-
- * client.c (client_process_import_file): Nuke first_time. If
- toplevel_repos were ever NULL here, the code would dump core in
- strncmp a few lines down. And client_import_setup ensures
- toplevel_repos is not NULL.
-
-Sun Feb 16 08:16:48 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * client.c (client_process_import_file): Rename short_pathname to
- update_dir (to reflect its function) and make sure that it doesn't
- point to uninitialized memory if repository and toplevel_repos
- contain the same string.
-
-Sun Feb 16 08:16:48 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * client.c (start_rsh_server): Nuke comment about weirdnesses with
- pre-1.5 versions of CVS and .bashrc/.cshrc. The remote protocol
- is interoperable only back to 1.5, and people who need to know are
- unlikely to see this comment anyway.
-
-Sun Dec 15 13:12:30 1996 Michael Douglass <mikedoug@texas.net>
- and Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * main.c (cmds): Added an entry for new logout command.
- (cmd_usage): Added an entry for new logout command.
- (lookup_command_attribute): Added 'logout' to list of commands
- that set need_to_crate_root to 1.
- * login.c, cvs.h (logout): New command for removing entries from
- the .cvspass file.
- (logout_usage): Usage information on the logout command.
-
-Wed Feb 12 11:19:42 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * client.c (struct send_data): Fix indentation.
-
-Wed Feb 12 08:48:04 1997 Greg A. Woods <woods@most.weird.com>
-
- * mkmodules.c (loginfo_contents): add missing comma in
- initializer statement (caused syntax error on SunOS-4).
-
-Tue Feb 11 21:14:28 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * commit.c (find_fileproc): If force_ci is set, set the status to
- T_MODIFIED even if the file hasn't changed.
- (commit): Pass force_ci to send_files as new force argument.
- * client.c (struct send_data): Define.
- (send_fileproc): The callerdat parameter now points to a send_data
- struct. If force is set, always call send_modified.
- (send_dirent_proc): The callerdat parameter now points to a
- send_data struct.
- (send_files): Add force parameter. Change all callers. Set up a
- send_data struct and pass it to start_recursion as callerdat.
- * client.h (send_files): Update declaration.
- * sanity.sh (basica): Add a simple test for the above patch.
-
-Sun Feb 9 12:58:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * tag.c (cvstag), rtag.c (rtag): Pass -f to server if specified in
- the client. I haven't tried to come up with a test case because
- the fix seems obvious.
-
- * import.c (add_rcs_file): Change size of altdate1 and altdate2 to
- MAXDATELEN.
- * cvs.h (MAXDATELEN): Fix comments; describe what this is for.
-
- * diff.c (diff_usage): Document --ifdef and try to briefly say
- what "rcsdiff-options" means.
-
- * update.c (update): If update had a nonzero status and we haven't
- yet tried to fetch unpatchable files, go ahead and try it again.
- The previous behavior was to quit, which meant that updates would
- keep failing until you hacked around the problem. Patch and bug
- report by Ian; comment, ChangeLog entry, and willingness to take
- the flak if checking it is premature by Jim.
-
- * server.c (alloc_pending): New function.
- * server.c: Call it. Fixes places where we had neglected to
- check for NULL return from malloc.
-
- * sanity.sh (binwrap): Add test binwrap-0, tests for import.c fix
- below.
-
-Sun, 9 Feb 1997 (submitted 19 Jul 1996) John Polstra <jdp@polstra.com>
-
- * import.c (import): Give error if the same tag is specified more
- than once. The previous behavior was to write an RCS file which
- had the same tag listed twice, once pointing to each revision,
- which is not legal.
-
-Sun Feb 9 12:37:09 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * checkin.c (Checkin): Use cvs_output to print message (should
- make out of order bugs no worse, as it merely substitues a
- protocol_pipe vs. stderr_pipe race instead of a stdout_pipe
- vs. stderr_pipe race). Add comment about stdout vs. stderr.
-
-Fri Feb 7 08:29:52 1997 Josef Nelissen <josef.nelissen@munich.ixos.de>
-
- * server.c (check_command_legal_p): Don't use ANSI-style definition.
-
-Thu Feb 6 10:55:37 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * patch.c (patch): Give a fatal error for -V option (see comment
- for rationale).
-
- * diff.c (diff): Also send "options" to server. Pretty much the
- patch submitted independently by josef.nelissen@munich.ixos.de and
- Ronald Khoo <ronald@demon.net>.
-
-Wed Feb 5 18:57:14 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * modules.c (do_module): Fix typo in 30 Jan 97 PATH_MAX nuking
- (free -> free_cwd). Testsuite test 151 gets credit for catching
- this one.
-
-Mon Feb 3 16:14:54 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * main.c (lookup_command_attribute): Don't use an ANSI prototype
- when defining the function.
-
-Fri Jan 31 12:49:02 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * modules.c (do_module): Actually goto found if is_found is set
- (fixes thinko in PATH_MAX nuking of 30 Jan 97).
-
-Fri Jan 31 12:49:02 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh: Add modules3 and big to list of tests to run
- by default; they were omitted by accident.
-
-Thu Jan 30 11:46:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * logmsg.c, main.c, mkmodules.c, modules.c, parseinfo.c, patch.c:
- Nuke more PATH_MAX.
-
- * server.c (server_updated): After we send Created or
- Update-existing for a file, mark it as unchanged, in case we
- process it again.
- * sanity.sh (modules3): New tests, test for above fix.
-
- * logmsg.c (do_verify): Error return from fopen is NULL, not -1.
- Pass errno to error().
-
- * login.c [_CRAY]: Don't declare getpass.
-
-Mon Jan 27 17:25:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * import.c (process_import_file): Fix freeing of rcs (Don't free
- it before we are done using it, and don't free it twice).
-
- * modules.c (cat_module): Allocate line right before we use
- it. The previous code was wrong because the length of the
- s_h->rest changes between the time we allocate line and the time we
- sprintf s_h->rest into it.
-
-Sun Jan 26 21:58:16 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * expand_path.c (expand_path): Revise to call expand_string as
- needed. Nuke PATH_MAX.
- * find_names.c (find_dirs): Likewise.
- * import.c, lock.c: Nuke more PATH_MAX.
-
- * server.c (mkdir_p): Set retval to 0 at start of function.
- Previously it had been uninitialized for some cases. Thanks are
- due to nightly testing for catching this one.
-
-Sat Jan 25 21:34:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * subr.c, cvs.h (expand_string): New function.
- * rcs.c (getrcskey, getrcsrev): Call it. This greatly reduces the
- number of calls to realloc if there is a very large file in the
- RCS file. Credit goes to Mike Heath <mike@pswtech.com> for
- pointing out the problem and the basic solution (MIN_INCR,
- MAX_INCR); I adapted it into the separate function expand_string.
- * sanity.sh (big): New test helps insure this hasn't broken
- anything obvious.
-
-Wed Jan 22 10:06:13 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * status.c (status_fileproc): Change message which is printed for
- T_MODIFIED and ts_conflict set, so that it doesn't say "unresolved
- confict". This message occurs whether the conflict is resolved or
- not.
- * sanity.sh (conflicts): Add tests conflicts-status-* to test
- output of "cvs status" in the context of conflicts. Tests for
- above fix.
-
- * rtag.c (rtag): Send -n if run_module_prog is NOT true.
-
-Thu Jan 16 00:06:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * version.c: Change version number to 1.9.3.
-
- * version.c: Version 1.9.2.
-
-Wed Jan 15 09:14:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * client.c (call_in_directory): Take code that creates CVSADM at
- top level, move it before the CVS_CHDIR (dir_name) call, and do it
- regardless of whether dir_name is ".". Pass "." not dir_name to
- Create_Admin (when the code was written they were always the
- same). Don't add reposdirname to the repository we pass to
- Create_Admin (when the code was written, I think reposdirname
- probably would always be "."). Don't create CVSADM if
- reposdirname_absolute.
- * sanity.sh (basicb): Enable tests basicb-1a and basicb-9a for
- remote; tests for above fix.
- (basic1): Do entire test within a "1" directory to deal with
- creation of CVS directories at top level. Support --keep.
- (conflicts): In test conflicts-136, only update first-dir.
- (basica): Uncomment the part that tests "cvs co -l .". That tests
- the existing functionality which I might have (but hopefully did not)
- perturbed with the call_in_directory changes.
-
-Mon Jan 13 11:04:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * server.c (check_command_legal_p): Do not call error (1, ...)
- here; that will always cause a protocol violation by shutting down
- the connection prematurely. Remove croak_on_illegal arg.
- (do_cvs_command): Move call to check_command_legal_p until after
- the call to print_pending_error. Print the error message ourself.
-
- * mkmodules.c (filelist): Add readers and writers. Add comment
- about why passwd is not included. Add comment about meaning of
- NULL contents field.
-
-Fri Jan 10 13:23:09 1997 Norbert Kiesel <nk@col.sw-ley.de>
-
- * release.c (release): Initialize delete_flag before reading it
- (found by running purify)
-
- * logmsg.c (do_verify): Fix reading unallocated memory (found by
- running purify)
-
-Thu Jan 9 16:32:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * checkout.c (build_dirs_and_chdir): Partially revert 3 Jan
- change--move call to Subdir_Register back above the CVS_CHDIR call
- (we need to register in the old, not the new, directory). Instead
- of calling CVS_MKDIR and ignoring errors, call mkdir_if_needed;
- this is an effort to catch errors there rather than catching them
- in the CVS_CHDIR. This makes test 27-add-add in sanity.sh work
- again.
-
- * find_names.c (Find_Directories): Remove code inside
- #ifdef ATTIC_DIR_SUPPORT and replace it with a comment explaining
- why we don't look in the attic. ATTIC_DIR_SUPPORT was never defined.
-
- * find_names.c (find_dirs): Add comment about tmp being unset.
-
- * commit.c (checkaddfile): Report errors with errno and specific
- error messages.
-
- * rcs.c, commit.c, create_adm.c, entries.c, find_names.c,
- ignore.c, history.c: Nuke PATH_MAX arbitrary limits.
-
-Wed Jan 8 23:07:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * add.c (add): Reindent a portion which needed it.
-
-1997-01-08 Jim Kingdon
-
- * client.c (send_file_names): When looking name up in Entries,
- call Entries_Open and Entries_Close. This has two effects:
- (1) we look at Entries.Log, and (2) we don't skip 'D' entries,
- both of which are needed to make us get the right (command
- line) name for a directory we are adding.
-
-Wed Jan 8 14:50:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * Makefile.in, cvs.h, hash.h, myndbm.h, rcs.h: Remove CVSid; we
- decided to get rid of these some time ago.
-
-Tue Jan 7 12:56:10 1997 Karl Fogel <kfogel@ynu38.ynu.edu.cn>
-
- * root.c (check_root_consistent): new func, compares below new
- global var with CVSroot_directory, assuming both set.
- (set_local_cvsroot): use above new func for security check.
- (parse_cvsroot): same.
- But do all of above only #ifdef AUTH_SERVER_SUPPORT.
-
- * server.c: (Pserver_Repos): new global var, init to NULL.
- (pserver_authenticate_connection): set above new global.
- (check_repository_password): be a good scout and use
- CVSROOTADM and CVSROOTADM_PASSWD, now that they are the standard.
- Make sure all of above is in #ifdef AUTH_SERVER_SUPPORT.
- (check_command_legal_p): wrap most of body in #ifdef
- AUTH_SERVER_SUPPORT.
- Everywhere: wrap all references to CVS_Username in #ifdef
- AUTH_SERVER_SUPPORT.
-
- * cvs.h (Pserver_Repos): new var, used in consistency [security]
- check. Defined only #ifdef AUTH_SERVER_SUPPORT.
- (CVSROOTADM_PASSWD): new #define, trying to get with the program.
-
-Fri Jan 3 18:10:39 1997 Ian Lance Taylor <ian@cygnus.com>
-
- * checkout.c (build_dirs_and_chdir): Move call to Subdir_Register
- until after we know that the directory exists.
-
-Thu Jan 2 13:30:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * Makefile.in, cvsbug.sh, edit.c, edit.h, error.c, error.h,
- fileattr.c, fileattr.h, filesubr.c, run.c, update.h, watch.c,
- watch.h: Remove "675" paragraph; see ../ChangeLog for rationale.
-
-Thu Jan 2 12:27:46 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * sanity.sh (info): New test info-cleanup-verifymsg gets rid of
- verifymsg when we are done with it.
-
- * sanity.sh (basicb): Skip tests basicb-1a and basicb-9a for remote.
- * sanity.sh (modules-155a4): It is OK if a CVS directory exists.
- * sanity.sh (ignore): Do everything inside a "1" directory. The
- change to create CVS directories at top-level causes messages such as
- "? home" otherwise. In test 191, specify -I CVS so that new CVS
- directory is ignored.
- * sanity.sh (crerepos): Manually remove CVS directory which had not
- existed before.
-
-Thu Jan 2 09:06:20 1997 Karl Fogel <kfogel@ynu38.ynu.edu.cn>
-
- * server.c: Changes for pserver read-only repository access:
- (check_command_legal_p): new func. Right now, just checks if
- repository modification is permitted, and that only if pserver is
- active.
- (do_cvs_command): take new parameter `cmd_name', a string. All
- callers changed. Pass it on to new func check_command_legal_p()
- before executing the command.
- (CVS_Username): new global, init to NULL. Used by
- check_command_legal_p(), set in check_password().
- (check_password): set above new global CVS_Username; reorganized a
- bit to facilitate this.
- (check_repository_password): give *host_user_ptr permanent
- storage iff success.
-
- * main.c: Changes for pserver read-only repository access:
- (lookup_command_attribute): new func.
- (main): use new func lookup_command_attribute() to establish if
- CVS_CMD_IGNORE_ADMROOT and CVS_CMD_USES_WORK_DIR.
-
- * cvs.h: Changes for pserver read-only repository access:
- (CVSROOTADM_READERS, CVSROOTADM_WRITERS): new #defines.
- Prototype lookup_command_attribute().
- (CVS_CMD_IGNORE_ADMROOT, CVS_CMD_USES_WORK_DIR,
- CVS_CMD_MODIFIES_REPOSITORY): new #defines for
- lookup_command_attribute() and its callers.
-
-Wed Jan 1 19:50:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * options.h.in: Reword comment for TMPDIR_DFLT to make it clear
- that this isn't specific to the pserver server.
-
- * modules.c (do_module): Give an error message if one tries to
- specify -a together with another option.
- * sanity.sh (modules2): New tests modules2-a* test for above fix.
-
- * sanity.sh (devcom): Add tests devcom-a-nonexist and
- devcom-t-nonexist for "cvs watchers" on nonexistent argument.
-
-1997-01-01 Fred Fish <fnf@ninemoons.com>
-
- * run.c (piped_child, filter_stream_through_program): Actually
- install these HAVE_VFORK patches that got missed.
- (There was a log entry for these changes for 29 Nov 1996 but it
- seems I accidentally forgot to actually check them in -kingdon).
-
-Wed Jan 1 18:32:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
-
- * Makefile.in: Add ChangeLog-96.
- * ChangeLog-96: New file, contains former contents of ChangeLog.
- * ChangeLog: Now just contains 1997 changes.
-
-
-For older changes see ChangeLog-96.
+For older changes see ChangeLog-97.
diff --git a/contrib/cvs/src/ChangeLog-97 b/contrib/cvs/src/ChangeLog-97
new file mode 100644
index 0000000..ce7180b
--- /dev/null
+++ b/contrib/cvs/src/ChangeLog-97
@@ -0,0 +1,3249 @@
+1997-12-30 enami tsugutomo <enami@but-b.or.jp>
+
+ * rcs.c (RCS_checkin): Use gmtime() instead of localtime()
+ (restores behavior from RCS 5.x which was broken with RCS library
+ -kingdon).
+
+Mon Dec 29 12:53:00 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * modules.c (do_module): Check for a request for a file within a
+ module which is not a directory.
+ * sanity.sh (modules): Add test 149b1 for above patch.
+
+ * client.c (start_tcp_server): Remove useless assignment, left
+ behind by Dec 15 patch.
+
+Sat Dec 27 17:41:11 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c, options.h.in, history.c, import.c, main.c, rcs.c,
+ update.c: Remove !HAVE_RCS5 code. It had bit-rotted a while ago,
+ and more to the point is obsolete with the RCS library.
+
+27 Dec 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * zlib.c, server.h (gunzip_and_write): New function.
+ * client.c (update_entries): Call it instead of a gunzip subprocess.
+ * zlib.c, server.h (read_and_gzip): New function.
+ * client.c (send_modified): Call it instead of a gzip subprocess.
+
+Sat Dec 27 13:07:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ Decrease RCS_deltas memory usage to what we need (approximately
+ the size of the file we are patching plus the size of the largest
+ patch). Previously memory usage had been approximately the size
+ of the RCS file because we never freed lines until the end.
+ * rcs.c (linevector_free, linevector_copy, linevector_add,
+ linevector_delete):
+ Instead of having all the lines and struct line's in the alloc_*
+ space, have each line and its struct line in its own malloc'd
+ space. Use a refcount to deal with curlines vs. headlines
+ vs. trunklines in RCS_deltas.
+ (struct allocblock, blocks, block_alloc, block_free): Remove; no
+ longer used.
+ (apply_rcs_changes, RCS_deltas): Don't copy lines into allocated
+ space; linevector_add now does that for us.
+ (rcs_change_text, RCS_deltas): Don't call block_free.
+
+Tue Dec 23 08:28:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * cvsbug.sh: Change bug-cvs address from prep.ai.mit.edu to gnu.org
+ per email from Martin Hamilton.
+
+Sun Dec 21 21:49:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (RCS_checkin): Disable keyword expansion when generating
+ the change text.
+ * sanity.sh: Move tests keyword-24 through keyword-27 into
+ new section keywordlog and expand greatly. Note that CVS 1.9.18
+ passes the new tests both local and remote but the current
+ version failed them both local and remote before this fix.
+
+Sat Dec 20 19:56:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (RCS_delete_revs): Clean up temporary files even if noexec.
+ Without this fix, basica-o5a in sanity.sh would leave files around.
+
+Thu Dec 18 13:05:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * run.c: Fix typo in declaration (evecvp -> execvp) (credit to
+ Erik Walthinsen for reporting this). Only declare it if not
+ HAVE_UNISTD_H. Move declaration to before the first use.
+
+Tue Dec 16 12:59:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * update.c: Collapse two identical declarations for join_file.
+
+Mon Dec 15 16:01:49 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * client.c (start_tcp_server): Remove calls to htons and add one
+ call to ntohs (init_sockaddr calls htons on the port argument).
+
+Mon Dec 15 00:07:02 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c (failure_exit): New variable.
+ (get_server_responses): If it is set, then return
+ failure.
+ (updated_seen, updated_fname): New variables.
+ (update_entries): Use updated_fname if set. In the "move away
+ foo.c; it is in the way" case print "C" not "U", and set
+ failure_exit.
+ (handle_mt): If we get +updated tagged text, stash it away in
+ updated_fname rather than printing it immediately.
+ (handle_mt, get_server_responses): If we stashed a filename and
+ didn't get around to printing it, go ahead and print it.
+ * sanity.sh (conflicts2-142d2): Adjust to test for fix. Remote is
+ now like local was in terms of exit status and "C aa.c" message.
+
+Sun Dec 14 00:27:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ Implement tagged text feature:
+ * update.c (write_letter): Take a single finfo argument rather
+ than file and update_dir. While we are at it change it to return
+ void (since the returned value always had been 0).
+ * update.c: Update callers.
+ * server.c, cvs.h (cvs_output_tagged): New function.
+ * client.c (responses): Add "MT" response.
+ (handle_mt): New function.
+ * update.c (write_letter): Output via cvs_output_tagged.
+
+Sun Dec 14 14:13:05 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * recurse.c (do_dir_proc): Only check for CVS/Repository if
+ W_LOCAL.
+ * sanity.sh (devcom-t2, devcom-t3): New tests for above patch.
+
+Sun Dec 14 00:27:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * root.c (parse_cvsroot): Initialize check_hostname (fixes thinko
+ in GSSAPI changes).
+
+Sat Dec 13 13:15:35 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * server.c: Use indentation to indicate nesting of #ifdef's.
+
+ * client.c (connect_to_gserver): Reindent (in one place).
+
+Fri Dec 12 17:38:15 1997 Chris Provenzano <proven@cygnus.com>
+ and Ian Lance Taylor <ian@cygnus.com>
+
+ * cvs.h (CVSmethod): Add gserver_method.
+ * root.c (method_names): Add gserver.
+ (parse_cvsroot): Handle :gserver:.
+ * client.h (cvsauthenticate): Declare.
+ (cvs_gssapi_encrypt): Declare if HAVE_GSSAPI and ENCRYPTION.
+ (cvs_gssapi_wrap_buffer_initialize): Declare if HAVE_GSSAPI.
+ (connect_to_pserver): Update declaration.
+ (pserver_authenticate_connection): Declare when HAVE_GSSAPI and
+ SERVER_SUPPORT is defined in addition to other case.
+ * client.c: If HAVE_GSSAPI, include GSSAPI header files.
+ (gcontext): New static variable if HAVE_GSSAPI.
+ (connect_to_pserver): Add do_gssapi parameter. Change all
+ callers. Move rejection handling to bottom of function.
+ (recv_bytes): New static function if HAVE_GSSAPI.
+ (connect_to_gserver): Likewise.
+ (start_server): Handle gserver_method. Handle GSSAPI encryption
+ and authentication.
+ * server.c: Include <sys/socket.h> if HAVE_GSSAPI, in addition to
+ existing cases. If HAVE_GSSAPI, include GSSAPI header files.
+ Include <grp.h> even if AUTH_SERVER_SUPPORT is not defined.
+ (gcontext, cvs_gssapi_wrapping): New static variables if
+ HAVE_GSSAPI.
+ (cvs_gssapi_encrypt): New global variable if HAVE_GSSAPI and
+ ENCRYPTION.
+ (serve_gssapi_encrypt): New static function if HAVE_GSSAPI and
+ ENCRYPTION.
+ (serve_gssapi_authenticate): New static function if HAVE_GSSAPI.
+ (requests): Add Gssapi-encrypt if HAVE_GSSAPI and ENCRYPTION. Add
+ Gssapi-authenticate if HAVE_GSSAPI.
+ (switch_to_user): Compile if HAVE_GSSAPI, in addition to existing
+ cases.
+ (pserver_authenticate_connection): Likewise. Ifdef out part of
+ the code for AUTH_SERVER_SUPPORT. Handle a GSSAPI request.
+ (gserver_authenticate_connection): New static function if
+ HAVE_GSSAPI.
+ (cvsauthenticate): New global variable.
+ (struct cvs_gssapi_wrap_data): Define if HAVE_GSSAPI.
+ (cvs_gssapi_wrap_buffer_initialize): New function if HAVE_GSSAPI.
+ (cvs_gssapi_wrap_input): New static function if HAVE_GSSAPI.
+ (cvs_gssapi_wrap_output): Likewise.
+ * main.c (opt_usage): Mention -a.
+ (main): Handle -a. Handle pserver if HAVE_GSSAPI, in addition to
+ existing cases.
+ * login.c (login): Pass new argument to connect_to_pserver.
+
+Fri Dec 12 15:33:19 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * buffer.c (PACKET_SLOP): Define.
+ (packetizing_buffer_initialize): Use PACKET_SLOP when allocating
+ holdbuf.
+ (packetizing_buffer_input): Allow up to PACKET_SLOP bytes in
+ stackoutbuf.
+ (packetizing_buffer_output): Use just BUFFER_DATA_SIZE + 2 for
+ inbuf. Allow PACKET_SLOP + 4 extra bytes in stack_outbuf.
+ Correct >= to > in test of incoming number of bytes. Use
+ PACKET_SLOP in other tests.
+
+Fri Dec 12 10:27:08 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c (start_tcp_server): Revise comment to reflect
+ SOCK_STRERROR and SOCK_ERRNO now being in use.
+
+Thu Dec 11 15:32:31 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * client.c (init_sockaddr): Compile if HAVE_KERBEROS, as well as
+ if AUTH_CLIENT_SUPPORT. Return a pointer to a struct hostent.
+ (start_tcp_server): Clean up. Use init_sockaddr. Use
+ SOCK_STRERROR and SOCK_ERRNO. Don't bind the socket.
+
+ Generalize buffering code used by Kerberos encryption routines
+ into a generic packetizing buffer. The new code in buffer.c is a
+ modified version of the code removed from server.c.
+ * buffer.c (struct packetizing_buffer): Define.
+ (packetizing_buffer_initialize): New function.
+ (packetizing_buffer_input): New static function.
+ (packetizing_buffer_output): New static function.
+ (packetizing_buffer_flush): New static function.
+ (packetizing_buffer_block): New static function.
+ (packetizing_buffer_shutdown): New static function.
+ * buffer.h (packetizing_buffer_initialize): Declare.
+ * server.c (struct krb_encrypt_data): Rename from
+ krb_encrypt_buffer, and remove all fields not related to
+ encryption.
+ (krb_encrypt_buffer_initialize): Just call
+ packetizing_buffer_initialize.
+ (krb_encrypt_input): New static function.
+ (krb_encrypt_output): New static function.
+ (krb_encrypt_buffer_input): Remove.
+ (krb_encrypt_buffer_output): Remove.
+ (krb_encrypt_buffer_flush): Remove.
+ (krb_encrypt_buffer_block): Remove.
+ (krb_encrypt_buffer_shutdown): Remove.
+
+Wed Dec 10 15:39:44 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * buffer.c (stdio_buffer_initialize): Correct formatting.
+
+Sun Dec 7 09:37:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (basicb-0d0): New test, for checkout on existing
+ directory.
+
+Sat Dec 6 00:25:11 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (binwrap3): Clean up repository too. Clean up working
+ directory with "rm -r" not "rm -rf".
+
+Thu Dec 4 17:11:18 1997 Larry Jones <larry.jones@sdrc.com>
+
+ * subr.c (check_numeric): Don't reference argv[1] when argc is 1
+ (should be argv[0]).
+
+ * sanity.sh: Fix lines that look like conflict markers but aren't
+ to prevent problems checking in.
+ (binwrap3): Remove local CVSROOT when done so that later
+ tests that expect to create it don't fail.
+
+Thu Dec 4 18:19:21 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * cvs.h: Remove mempcpy definition. I think the polite way to
+ describe my feelings about mempcpy is something like "we don't
+ have agreement that it is a good idea".
+ * rcs.c (truncate_revnum): Don't call it.
+ * sanity.sh: Run multibranch2 test by default.
+ (multibranch2): Use ${TESTDIR} a few places.
+ (multibranch2-9): Accept "P file1" as well as "U file1".
+
+ * sanity.sh: Don't add 1997 to the copyright notice. Add GPL
+ terms. Add discussion of copyright issues.
+ * rcs.c (truncate_revnum, truncate_revnum_in_place,
+ compare_truncated_revnums): Reindent.
+
+1997-12-04 Jim Meyering <meyering@na-net.ornl.gov>
+
+ * subr.c (xstrdup): Use memcpy rather than strcpy.
+ (compare_revnums): Declare parameters to be `const'.
+ Remove unnecessary uses of xstrdup and corresponding frees.
+ (increment_revnum): Declare parameter to be `const'.
+ Use memcpy rather than strcpy.
+ (gca): Declare parameters to be `const'.
+ (check_numeric): Declare REV parameter to be `const'.
+ (file_has_markers): Declare parameter to be `const'.
+ (get_file): Declare `char*' parameters to be `const'.
+ * run.c (run_exec): Declare `char*' parameters to be `const'.
+ * cvs.h (mempcpy) [! HAVE_MEMPCPY]: Define it.
+ Add `const' to types in several prototypes.
+
+ * rcs.c (truncate_revnum): New function.
+ (truncate_revnum_in_place): New function.
+ (compare_truncated_revnums): New function.
+ (max_rev): New function.
+ (RCS_addbranch): Make BRANCH parameter `const'.
+ Use the above functions rather than open-coding them.
+ When BRANCH is a revision number, insert it *in order*
+ in the sorted list of branch numbers, not at the end.
+ Add assertion that insertion succeeds.
+ * sanity.sh (multibranch2): Test for this.
+ (Copyright): Add 1997.
+
+Dec 1997 Karl Fogel <kfogel@floss.red-bean.com>
+
+ * wrapper.c (wrap_name_has): loop as far as wrap_count +
+ wrap_temp_count, not wrap_count + wrap_saved_count, otherwise
+ some wrappers get skipped.
+ (wrap_matching_entry): same.
+ * sanity.sh (binwrap3): new test, for import with
+ CVSROOT/cvswrappers and .cvswrappers specifying -k 'b' options.
+
+1997-11-30 Jim Meyering <meyering@na-net.ornl.gov>
+
+ * client.c (send_a_repository): Strip trailing slashes from the name
+ of the update directory. Otherwise, running `cvs update dir/' provokes
+ this failure `protocol error: illegal directory syntax in dir/' when
+ running in client/server mode.
+
+ * hash.c (insert_before): New function derived from addnode.
+ (addnode): Simply return insert_before.
+ (addnode_at_front): Simply return insert_before.
+ * hash.h (insert_before): Add prototype.
+
+ * server.c (dirswitch): Compute `strlen(dir)' once and save it,
+ rather than computing it four times. Also do s/illegal/invalid/ to
+ this diagnostic: "E protocol error: illegal directory syntax in %s".
+
+Sun Nov 30 18:03:02 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * admin.c: Fix comment (no longer a front-end to "rcs").
+
+ * error.c, error.h (rcserror): Remove.
+ * admin.c, rcs.c: Call error instead of rcserror. This changes
+ the format of these messages from "rcs: <path>: error" to "cvs
+ <command>: <path>: error". The former format wasn't quite what
+ RCS printed anyway (because RCS would sometimes print "ci", "co",
+ &c, not "rcs"), and preserving RCS's exact output probably is not
+ a good idea anyway (because it will make people think that the
+ error was caused by an external program). In two cases, I tidied
+ up the message in a more drastic fashion ("cannot stat" in
+ RCS_checkin and "could not diff" in RCS_delete_revs).
+
+ * sanity.sh (basica-o2b, binfiles2-o1, admin-18, admin-22-o10,
+ admin-22-o17): Look for "cvs <command>" not "rcs".
+
+ * run.c, cvs.h (run_setup): Replace varargs nonsense with a single
+ argument which gets parsed as the result of the vasprintf
+ used to.
+ * client.c, commit.c, logmsg.c, modules.c, rtag.c, tag.c, update.c,
+ wrapper.c: Update callers, either to do the sprintf themself or to
+ just call run_arg if it will do the job.
+ * rcscmds.c: Likewise for call_diff_setup and callers.
+
+ * run.c, cvs.h (run_args): Remove; nowhere used.
+
+Sat Nov 29 22:15:06 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * options.h.in: Remove declaration of getwd; see lib/ChangeLog for
+ rationale.
+
+1997-11-29 Jim Meyering <meyering@na-net.ornl.gov>
+
+ * update.c (checkout_file): Initialize `backup'.
+
+ * diff.c (diff_fileproc): Initialize `tmp' and `fname'.
+
+ * modules.c (do_module): Initialize `server_dir_to_restore'.
+ (do_module): Initialize `value' in an else clause.
+
+ * rcs.c (RCS_checkin): Initialize `commitpt'.
+ (RCS_delete_revs): Initialize `revp'.
+ (RCS_copydeltas): Always initialize `insertbefore'.
+
+ * run.c (run_print): Define `outfn' even in error case.
+
+Mon Nov 24 17:28:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (RCS_findlock_or_tip): Prototype.
+ (RCS_checkin): Fix call to pass correct number of arguments.
+
+Sun Nov 23 10:34:03 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * recurse.c (do_dir_proc): Move check for CVS/Repository and
+ CVS/Entries to before where we call the direntproc.
+ * client.c (send_dirent_proc): Remove code to check for
+ CVS/Repository, now that recurse.c does it.
+ * sanity.sh (conflicts3-18 through conflicts3-19): New tests, for this.
+
+Sat Nov 22 10:54:16 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * recurse.c (do_dir_proc): Check that CVS/Repository and
+ CVS/Entries exist.
+ * sanity.sh (conflicts3-14 through conflicts3-17): New tests, for this.
+
+ * client.c (send_fileproc): Send options field from
+ vers->entdata->options not vers->options.
+ * cvs.h (struct entnode): Add comment (options and timestamp must
+ not be NULL).
+ * sanity.sh (binfiles-9 through binfiles-13, binfiles-sticky5,
+ keyword-17): Remove kludges for remote; tests for fix.
+
+ * update.c (update_fileproc): Fix comment; direct checkout is
+ still faster than patches for local but not for quite the
+ same reasons.
+
+ * add.c (add): Pass SEND_NO_CONTENTS to send_files.
+
+Wed Nov 19 18:25:03 1997 Mike Glendinning <mikeg@sequent.com>
+
+ * update.c (patch_file_write): Missing cast provided.
+
+Wed Nov 19 15:57:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (RCS_deltas): Solve trigraph problem (once and for all, I
+ hope) with 3 calls to cvs_output.
+
+Wed Nov 19 01:52:57 1997 Andy Piper <andyp@parallax.co.uk>
+ and Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * classify.c (Classify_File), cvs.h (struct vers_ts), vers_ts.c
+ (Version_TS): Clarify NULL versus "" for options in comments.
+ * vers_ts.c (Version_TS): Treat "" the same way as NULL in options
+ and vers_ts->options.
+ * sanity.sh: New tests binfiles-sticky5 through binfiles-17 test
+ for this.
+
+1997-11-16 Karl Fogel <kfogel@floss.red-bean.com>
+
+ * client.c (update_entries): parse server-sent entries line even
+ in the case of "cvs export", because we need to know if -kb option
+ is set.
+ Init `options' to NULL like anything else.
+
+Tue Nov 18 09:20:29 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * version.c: Change version number to 1.9.21.
+
+ * Version 1.9.20.
+
+Mon Nov 17 14:35:31 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * server.c (server_updated): If scratched_file and noexec are set,
+ clean up so we don't get a "duplicate Scratch_Entry" warning
+ later.
+ * sanity.sh: New tests conflicts3-10 to conflicts3-13, for this.
+
+ * sanity.sh (conflicts3): Don't allow "file1 was lost" messages
+ here; I don't think CVS actually produced them, and they don't
+ belong.
+
+Sun Nov 16 23:19:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh: Accept either "U file1" or "P file1".
+
+Fri Nov 14 12:32:05 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c: Add comment about cleaning up ,foo, file on ^C.
+
+Fri Nov 14 11:56:29 1997 Andy Piper <andyp@parallax.co.uk>
+ and Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * filesubr.c (unlink_file_dir): Don't print trace message in the
+ server.
+
+Fri Nov 14 11:28:55 1997 Jim Meyering and Jim Kingdon
+
+ * rcs.c (RCS_getdatebranch): If the branch we are looking for
+ doesn't exist, return a revision which matches the date, not
+ just NULL.
+ * sanity.sh (tagdate): New test, for this.
+
+Thu Nov 13 10:11:48 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (basicb-21): Fix comment which described a behavior
+ which no longer exists.
+
+Wed Nov 12 16:24:45 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ Clean up infrastructure made unnecessary by RCS library:
+ * rcscmds.c (diff_exec, diff_execv): Use literal "diff" not DIFF.
+ * options.h.in (DIFF), rcs.h (RCS, RCS_CI, RCS_DIFF,
+ RCS_RCSMERGE): Removed; no longer used.
+ * commit.c (commit), patch.c (patch_fileproc),
+ rcscmds.c (RCS_exec_rcsdiff), start of rcscmds.c: Update comments
+ to reflect librarification of RCS.
+ * options.h.in (RCSBIN_DFLT): Removed.
+ * main.c, cvs.h (Rcsbin, free_Rcsbin): Removed.
+ * main.c (main): Don't check RCSBIN environment variable. -b
+ global option is now a noop.
+ * cvs.h (RCSBIN_ENV): Removed.
+ * expand_path.c (expand_variable): $RCSBIN is now an error.
+ * mkmodules.c (config_contents): Remove RCSBIN.
+ * parseinfo.c (parse_config): RCSBIN now a noop.
+ * server.c (server): Don't put Rcsbin in PATH.
+
+Mon, 10 Nov 1997 Jim Kingdon
+
+ * rcs.c (RCS_checkin): Actually, when we get a change text
+ for a text file using get_file, we want text mode, although
+ the reasons are kind of subtle (see comment).
+
+ * rcs.c (RCS_checkin): Pass correct mode to get_file for
+ binary files.
+
+ * rcscmds.c: Declare vasprintf.
+
+Mon Nov 10 11:11:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ This fixes problems with windows-NT/run.c improperly quoting, and
+ is cleaner anyway.
+ * rcscmds.c (call_diff_setup, call_diff_arg, call_diff_add_arg,
+ call_diff_argv, call_diff_argc, call_diff_argc_allocated): New
+ functions/variables, lightly adapted from src/run.c.
+ * cvs.h, run.c (call_diff, call_diff3): Move from here...
+ * rcscmds.c: ...to here.
+
+Sun, 9 Nov 1997 Jim Kingdon
+
+ * rcs.c (rcs_internal_unlockfile): Call rename_file not rename.
+ This makes it work on NT again.
+
+Sun Nov 9 16:54:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (diffmerge2): Protect keywords against unwanted
+ expansion. They got clobbered and the testcase stopped working
+ when I checked it in.
+
+Fri Nov 7 13:23:38 1997 Karl Fogel <kfogel@floss.red-bean.com>
+ and Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (diffmerge1, diffmerge2): new tests, for bugs, or
+ potential bugs, in ../diff/analyze.c which were fixed by Paul
+ Eggert's patch.
+
+Sun Nov 9 10:28:43 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (RCS_settag): Reindent.
+
+ * rcs.c (rcs_internal_lockfile): Fix typo (thow -> throw).
+
+Sat Nov 8 15:58:53 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (cvsadm): Remove most of the tests which tested
+ CVS/Root. This takes the run time for the cvsadm tests from
+ about 5 minutes 15 seconds to about 4 minutes 10 seconds with no
+ significant loss in coverage.
+
+ * rcs.c (rcs_internal_lockfile): Check for errors from system
+ calls. If open() gives an error, don't muck with stat and errno
+ (I don't know what the RCS code that this comes from was trying to
+ do, but it clearly isn't accomplishing anything here).
+ (RCS_rewrite, RCS_delete_revs): Check for errors from system calls.
+
+Sat Nov 1 14:21:29 1997 Michael L.H. Brouwer <michael@thi.nl>
+
+ * rcs.c (RCS_checkin): Change type of bufsize from int to size_t.
+ (RCS_delete_revs): Change type of bufsize and len from int to size_t.
+ (RCS_getdeltatext): Change type of textlen from int to size_t.
+ * rcs.h (struct deltatext): Change len from int to size_t to keep
+ the compiler happy on systems where size_t is unsigned int.
+ [This goes well beyond keeping the compiler happy; if sizeof
+ (size_t) != sizeof (int), the old code was quite broken -kingdon]
+
+Sat Nov 1 14:21:29 1997 Michael L.H. Brouwer <michael@thi.nl>
+ and Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (RCS_checkin): When checking if we were holding the lock
+ use delta->author instead of user since the latter might have been
+ clobbered by a call to getcaller. This resulted in the failure of
+ test basica-7.
+ [I don't completely follow the scenario where it gets clobbered,
+ it but sounds vaguely plausible and the replacement seems
+ cleaner, precisely because it avoids allocation issues -kingdon]
+
+Wed Nov 5 20:16:12 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * checkin.c, checkout.c, commit.c, cvs.h, import.c, login.c,
+ main.c, update.c: Change FALSE to 0 and TRUE to 1 and replace
+ monstrosities like "cvswrite == TRUE" with just "cvswrite". FALSE
+ and TRUE sometimes conflicted with system headers (NextStep3.3?),
+ but more to the point, good old 1 and 0 are fine and were used by
+ most of CVS already.
+
+Tue Nov 4 12:19:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (RCS_checkin, RCS_lock, RCS_unlock): Rename local variable
+ quiet to checkin_quiet or some such, to avoid confusion with
+ global variable quiet.
+
+ * lock.c: Update comment to refer to add_rcs_file rather than "rcs
+ -i".
+
+ * rcs.h (struct rcsnode): Add comments for all fields.
+ * rcs.c (RCS_delete_revs): Refuse to delete revisions which have
+ symbolic names. Fix fencepost bug which caused us to sometimes
+ check one more revision than we should for locks, branches, and
+ this.
+ (findtag): New function, to help above code.
+
+ * admin.c (admin): Take out writelocks not readlocks. This has
+ been a bug "forever", but may become more noticeable with
+ rcs_internal_lockfile relying on the writelocks.
+
+Mon Nov 3 10:17:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (RCS_rewrite): Don't write the file if noexec.
+ * sanity.sh (basica, branches): Test for this.
+
+Sat Nov 1 10:01:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.h (struct deltatext): Comment text and log fields.
+
+ * admin.c (admin_fileproc): Call RCS_reparsercsfile not
+ RCS_fully_parse. Don't muck with ->other field in RCSVers (it
+ doesn't need to be set).
+ * rcs.h, rcs.c (RCS_reparsercsfile): No longer static. No point
+ in having this static when RCS_rewrite and RCS_fully_parse are not.
+ * rcs.c (getdelta): Remove obsolete comment about not storing the
+ newphrases from the deltas, since we now do.
+
+Sat Nov 1 10:01:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+ and Paul Eggert
+
+ * rcs.c (rcs_internal_lockfile): Clarify the comments about O_EXCL
+ and such matters.
+
+Sat Nov 1 10:01:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (RCS_delete_revs): Pass force_tag_match to RCS_settag.
+ * sanity.sh (basica-o2a, basica-o2b): Test for this.
+
+1997-11-01 Peter Brandstrom <d91-pbr@nada.kth.se>
+
+ * sanity.sh: Use ${username} more places.
+
+Sat Nov 1 00:14:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (rcs_internal_lockfile): Add comments about what we are
+ trying to accomplish here (versus what RCS tries to accomplish).
+
+ * rcs.c (RCS_parsercsfile_i): Clarify/expand comment about
+ the purpose of having both this and RCS_reparsercsfile.
+ (RCS_rewrite): Add comment about how this works.
+
+ * admin.c (admin_fileproc): Add comment about call to
+ RCS_fully_parse not RCS_reparsercsfile.
+ * rcs.h: Comment on what delta_pos field of struct rcsnode is.
+
+Fri Oct 31 16:38:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+ and Abe Feldman
+
+ * client.c (update_entries): If UTIME_EXPECTS_WRITABLE, if
+ necessary change the file to be writable temporarily to set its
+ modification time.
+
+Thu Oct 30 17:42:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * admin.c (admin): Deal with new :: syntax for ranges.
+ * rcs.c, rcs.h (RCS_delete_revs): New arg inclusive (set for the old
+ behavior, clear to enable new code).
+ * admin.c (admin_fileproc): Set it if :, clear it if ::.
+ * sanity.sh (basica, head, branches, log): Add tests for this feature.
+
+ * admin.c (admin_fileproc): Clean up the error message which
+ happens if one of the RCS_* functions returns an error status; it
+ is confusing to say that "rcs" failed now that this is implemented
+ internally.
+ * sanity.sh (admin): Update accordingly.
+
+Wed Oct 29 07:07:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (admin-22-o24): New test, tests that admin -o
+ correctly munged the deltatexts on a branch too.
+
+ * rcs.c (RCS_delete_revs): If we are deleting an entire branch,
+ delete the node in ->branches rather than setting the ->key to the
+ bogus value NULL.
+ * rcs.c (RCS_delete_revs): If "rev1" equals "branchpoint", then set
+ "before" to the revision on the trunk that we branch from.
+ * rcs.c (RCS_delete_revs): Don't set rev2 to revp->version (the
+ code is missing an xstrdup, but it doesn't matter because rev2
+ isn't used after this point).
+ * sanity.sh (binfiles2-o2 to binfiles2-o4): New tests, for this.
+
+Tue Oct 28 19:30:05 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (RCS_delete_revs): Restore code which passes rev2 to
+ RCS_getbranchpoint if rev1 is NULL; it still makes sense for the
+ non-trunk case. Fixes admin-22-o22 in testsuite.
+
+ * sanity.sh (admin-18): Adjust to reflect "rcs failed" no longer
+ being suppressed by global -q option.
+
+ * rcs.c (RCS_delete_revs): If rev1 == NULL and rev2 is on the
+ trunk, handle it the same way we do everything else--by swapping
+ the two. This replaces the code which tried to kludge what we
+ passed to RCS_getbranchpoint (which didn't work).
+ * sanity.sh (binfiles2-o1 to binfiles2-o4): New tests, for this fix.
+ * admin.c (admin_fileproc): Don't have -q global option suppress
+ "rcs failed" message.
+
+1997-10-28 Jim Kingdon
+
+ * log.c (printlock_proc), rcs.c (putlock_proc): Prototype.
+ * rcs.c (rcs_internal_lockfile): Only try to call fchmod if
+ HAVE_FCHMOD is defined.
+
+Tue Oct 28 10:27:03 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * rcs.c (RCS_deltas): Don't use \? in string if __STDC__ is not
+ defined.
+
+ * rcs.c (make_file_label): Remove extraneous `+'.
+
+Mon Oct 27 14:40:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * status.c (status): Don't pass SEND_NO_CONTENTS to send_files.
+
+Sat Oct 25 00:33:57 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (RCS_delete_revs): Use : not - for range in error message.
+
+ * rcs.h: Add comment about '\0' in RCS fields.
+
+ * rcs.c (getdelta): Add comment about branches and next field
+ being mandatory.
+
+ * rcs.c (RCS_reparsercsfile, RCS_deltas), sanity.sh (reserved):
+ Reindent sections which were misindented as a result of recent
+ changes.
+
+Fri Oct 24 10:22:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (RCS_findlock_or_tip): Don't worry about file ownership
+ and nonstrict locking when returning the default branch or head.
+ The most conspicuous problem with the old code is that in the
+ error case it would examine rstat.st_uid when it had not been
+ set. For a discussion of more fundamental reasons, see comment.
+
+ * admin.c (admin_fileproc): In handling -A, don't handle relative
+ pathnames differently from absolute pathnames. See comment for
+ rationale. If problem opening the file, give a nice error not a
+ coredump.
+ * sanity.sh (admin-19a-admin, admin-19a-log, admin-19a-fix):
+ New tests, test for traditional "cvs admin -A" behavior with
+ relative pathnames.
+ * sanity.sh (admin-19a-nonexist): Test for the core dump fix.
+ * sanity.sh (admin-22-o1): Look for ${PROG} not cvs.
+
+ * sanity.sh (reserved-16): Remove commitinfo change with "cvs
+ commit" not "cvs admin -o". In addition to commit being The Right
+ Thing on general principles, cvs admin -o doesn't work because it
+ doesn't rebuild the administrative file database.
+
+ * update.c (patch_file): If the first revision does not exist in
+ the RCS file, fall back to sending entire file. Fixes
+ admin-22-o15 in make remotecheck.
+
+1997-10-23 enami tsugutomo <enami@but-b.or.jp>
+
+ * rcs.c (RCS_checkin): Unlink temporary files stored in variable
+ `tmpfile' and `changefile'.
+
+Wed Oct 22 12:16:10 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (rcs_lockfilename): Allocate enough memory for terminating
+ '\0'.
+
+ * admin.c (admin_fileproc): Don't support '-' for ranges in "cvs
+ admin -o".
+ (admin): Adjust comment.
+
+ * rcs.h (RCSVers): New field other_delta.
+ * rcs.c (free_rcsvers_contents): Also free other_delta.
+ (getdelta): Read newphrases from deltas into other_delta field.
+ (putdelta): Write those newphrases.
+ * sanity.sh (rcs-8a): New test, for this fix.
+ * admin.c (admin_fileproc): If "-b" without argument, then set
+ branch to NULL, not "" (uncovered by rcs-8a test).
+ * rcs.c (putrcsfield_proc): Add comment about how we (mis)handle
+ values in newphrases.
+
+ * sanity.sh (reserved): Instead of looking for rcslock.pl in CVS
+ distribution, just use our own equivalent.
+
+ * rcs.c (RCS_rewrite): Call ferror before fclose to avoid "Invalid
+ argument" warnings.
+
+Mon Oct 20 00:30:16 1997 Tim Pierce <twp@twp.tezcat.com>
+
+ [I removed a ChangeLog entry for a change to sanity.sh (editor),
+ because the actual change was not made. With this change, CVS no
+ longer runs RCS. I'll be checking in my cleanups shortly. -kingdon]
+
+ Librarify `ci'.
+ * rcscmds.c, cvs.h (RCS_checkin): Removed.
+ * rcs.c, rcs.h (RCS_checkin, RCS_getbranchpoint, RCS_addbranch,
+ RCS_findlock_or_tip): New functions. RCS_checkin completely
+ rewritten to eliminate RCS 5.7; change `rcs' parameter from string
+ to RCSNode, so we can update RCSNode without re-reading from
+ disk.
+ * checkin.c (Checkin): Updated RCS_checkin caller, moved RCS_parse
+ call to before RCS_checkin.
+ * import.c (add_rev): Updated caller.
+ * commit.c (remove_file): Updated caller.
+ (checkaddfile): Updated caller. Parse `rcsfile' after
+ calling add_rcs_file. Free `rcsfile' instead of asserting it to
+ be NULL.
+
+ Librarify `rcs'.
+ * rcscmds.c, cvs.h (RCS_exec_settag, RCS_exec_deltag,
+ RCS_exec_setbranch, RCS_exec_lock, RCS_exec_unlock): Removed.
+
+ * rcs.c (RCS_settag): Rewritten to eliminate RCS 5.7.
+ * commit.c (checkaddfile): Call RCS_rewrite after calling RCS_settag.
+ * import.c (add_tags): Same.
+ * rtag.c (rtag_fileproc): Same.
+ * tag.c (tag_fileproc): Same.
+
+ * rcs.c (RCS_deltag): Rewritten to eliminate RCS 5.7. Remove
+ `quiet' parameter, since this function no longer prints any output.
+ * commit.c (remove_file): Update caller. Also call RCS_rewrite
+ after RCS_deltag.
+ * rtag.c (rtag_delete): Same.
+ * tag.c (tag_fileproc): Same.
+
+ * rcs.c (RCS_setbranch): Rewritten to eliminate RCS 5.7.
+ * commit.c (remove_file): Call RCS_rewrite after calling RCS_setbranch.
+ (fixbranch): Same.
+ (lock_RCS): Same.
+
+ * rcs.c (RCS_lock): Rewritten to eliminate RCS 5.7. Change third
+ arg to mean `quiet' and not `noerr', permitting admin_fileproc to
+ run RCS_lock verbosely.
+ * commit.c (lock_RCS): Update callers; call
+ RCS_rewrite after RCS_lock.
+ (remove_file): Same. Call RCS_lock quietly.
+ * import.c (add_rev): Same. Do not print `fork failed' error
+ message, since we're no longer forking.
+
+ * rcs.c (RCS_unlock): Rewritten to eliminate RCS 5.7. Change
+ `noerr' arg to mean `quiet', permitting admin_fileproc to run
+ RCS_unlock verbosely. Use notify_do when breaking another user's
+ lock. Include "edit.h" for notify_do prototype.
+ * checkin.c (Checkin): Update caller; use RCS_rewrite after RCS_unlock.
+ * commit.c (unlockrcs): Same.
+ * import.c (add_rev): Same.
+
+ * rcs.c, rcs.h (RCS_getlocks, RCS_addaccess, RCS_delaccess,
+ RCS_getaccess, RCS_delete_revs): New functions.
+ (expand_keywords, RCS_lock, RCS_unlock): Use RCS_getlocks.
+ * log.c (log_fileproc, log_version): Call RCS_getlocks. Don't add
+ bogus ";locker" nodes to RCSVers nodes -- walk lock list with
+ printlock_proc.
+ (printlock_proc): New function.
+
+ * admin.c (admin_fileproc): Largely rewritten: call internal RCS
+ library functions instead of forking RCS processes.
+ (admin, admin_fileproc): Obsolete -V option.
+ (struct admin_data): Remove `version' member.
+ * sanity.sh (admin-24): Remove -V test case.
+
+ New functions for reading and writing RCS files.
+ * rcs.h (struct deltatext, Deltatext): New types.
+ (struct rcsversnode): New members `text' and `outdated'.
+ (struct rcsnode): New members `access', `locks', `strict_locks',
+ `comment', and `desc'.
+ * rcs.c (RCS_reparsercsfile, expand_keywords): Use new RCSNode members.
+ (free_rcsnode_contents): Free them.
+ * log.c (log_fileproc): Use new RCSNode members instead of ->other.
+
+ * rcs.c (getdelta, RCS_getdeltatext, freedeltatext, do_locks,
+ RCS_putadmin, RCS_putdtree, RCS_putdesc, putdelta,
+ putrcsfield_proc, putsymbol_proc, RCS_copydeltas, putdeltatext,
+ RCS_rewrite, getrevnum, rcs_internal_lockfile,
+ rcs_internal_unlockfile, rcs_lockfilename): New functions.
+
+ (RCS_reparsercsfile): Use getdelta, making sure fp is positioned
+ correctly before calling it. Skip `head' and `branch' nodes: we
+ have already parsed them, and they were being added incorrectly to
+ rcs->other. Do not signal error if the RCS file has an empty
+ delta tree; this made it impossible for RCS_checkin to perform an
+ initial checkin. Remove `all' parameter; always store all RCS
+ fields.
+ (RCS_fully_parse, RCS_gettag, RCS_getbranch, RCS_getdate,
+ RCS_getdatebranch, RCS_getrevtime, RCS_symbols, translate_symtag,
+ RCS_isdead, RCS_getexpand, RCS_checkout, annotate_fileproc):
+ Update all callers to remove `all' parameter.
+
+ (getrcskey): Do not append trailing whitespace to a value. This
+ corrupted some log fields and wrecked some sanity.sh test cases.
+
+ (free_rcsvers_contents): New function.
+ (rcsvers_delproc): Call it.
+
+ * rcs.h (NODELTA): Removed symbol; now obsolete (since RCSNodes
+ do not go stale).
+ * import.c (add_rev): Removed NODELTA reference.
+ * rcs.c (RCS_reparsercsfile, RCS_checkout, RCS_settag, RCS_deltag,
+ RCS_setbranch, RCS_lock, RCS_unlock, RCS_deltas): Removed NODELTA
+ references.
+
+ Miscellaneous changes to support RCS librarification and fix some bugs.
+ * subr.c, cvs.h (line2argv): Add `sepchars' argument.
+ * modules.c (cat_module, admin_fileproc): Update all callers.
+
+ * subr.c, cvs.h (compare_revnums, increment_revnum): New functions.
+ (make_message_rcslegal): Strip whitespace from end of
+ lines and end of string, a la `cleanlogmsg' in RCS 5.7.
+ (get_file): Terminate buf with \0, extending it if
+ necessary. Read from stdin if `name' arg is NULL.
+ * admin.c (admin_fileproc): Call get_file to read -t arg from stdin.
+
+ * error.c, error.h (rcserror): New function, used everywhere.
+
+ * hash.c, hash.h (addnode_at_front): New function.
+ * rcs.c (RCS_settag, RCS_lock): Call it.
+
+ * import.c, cvs.h (expand_at_signs): Make extern.
+ * rcs.c (putrcsfield_proc, RCS_putadmin, RCS_putdesc,
+ putdeltatext): Call it.
+
+ * rcs.c (make_file_label): Use last_component to get file's basename.
+
+ * sanity.sh (srcdir): New variable.
+ (rcs-7): Remove newphrase warning, no longer produced by CVS.
+ (rcs-8): Permit random whitespace around newphrase fields.
+ (admin-22): New test cases for -o options: admin-22-o{1..23}.
+ (reserved): New test cases for rcslock.pl: reserved-{8..16}.
+
+Tue Oct 21 16:48:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * tag.c (tag_check_valid): Add comment about locking or lack
+ thereof.
+
+1997-10-20 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * version.c: Change version number to 1.9.19.
+
+1997-10-19 Jim Kingdon
+
+ * Version 1.9.18.
+
+Wed Oct 15 15:21:43 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (username): Add '-' to characters allowed in user name.
+
+ * rcscmds.c (diff_exec): Remove item about external diff
+ programs. It doesn't really belong here now that diff is
+ librarified and TODO #191 now mentions this.
+
+ * checkout.c (checkout_proc): Add comment about assuming '/' is
+ the only path separator.
+ * options.h.in: Fix thinko (CVS/Repository -> CVS/Root).
+
+Mon Oct 13 22:46:03 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * commit.c (commit): Add comment about CVS_BADROOT and command
+ other than "commit".
+
+1997-10-11 Noel Cragg <noel@swish.red-bean.com>
+
+ * options.h.in: RELATIVE_REPOS has been checked for bitrot -- it
+ now works again. Change the comment before the #define to say
+ that we'll be switching to it soon.
+
+ * sanity.sh (basicb-1, basicb-1a): update dotest strings to match
+ no matter if we're running with RELATIVE_REPOS defined or not.
+ (basicb-9b, basicb-9c): same.
+
+ * sanity.sh (basicb-9b, basicb-9c): modified tests, since the
+ checkout.c fix changes the way this test module is checked out.
+ (basicb-9d, basicb-9e, basicb-9f): new tests, same.
+ (basicb-18): modify test, same.
+ (cvsadm): new set of exhaustive tests to check the contents of
+ CVS/Root and CVS/Repository files under various conditions. As a
+ side effect, it tests the behavior of the "-d" flags (command line
+ and modules file).
+ (modules3-7e through modules3-7h): removed, since these tests were
+ a small subset of what is tested in the new cvsadm section.
+ (modules-1b, modules-1c): same.
+ (modules-2b, modules-2c): same.
+ (modules-3b, modules-3c, modules-3e, modules-3f): same.
+
+ * create_adm.c (Create_Admin): be a bit more verbose when using
+ trace mode.
+
+ * checkout.c (checkout_proc): rewrote the code that sets the where
+ variable and the code that matches directory names with repository
+ directories. This fixes a long-standing bug in CVS. (It used to
+ be the case that "cvs co -d foo <mod1> <mod2>" would not properly,
+ where <mod1> and <mod2> where defined in the modules file. While
+ the first module would be checked out correctly, the second would
+ be checked out under the name of the directory to which the module
+ referred rather than the module name!). This fix also allows us
+ to check out things into directories that are more than one deep
+ (e.g. "cvs -d foo/bar/baz co blah" will now work).
+ (checkout): remove code that performed a CHDIR if the
+ number of arguments specified was greater than one, since it's no
+ longer necessary. Also remove the code that prevented us from
+ doing "cvs co -d <dir1>/<dir2>" without <dir1> existing, since
+ checkout_proc handles things correctly now.
+
+ * cvs.h: fix typo.
+
+ * rtag.c (rtag): reformat so that we don't run over 80 characters
+ per line.
+ (rtag_dirproc): same.
+
+ * sanity.sh: change all old test cases to use pass and fail
+ functions rather than doing some combination of echo and exit
+ themselves.
+
+ * commit.c (commit_direntproc): remove the "warm fuzzy" -- this
+ code never gets called when running in client/server mode, and we
+ should have CVS' output match as much as possible between the two
+ modes. Moreover, there is no analogous place to put this same
+ message when we're running in c/s mode.
+ (find_direntproc): print the same "fuzzy" as in check_direntproc
+ so that local and c/s mode have the same messages.
+ * sanity.sh (187a3): update test case to reflect the above.
+
+Thu Oct 9 10:57:02 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * parseinfo.c (parse_config): Add comment about compatibility
+ issues with adding keywords.
+
+Wed Oct 8 16:40:37 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * recurse.c (do_dir_proc), commit.c (check_direntproc,
+ commit_direntproc, find_dirent_proc): If this
+ directory doesn't exist, skip it.
+ * diff.c (diff_dirproc): Reindent.
+ * sanity.sh (deep-4b0a, deep-4b0b): Check for this fix.
+
+Thu Sep 26 16:30:00 1997 Larry Jones <larry.jones@sdrc.com>
+ and Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * update.c (checkout_file): Don't set timestamp in noexec mode.
+ * vers_ts.c (Version_TS): Add comment about ignoring errors from
+ utime.
+ * sanity.sh (conflicts3): New tests, for this fix.
+
+Fri Oct 3 09:47:04 1997 Noel Cragg <noel@swish.red-bean.com>
+
+ * sanity.sh (168): use PROG instead of CVSBASE, since they are
+ equal.
+ (importb-2): refer to PROG instead of "cvs" in error message.
+
+ * add.c (add): use PROGRAM_NAME in the error message rather than
+ "cvs".
+ * classify.c (Classify_File): same.
+ * commit.c (find_fileproc): same.
+ * sanity.sh: change all add notification messages to refer to PROG
+ rather than "cvs". Fixed nasty quoting in several places at the
+ same time, replacing older "'command'" forms with newer
+ ".command." for simplicity.
+
+Sat Sep 27 01:37:10 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (rcslib-merge-8): Accept "P file1" as well as "U file1".
+
+Fri Sep 26 22:24:10 1997 Noel Cragg <noel@swish.red-bean.com>
+
+ * create_adm.c (Create_Admin): assign our duplicate pointer `cp'
+ after the xrealloc of `reposcopy' because the latter might have
+ changed addresses.
+
+Fri Sep 26 14:25:59 1997 Tim Pierce <twp@twp.tezcat.com>
+
+ * run.c (call_diff): Don't reset optind; this is done by diff_run now.
+
+ Librarify rcsmerge/diff3.
+ * rcscmds.c, cvs.h (RCS_merge): Rewritten from scratch: check out
+ selected files and diff3 them. Take new `rcs' and `workfile'
+ arguments, so we can resolve symbolic tags and manipulate the
+ working file.
+ * update.c (merge_file, join_file): Update RCS_merge calls.
+ * run.c, cvs.h (call_diff3): New function.
+
+ * sanity.sh (rcslib): New tests, rcslib-merge-{1..13}.
+
+Fri Sep 26 22:59:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * create_adm.c (Create_Admin): Fix thinko in Noel's change: keep
+ track of the originally allocated "cp" and free it, rather than
+ calling free on a pointer which may point halfway into the allocation.
+ * repos.c (Sanitize_Repository_Name): Per HACKING, assert that
+ repository != NULL, rather than just silently returning if NULL.
+ Reindent a line.
+
+Fri Sep 26 15:40:00 1997 Noel Cragg <noel@swish.red-bean.com>
+
+ * sanity.sh (modules): add tests modules-[123]* that make sure the
+ administrative files get rebuilt in various cases.
+
+ * add.c (combine_dir): removed function, since we no longer need
+ to worry about stripping the "." path element out. Changed the
+ two callers to simply concatenate their two arguments.
+
+ * recurse.c (do_dir_proc): don't bother trying to strip off "." in
+ the repository name since the below changes fix that behavior --
+ simply concatenate the repository and directory names together.
+
+ * checkout.c (checkout_proc): sanitize the repository name after
+ constructing it (we may create "/path/to/repos/.", but we don't
+ want that to be passed around). Remove the code that tacks on
+ "/." when constructing top_repository, since the below changes fix
+ that behavior. Added comments to the part of this function that
+ builds administrative files.
+
+ * sanity.sh (basicb): now that the below weirdness is fixed, the
+ extra "." path element in test basicb-0c doesn't appear when a
+ top-level file is checked out. Remove it from the expect string.
+
+ * create_adm.c (Create_Admin): now that the repository name isn't
+ floating around with "." as the last path element, make creation
+ of the top-level administrative files a special case -- save the
+ repository name as "/path/to/repos/." Why? I considered not
+ including the "." but didn't know how it would affect the remote
+ protocol when RELATIVE_REPOS was defined (do we have a way of
+ sending "" via the protocol?). After I make sure that the
+ RELATIVE_REPOS patches still work, I'll check the "" possibility
+ so we don't have to have a this special case.
+
+ * repos.c (Sanitize_Repository_Name): new function that removes
+ (if present) the trailing slash and "." component from the
+ repository name. Many routines break if we don't guarantee this.
+ See the comment before the function for complete information.
+ (Name_Repository): call Sanitize_Repository_Name before returning
+ the value.
+ * cvs.h: add prototype for Sanitize_Repository_Name.
+
+Fri Sep 26 14:19:25 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * cvs.h (CVS_CMD_USES_WORK_DIR): Fix comment (the sense of the
+ flag is not reversed from what it would seem; when I thought so it
+ was because I was misreading the lookup_command_attribute code).
+
+Thu Sep 25 23:14:47 1997 Noel Cragg <noel@swish.red-bean.com>
+
+ * parseinfo.c (Parse_Info): fix typo in the trace message.
+
+Thu Sep 25 14:22:54 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * build_src.com: Also link with diff.olb.
+
+ * main.c (Make_Date): If gmtime returns NULL, try localtime.
+
+Wed Sep 24 19:18:40 1997 Noel Cragg <noel@swish.red-bean.com>
+
+ * checkout.c (checkout): fix typo in comment.
+
+Wed Sep 24 08:31:46 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * update.c (patch_file): Revise comments about diff -a now that
+ diff is librarified.
+
+Sun Sep 21 21:28:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * run.c (call_diff): Sleep for a second, in hopes of helping with
+ out of order bugs.
+
+Sat Sep 20 07:19:18 1997 Tim Pierce <twp@twp.tezcat.com>
+
+ Integrate diff library into CVS.
+ * run.c, cvs.h (call_diff): New function.
+ * rcscmds.c (diff_exec, diff_execv): Get diffs from call_diff
+ instead of running diff as a subprocess.
+ * Makefile.in (cvs): Add ../diff/libdiff.a.
+
+ * diff.c (longopts, diff): Use 131 for --ifdef, fixing Jim's thinko
+ (using 147 for both --side-by-side and --ifdef).
+
+ * sanity.sh (rcslib): Added tests rcslib-diffrgx-*, to test
+ handling of regex diff options.
+
+1997-09-21 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ (Note that this requires that DIFF support -L. I'll be checking
+ in a fix to that in a moment, but I wanted separate checkins in
+ case that helps with clarity).
+ Tweaks to rcsdiff librarification:
+ * sanity.sh (rcslib): Change "cvs" to "${PROG}" and subcommand
+ names (e.g. "add") to "[a-z]*". Former should deal with ${testcvs}
+ being "cvs.old" or something; latter fixes make remotecheck.
+ * rcs.c (make_file_label): Take into account strlen (rev) when
+ allocating space. Removes a FIXME and probably fixes a buffer
+ overrun security hole.
+ * rcscmds.c (RCS_exec_rcsdiff): Remove #if 0'd code to call
+ rcsdiff. Tim says he has compared the new code with rcsdiff code
+ and is confident that the behavior is preserved, so we need to
+ nuke the comment which says this has not been done. #if 0 isn't
+ really a very good way to document the way it used to work anyway;
+ the old code is still in CVS.
+ * diff.c: Add comment about rcsdiff options that we don't support,
+ which Tim had sent in email. Remove -T and -y, as the
+ previous meaning had been very confused.
+
+1997-09-21 Tim Pierce <twp@xochi.tezcat.com>
+
+ Librarify rcsdiff.
+
+ * diff.c (have_rev1_label, have_rev2_label): New variables.
+ (diff): Generate file labels with make_file_label if necessary;
+ pass labels, revisions and working file name to RCS_exec_rcsdiff.
+ * rcscmds.c, cvs.h (RCS_exec_rcsdiff): Completely revised function
+ to eliminate rcsdiff dependency, based on patch from JimK.
+ (diff_execv): New function, to exec diff with explicit -L args.
+ * rcs.c, rcs.h (make_file_label): New function.
+ (RCS_output_diff_options): New function.
+ * sanity.sh (rcslib): New test.
+
+Fri Sep 19 15:08:08 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (RCS_nodeisbranch): Assert that RCS is non-NULL.
+ * commit.c (remove_file), rcs.c (RCS_getversion), rtag.c
+ (rtag_fileproc), status.c (status_fileproc, tag_list_proc), tag.c
+ (tag_fileproc): Call RCS_nodeisbranch not RCS_isbranch
+ in contexts where we know the RCS argument is non-NULL.
+
+ * commit.c (find_fileproc): Pass tag not NULL to Version_TS for
+ the tag.
+ * vers_ts.c (Version_TS): Improve (somewhat) the introductory
+ comment.
+ * sanity.sh (editor): New test editor-9 tests for above fix.
+ Renumber/tweak surrounding tests to fit.
+
+ * log.c (log_version): If p->data is NULL, it is an empty log
+ message.
+ * sanity.sh (rcs-14): New test, tests for above fix (previously
+ this was a coredump).
+
+Thu Sep 18 08:45:05 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (rcs-7): Fix stupid ${TESTDIR} omission.
+
+Wed Sep 17 16:27:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (rcs): New tests rcs-5 through rcs-13 test for
+ getdate.y fix (rcs-12 and rcs-13 both failed with the buggy
+ getdate.y).
+
+Tue Sep 16 00:07:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (editor): Clean up first-dir at end of test.
+
+ * sanity.sh (editor): New tests test do_editor.
+
+ * commit.c (commit): For the client, if we got the log message
+ from do_editor and there was an error, don't toss the message.
+
+Mon Sep 15 14:27:54 1997 martin.sjoelin@ubs.com
+ and Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (RCS_checkout): fwrite in bite-size pieces, not the whole
+ file in one fwrite.
+
+Sun Sep 14 12:23:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * commit.c (check_fileproc): If the file has "conflict
+ indicators", spit a warning and proceed with the checkin.
+ * sanity.sh (conflicts): Adjust tests conflicts-132,
+ conflicts-status-3, conflicts-133, and conflicts-status-4
+ for new behavior.
+
+Fri Sep 12 11:12:34 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * add.c, admin.c, checkin.c, checkout.c, classify.c, commit.c,
+ create_adm.c, cvsrc.c, diff.c, entries.c, find_names.c, hash.c,
+ import.c, lock.c, log.c, logmsg.c, main.c, modules.c, myndbm.c,
+ no_diff.c, parseinfo.c, patch.c, rcs.c, rcscmds.c, recurse.c,
+ remove.c, repos.c, root.c, rtag.c, status.c, subr.c, tag.c,
+ update.c, vers_ts.c, hash.h, rcs.h, options.h.in: Change "CVS 1.4
+ kit" to "CVS source distribution".
+
+ * sanity.sh: Comment out call to "whoami".
+
+Thu Sep 11 10:09:04 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * commit.c (classify_file_internal): Add comment about saving
+ quiet vs. saving really_quiet.
+
+ * sanity.sh (newb-123j0): Use two regexps instead of assuming that
+ expr has "\(", "\|", and "\)". If we want to require the latter,
+ we should check for it up front, rather than let people get
+ halfway through and wonder why the test failed.
+
+Tue Sep 9 19:22:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * expand_path.c (expand_path): If GETPWNAM_MISSING is defined,
+ just give an error instead of calling getpwnam.
+
+ * subr.c (getcaller): If SYSTEM_GETCALLER is defined, call it
+ instead of all the getlogin/getpwuid/etc.
+ * wrapper.c (wrap_setup): Call get_homedir not getpwuid.
+
+Mon Sep 8 17:54:14 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (basicc): Change ls -1 to echo *; according to
+ larry.jones@sdrc.com, ls -1 isn't portable.
+
+Sun Sep 7 07:45:35 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (basic2): In test basic2-64, match usernames with
+ ${username}.
+
+ * root.c: Reindent a few things.
+ * root.c, cvs.h (same_directories): Remove. Never used,
+ portability hassle.
+
+ * add.c (add_directory): When checking for CVSADM, call fncmp not
+ strcmp. I actually suspect this code doesn't do much these days,
+ but fncmp clearly will make more sense than strcmp.
+
+ * rtag.c (rtag_usage), tag.c (tag_usage): Reword to hopefully be
+ clearer that -r takes either numeric or symbolic revision.
+
+ * ignore.c (ign_dir_add, ignore_directory): Reindent. Tweaks to
+ comments.
+
+ * update.c (checkout_file): Only ignore existence_error from
+ unlink_file_dir, not all errors.
+
+ * checkout.c (safe_location): Check for errors from xgetwd.
+ * create_adm.c (Create_Admin): Remove call to xgetwd; it is just
+ debugging code anyway and it wasn't checking for errors.
+
+ * sanity.sh: Add comment about default value for TESTDIR.
+
+ * server.c (serve_log): Change "cvslog" to "log". This
+ (accidental, I presume) error had made it impossible for anonymous
+ users to run "cvs log".
+
+ * classify.c (sticky_ck): Change to take an finfo argument rather
+ than several arguments taken from there. Cleans up the way the
+ calling convention had depended on SERVER_SUPPORT.
+ (Classify_File): Change callers.
+
+ * version.c: Change version number to 1.9.17.
+
+ * Version 1.9.16.
+
+ * recurse.c (do_dir_proc): In combining repository and dir, omit
+ trailing "/." from repository.
+ * sanity.sh (modules3): Adjust test modules3-4 so we test for
+ this fix (this is not just cosmetic; the bug prevented the
+ "Rebuilding administrative file database" from happening).
+ modules2 already tests the "co CVSROOT/modules" usage.
+
+ * checkout.c (checkout_proc): When building top-level CVSADM
+ directory, continue the process of walking up the repository one
+ more level, rather than putting in the same repository as for the
+ first-level directory.
+ * sanity.sh: Adjust tests basicb-1b, basicb-9b, modules3-7f,
+ toplevel-9, and toplevel-11 to test for this fix.
+
+ (For reference, this takes CVS's text segment from 344460 to
+ 344140 bytes. I know, this may seem unimportant, but it is so
+ unusual for programs to shrink and I think it is so cool when they
+ do without losing functionality/clarity/etc).
+ * checkout.c, cvs.h (emptydir_name): New function.
+ * checkout.c (checkout, checkout_proc), modules.c (do_module):
+ Call it instead of duplicating the code to do that.
+
+ * sanity.sh (basicc): Clean up first-dir at end of test.
+
+Sat Sep 6 09:48:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (join): Fix cut and paste error in join-28
+ (/home/kingdon/... -> ${TESTDIR}).
+
+ * recurse.c (start_recursion): If there is no CVSADM and no
+ subdirectories, give an error.
+ * sanity.sh (basicc): New tests, test for this fix.
+
+ * sanity.sh (join): New tests join-25 through join-29 test merging
+ from one branch to a different branch.
+
+ * release.c: In comment about CVSROOTADM_IGNORE, also mention
+ comment just added to entries.c.
+ * entries.c: Expand this comment, especially the part about
+ CVS/Template.
+
+ Keep track of what revisions CVS/Base correspond to:
+ * cvs.h (CVSADM_BASEREV, CVSADM_BASEREVTMP): Added.
+ * entries.c, cvs.h (base_register, base_deregister, base_get,
+ base_walk): New functions.
+ * edit.c (edit_fileproc): Call base_register when setting up CVS/Base.
+ (unedit_fileproc): When taking a file out of CVS/Base, put its
+ revision back into entries, and base_deregister it.
+ * sanity.sh (watch4): New tests watch4-10 through watch4-18 test
+ for above fix.
+
+Fri Sep 5 09:14:10 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c: Only declare start_rsh_server if we are going to
+ define it (!NO_EXT_METHOD).
+
+ * subr.c, cvs.h (check_numeric): New function.
+ * admin.c (admin): Call it.
+ * sanity.sh (admin): New tests admin-10a and admin-10b test for fix.
+
+Thu Sep 4 15:55:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (binwrap2): New tests, test for the ability to specify
+ all files are binary except certain patterns.
+
+ * sanity.sh (modules3): New tests modules3-16 and modules3-17 test
+ for another behavior involving '/' in a module name.
+
+Sun Aug 31 12:03:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * add.c (add): Remove checks for '/' in pathnames.
+ (add): Move code which handles entries and repository inside loop,
+ since these now might be different for each argument. Add code to
+ set finfo.update_dir, finfo.file, and finfo.fullname appropriately
+ even if pathname contains '/'. Replace user variable with
+ finfo.file or finfo.fullname, depending on which is meant. chdir
+ into update_dir for each argument. Likewise for the client code
+ which creates directories.
+ (add_directory): Replace arguments with a single finfo argument.
+ Replace dir with finfo->fullname as needed.
+ (add): Update call to add_directory.
+ * client.c, client.h (send_a_repository): No longer static.
+ * sanity.sh (errmsg2): Adjust tests to test for '/' in pathname.
+
+ * sanity.sh (errmsg2): New tests errmsg2-13 through errmsg2-16
+ test the status quo with respect to '/' in cvs add argument.
+
+Sat Aug 30 17:37:29 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * run.c (run_popen): Add comment on return value.
+ * release.c (release): Check for NULL return from popen.
+
+Fri Aug 29 17:49:20 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c (get_server_responses): Add comment about "ok^M".
+
+Thu Aug 28 13:35:12 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * edit.c (edit_fileproc): If file doesn't exist, give an error.
+ * sanity.sh (devcom2): Tests devcom2-12 through devcom2-17 test
+ for above fix.
+
+Tue Aug 26 16:42:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * subr.c (xmalloc): Reword error message to clarify that memory,
+ not disk space or some other resource, is in question.
+
+Tue Aug 26 01:04:48 1997 Steve Ralston <sralston@ppdpost.ks.symbios.com>
+ and Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * add.c (add_directory): In allocating message, also allocate
+ enough for tag and date related text.
+
+Tue Aug 26 01:04:48 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * update.c (update_dirent_proc): Use update_dir not dir in "new
+ directory" message.
+ * find_names.c (find_dirs): Skip CVSNULLREPOS.
+ (Find_Directories): Add comment about find_dirs skipping CVSATTIC
+ and CVSLCK in working directories.
+ * sanity.sh (basicb): New tests basicb-edir-* test for find_dirs
+ fix. Change other tests to test that Emptydir is not special in
+ non-CVSNULLREPOS contexts.
+
+Sun Aug 17 14:44:57 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * import.c (add_rcs_file): Add comment about -k overriding wrappers.
+
+Sat Aug 16 18:09:05 1997 Martin Sjoelin <martin.sjoelin@ubs.ch>
+ and Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * import.c (add_rcs_file): Before opening the input file
+ when importing, if options is binary, open the file in
+ binary mode.
+
+1997-08-16 enami tsugutomo <enami@ba2.so-net.or.jp>
+
+ * sanity.sh (mcopy): Unset CVSWRAPPERS last of all.
+
+Fri Aug 15 11:11:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * add.c (add_directory): Copy default file attributes from the
+ parent directory to the directory we are creating.
+ * fileattr.h, fileattr.c (fileattr_getall, fileattr_setall):
+ New functions, in support of above.
+ * fileattr.c (fileattr_free): Add comment about fileattr_write
+ maybe not clearing attrs_modified.
+ * sanity.sh (watch4): New test, tests for above fix.
+
+Thu Aug 14 11:08:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * update.c (merge_file, join_file): If wrap_merge_is_copy, treat
+ files as nonmergeable (as we had been treating binary files).
+ (join_file, update_fileproc): Remove previous wrap_merge_is_copy
+ cruft.
+ * sanity.sh (mcopy): New tests, test for above fix.
+ (binfiles2): New tests binfiles2-9a-* correct an oversight.
+ (binfiles, binfiles2): Adjust to reflect wording change from
+ "binary file" to "nonmergeable file".
+ (mwrap): Adjust tests mwrap-8 through mwrap-10 for new behavior.
+
+ * main.c (main): Reword copyright notices to include the latest
+ year, to refer to "other authors" in addition to the ones listed,
+ and to be more concisely formatted.
+
+Wed Aug 13 13:50:00 1997 Larry Jones <larry.jones@sdrc.com>
+
+ * sanity.sh: Replace hard-coded directory with ${TESTDIR}, add
+ join3 to default tests
+
+Wed Aug 13 11:42:24 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcscmds.c: Adjust comment to reflect progress on removing RCS
+ execs outside this file.
+
+Mon Aug 11 10:14:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * vers_ts.c (Version_TS): If vers_ts->vn_rcs == NULL, skip setting
+ modification time in server case as well as local case.
+ * server.c (server_modtime): Add assertion to clarify that caller
+ must assure that vers_ts->vn_rcs != NULL.
+ * sanity.sh (join3): Add file "file2" to test for above fix.
+
+ * modules.c (save_d): When parsing -s option, don't assume that
+ we will hit a space before we hit the '\0'.
+ (struct sortrec): Document allocation policies (status quo except
+ status field is now malloc'd).
+ (cat_module): No longer need to set the '\0' at the end of the
+ status field back to ' ', as it no longer shares storage with the
+ rest field.
+ * sanity.sh (modules): Add "statusmod" to test for above fix.
+
+Sun Aug 10 12:18:31 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh: Remove TODO item about more keyword expansion tests.
+ The keyword test and others cover it pretty well, and such an item
+ isn't useful unless it is specific.
+
+ * sanity.sh (importb): New tests test "cvs import -b".
+
+ * mkmodules.c: Update comment with more reasons why having
+ CVSROOT/passwd be a regular administrative file would be a Bad
+ Idea.
+
+ * server.c (switch_to_user): Add comment about checking for errors
+ from setuid and friends.
+
+Wed Aug 6 13:48:29 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * main.c (main): Add comment about errors writing CVS/Root in
+ need_to_create_root code.
+
+Tue Aug 5 22:05:20 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * entries.c (write_entries): If trouble writing Entries.Backup,
+ make it a warning not an error.
+
+Wed Jul 30 08:42:04 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * parseinfo.c (parse_config): If AUTH_SERVER_SUPPORT is not
+ defined, don't set system_auth.
+
+ * version.c: Change version number to 1.9.15.
+
+ * Version 1.9.14.
+
+ * create_adm.c, cvs.h (Create_Admin): If new argument WARN is set,
+ then make creating the CVS directory itself a warning not a fatal
+ error. New return value indicates whether we did this.
+ * checkout.c (build_one_dir), client.c (call_in_directory):
+ Pass WARN as one.
+ * add.c, client.c, checkout.c, modules.c, update.c: Pass WARN as
+ zero for all other Create_Admin callers.
+ * sanity.sh (toplevel): New test toplevel-12 tests for this fix.
+ * filesubr.c (mkdir_if_needed): Also check EACCES/isdir. Needed
+ to make toplevel-12 test work.
+
+ * sanity.sh (toplevel): New test toplevel-11 and friends test for
+ another variation of the toplevel-9 bug.
+
+Tue Jul 29 12:11:16 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * login.c (construct_cvspass_filename): Revert this change. The
+ main reason is procedural; Karl is not a current CVS developer.
+ The other thing is that the new text doesn't say anything about
+ HOMEDRIVE and HOMEPATH.
+
+Tue Jul 29 11:36:22 1997 Karl Fogel <kfogel@harvey.cyclic.com>
+
+ * login.c (construct_cvspass_filename): error message informs user
+ she may need to set HOME environment variable by hand.
+
+Sun Jul 27 15:36:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * admin.c (admin): Remove comment "XXX send -ko too with i = 0".
+ It turns out to be a description of a bugfix which was applied on
+ 8 Oct 1995, and never should have been in a comment in the first
+ place.
+
+ * admin.c (admin, admin_fileproc): Parse options ourself rather
+ than blindly passing them to RCS.
+ Accordingly, add struct admin_data and function arg_add, and delete
+ global variables ac and av.
+ * sanity.sh (admin): Change admin-3 test to reflect cvs admin -i
+ now being an error.
+ (basicb): Change basicb-21 test to relect the improved error
+ message here.
+
+Sat Jul 26 11:34:51 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (join3): New tests, test a new branch topology and
+ greatest common ancestor.
+
+Fri Jul 25 09:51:49 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * server.c (serve_directory): Repository must start with
+ CVSroot_directory rather than some random pathname.
+
+ * remove.c (remove_fileproc): If there is a numeric sticky tag,
+ don't allow the remove.
+ * commit.c (check_fileproc): Add comment about this case.
+ * sanity.sh (sticky): New tests sticky-15 through sticky-23
+ test for this behavior and the analogous behavior with
+ non-branch sticky tags (which is unchanged).
+
+ * client.c (update_entries): Clear the stored mode, modtime, and
+ checksum even on an error.
+ * sanity.sh (contents2-142d*): Also test cvs status. Also test
+ the case in which the contents of the file are unchanged. Also
+ test running diff to see the conflict, and resolving the conflict.
+ Without the fix above, the new contents2-142d2 test would get a
+ "duplicate Mod-time" warning.
+
+Thu Jul 24 13:29:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * server.c (pserver_authenticate_connection): Call parse_config
+ here too.
+ * parseinfo.c (parse_config): If we are called several times, the
+ times beyond the first do nothing.
+ * cvs.h, parseinfo.c (parse_config): New argument cvsroot.
+ * server.c, main.c: Update callers.
+ * server.c, server.h (system_auth): New variable.
+ * parseinfo.c (parse_config): Parse new keyword SystemAuth.
+ * mkmodules.c (config_contents): Add comments for SystemAuth.
+ * server.c (check_password): If !system_auth, then skip the check
+ for a system username/password.
+
+ * main.c (main): No fatal error if parse_config returned an error.
+ * server.c (serve_root): Likewise.
+ * error.c (error): Add comment about calling from the server.
+ * parseinfo.c, cvs.h (parse_config): Remove NOERR crock.
+ Closer reading of server.c makes it seem like calling error
+ here is OK after all.
+ * sanity.sh (config): New test, tests for above fix.
+
+ * server.c (serve_root): Fix typo ("doign" -> "doing").
+
+Wed Jul 23 13:55:09 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * vers_ts.c (Version_TS): If entdata is for a directory, don't set
+ vn_user and friends.
+ * server.c (dirswitch): Add comment about why Subdir_Register is
+ sometimes a noop here.
+ * cvs.h (struct vers_ts): Fix comments about NULL vs. "" in vn_user.
+ * sanity.sh (errmsg2): New tests errmsg2-10 through errmsg2-12 test
+ for above fix.
+ * add.c (add_directory): Call cvs_output not printf. This fixes
+ an out-of-order bug which was showing up in the testcase.
+
+21 Jul 1997 Jim Kingdon
+
+ * subr.c (get_file): Put st_size into an unsigned variable to
+ avoid signed/unsigned warnings.
+
+Mon Jul 21 00:19:30 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * version.c: Change version number to 1.9.13.
+
+ * Version 1.9.12.
+
+ * sanity.sh (toplevel, head): Delete our files from the repository
+ when done with them.
+
+Sun Jul 20 15:53:08 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (admin, reserved): New tests, test most cvs admin
+ behaviors.
+ (log2): New tests log2-5 through log2-10 test setting the
+ description via cvs admin.
+
+Thu Jul 17 12:39:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c (socket_buffer_input, socket_buffer_output): Add
+ comment regarding size of of buffer we pass to send and recv.
+
+Sat Jul 12 15:21:24 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * import.c, rcs.h (add_rcs_file): New argument key_opt replaces
+ access to global variable keyword_opt. New arguments desctext and
+ desclen allow one to set the description. If add_vhead is NULL,
+ then omit a revision, like rcs -i.
+ * import.c (process_import_file), mkmodules.c (init): Change
+ callers.
+ * subr.c, cvs.h (get_file): New function, adapted from code in
+ update_entries.
+ * client.c (update_entries): Call it.
+ * commit.c (checkaddfile): Create new RCS files with add_rcs_file
+ rather than rcs -i.
+
+Fri Jul 11 12:14:54 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * update.c (join_file): Handle binary files ourself rather than
+ passing them to RCS_merge (which sort of tries to handle binary
+ files, but does so badly).
+ * sanity.sh (binfile2): New "brmod", "brmod-trmod", and
+ "brmod-wdmod" tests test for this fix.
+
+ * add.c (add): Exit status is now nonzero if any of the arguments
+ failed (already was mostly true, make it true for the new sanity
+ check). Move check for '/' (now ISDIRSEP) up to sanity check, so
+ the client does it too.
+ * sanity.sh (errmsg2): Test for this fix.
+
+Thu Jul 10 00:02:54 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * add.c (add): Check for CVSADM, ".", and "..", and skip any
+ attempt to add them.
+ * sanity.sh (errmsg2): New tests, tests for above fix.
+
+ * main.c (main): In text printed upon --version, also refer
+ people to --help.
+
+ * rcscmds.c (RCS_exec_rcsdiff): Add comment about timezones.
+
+ * server.c, cvs.h (cvs_output_binary): New function.
+ * rcs.c (RCS_checkout): For a binary file, call cvs_output_binary
+ rather than cvs_output.
+ * client.c (handle_mbinary): New function.
+ (responses): Add "Mbinary".
+
+Tue Jul 8 12:18:16 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * filesubr.c (get_homedir): Add comment about root vs. user
+ directory in pserver server.
+
+Mon Jul 7 14:39:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (big): Also test Rcs-diff case.
+
+ * client.c (update_entries): Reindent a line.
+
+ * sanity.sh (death2): Add comment about Sun diff. Thanks to
+ Warren Jones <wjones@TC.FLUKE.COM> for reporting this.
+
+ * client.c (update_entries): If DONT_USE_PATCH, then just treat a
+ Patched response as an indication to try again with complete files.
+ * update.c (update): Remove DONT_USE_PATCH ifdefs, since a CVS
+ with DONT_USE_PATCH defined can still handle Rcs-diff.
+ * sanity.sh (serverpatch): Add comment about this coming up in
+ real life if the user modifies the file while CVS is running.
+
+ * client.c (start_server): Add comment about logfiles if there are
+ several connections to the server.
+ (log_buffer_shutdown): Close the logfile after shutting down the
+ underlying buffer. This way at least we get the last set of
+ logfiles rather than a bizarre mishmash.
+
+1997-07-06 enami tsugutomo <enami@but-b.or.jp>
+
+ * logmsg.c (do_verify): Unlink temporary file before call error().
+ Remove unneeded `return' statement. Fix comment.
+
+Sun Jul 6 13:36:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * diff.c (diff_fileproc): Change message from "during rcsdiff of"
+ to "while diffing". For a while now, that message might be
+ printed after a call to DIFF instead of rcsdiff.
+
+ * diff.c (diff_fileproc): Call cvs_output not printf. Remove
+ calls to fflush (should be handled now by call to cvs_outflush in
+ recurse.c).
+ * patch.c (patch_fileproc): Likewise.
+
+ * rcscmds.c, cvs.h (diff_exec): New function.
+ * diff.c (diff_fileproc), patch.c (patch_fileproc),
+ update.c (patch_file): Call it.
+
+ * rcscmds.c: Adjust comments concerning diff library to point to
+ new, expanded comments at diff_exec. Remove comments concerning
+ patch library; Rcs-diff should be adequate.
+
+ * client.c (update_entries): Add comment about GNU patch usage (-b
+ option and so on).
+
+Sat Jul 5 04:13:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcscmds.c, cvs.h (RCS_exec_rcsdiff): New function.
+ * diff.c (diff_fileproc): Call it.
+
+Thu Jul 3 09:50:07 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * main.c (main): Add comment about how long we should keep the
+ deprecated "cvs rlog" alias.
+
+ * server.c (cvs_output): Add comment about whether to fflush.
+
+Wed Jul 2 18:57:29 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (join2): New tests join2-19 and friends test for a
+ case that we can't readily get right (see comments).
+
+Tue Jul 1 09:52:09 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * main.c (cmd_usage): Say "specify" --help rather than the vague
+ "use".
+ (opt_usage, cmd_synonyms): Mention --help here too.
+ * add.c, admin.c, checkout.c, commit.c, diff.c, edit.c, import.c,
+ log.c, login.c, mkmodules.c, patch.c, rcs.c, release.c, remove.c,
+ rtag.c, status.c, tag.c, update.c, watch.c: Likewise, for all the
+ other help messages.
+
+ * sanity.sh (join2): New tests.
+
+ * repos.c (Name_Repository): Check for errors from fclose.
+
+Fri Jun 27 10:27:48 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * scramble.c, login.c: Reindent.
+
+ * client.c (connect_to_pserver): Check for errors from send().
+ If socket() fails, include SOCK_STRERROR (SOCK_ERRNO) in message.
+
+Wed Jun 25 11:21:52 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * main.c: New option --help-options, with much of the text
+ from --help. Fix a few capitalization and punctuation problems.
+ Rewrite text for --help to be an intro to all the --help-*
+ options.
+
+ * sanity.sh (head): New tests, concerning meaning of HEAD.
+
+Tue Jun 24 10:14:18 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c (recv_line): New function.
+ (connect_to_pserver): Call it, and rewrite accordingly. Also
+ accept new "E" and "error" responses. Change \n to \012.
+ * server.c (pserver_authenticate_connection): Adjust comment
+ accordingly, concerning sending I HATE YOU not "error".
+
+Sun, 22 Jun 1997 Jim Kingdon
+
+ * main.c (main): Move setting of server_active inside #ifdef
+ SERVER_SUPPORT; otherwise the variable doesn't exist.
+ * main.c (main): Call return after exit to shut up warning.
+
+Fri Jun 20 22:56:34 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c (connect_to_pserver): On "I HATE YOU", give
+ "authorization failed" fatal error regardless of verify_only.
+ * login.c (login): Don't print that "incorrect password" message;
+ it now is possible with an --allow-root failure as well as an
+ incorrect password. cvsclient.texi doesn't really specify what I
+ HATE YOU means in any detail, and it seems a little silly for
+ login to give different messages than the other commands.
+ * client.c, client.h (connect_to_pserver): Return type now void.
+
+Thu Jun 19 12:16:10 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * server.c (serve_root): Give error on duplicate Root request.
+ Call parse_config.
+ * parseinfo.c, cvs.h (parse_config): New function.
+ * cvs.h (CVSROOTADM_CONFIG): Added.
+ * main.c (main): Set server_active here...
+ * server.c (server): ...not here. That seems cleaner than
+ strcmp's between command_name and "server" in main.c.
+ * main.c (main): Call parse_config.
+ * main.c, cvs.h (free_Rcsbin): Make global.
+ * mkmodules.c (filelist): Add CVSROOTADM_CONFIG.
+
+Wed Jun 18 11:24:31 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * version.c: Change version number to 1.9.11.
+
+ * Version 1.9.10.
+
+Tue Jun 17 22:48:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * main.c (main): Add --allow-root=ROOT argument; call
+ root_allow_add for each time it is specified. Call
+ root_allow_free before exiting.
+ * root.c, cvs.h (root_allow_add, root_allow_free, root_allow_ok):
+ New function.
+ * server.c (pserver_authenticate_connection): If root_allow_ok
+ doesn't like the CVSROOT directory, don't allow access.
+
+Tue Jun 17 14:30:14 1997 Jim Kingdon (unknown@beezley)
+
+ * client.c: Add "copyright" notice. If NO_EXT_METHOD, omit
+ start_rsh_method.
+ * client.c (update_entries): Cast argument to MD5Update from
+ char * to unsigned char *.
+
+Mon Jun 16 16:46:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * run.c (piped_child, filter_stream_through_program):
+ If USE_SETMODE_BINARY, then put the pipes into binary mode.
+ * find_names.c, ignore.c, lock.c, wrapper.c: Change fnmatch to
+ CVS_FNMATCH.
+ * client.c (start_server): If NO_EXT_METHOD, then give a fatal
+ error on any use of :ext:.
+
+Sun Jun 15 22:30:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (toplevel): Match U CVSROOT/* lines with DOTSTAR in
+ test toplevel-9.
+
+Thu Jun 12 10:27:51 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (toplevel): Remove Emptydir before starting.
+
+ * sanity.sh: Change "rm -rf" to "rm -r" when deleting working
+ directories (except a few watches cases). Helps detect cases
+ where the testsuite has cd'd to somewhere other than where we
+ think it has.
+ (basic2): Remove "rm -r first-dir" between tests 49 and 50. The
+ directory was already deleted in test 45.5.
+ (rcs): Add "cd .." at end of tests.
+ (stamps): No longer cd to TESTDIR; shouldn't be necessary with
+ fix to "rcs" test.
+
+Wed Jun 11 22:28:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (basicb): Also remove CVSROOT/Emptydir at end of
+ test. Otherwise it affects the toplevel-9 test for remote.
+
+Tue Jun 10 14:03:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (toplevel): Change "update" and "checkout" to "[a-z]*"
+ as these read "server" instead for "make remotecheck". Change
+ expect strings for toplevel-9 to accept the behavior of remote CVS
+ (see comments for more discussion).
+
+ * sanity.sh: New tests stamps-9 through stamps-11 test timestamp
+ behavior on cvs update.
+
+Mon Jun 9 22:42:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh: Remove "#! /bin/zsh" line at end. I assume it was
+ added accidentally.
+
+Tue Jun 10 03:08:46 1997 Norbert Kiesel <nk@psycho.de>
+
+ * sanity.sh: new tests "toplevel" for the new toplevel CVS
+ directory creation (including one test which shows an error in
+ this area).
+
+Sun Jun 8 20:52:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.c (getrcsrev): Before printing error, check whether it was
+ feof or ferror.
+
+ * rcs.h, import.c (add_rcs_file): No longer static. New arguments
+ add_vbranch, add_vhead, and add_logfp replace access to static
+ variables vbranch, vhead, and logfp.
+ * mkmodules.c: Call it instead of RCS_CI.
+ * import.c (process_import_file): Adjust call to add_rcs_file.
+
+Tue Jun 3 10:18:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (basicb): Match "." with "\." not ".".
+
+Tue Jun 3 13:02:37 1997 Norbert Kiesel <nk@cosa.de>
+
+ * checkout.c (checkout): Removed restriction of not sending -k in
+ remote export (I think this was introduced while the -k handling
+ was still broken in remote mode). Give better error texts
+ regarding -c and -s options. Use error() instead of usage() for
+ reporting errors in all places. Reindented some lines. Free
+ xmalloc'd space of options.
+
+Thu May 29 16:32:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcscmds.c (RCS_checkin), mkmodules.c (init): Pass -w option to
+ "ci", specifying getcaller ().
+ * server.h, server.c (CVS_Username): Now extern.
+ * subr.c (getcaller): Return CVS_Username if it is set.
+
+Wed May 28 22:31:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * update.c (update_fileproc): If wrap_merge_is_copy and we would
+ like to do a merge, give a fatal error. See comment for why.
+ * sanity.sh (mwrap): New tests, tests for above fix.
+
+Tue May 27 21:59:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (stamps): cd to ${TESTDIR} before starting.
+
+Mon May 26 15:31:30 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c (handle_mod_time): New function.
+ (responses): Add "Mod-time".
+ (stored_modtime_valid, stored_modtime): New variables.
+ (update_entries): If it is set, change the file's modtime.
+ * server.c, server.h (server_modtime): New function.
+ * vers_ts.c (Version_TS): Call it.
+ * patch.c (patch_fileproc): Add comment about why we don't.
+ * sanity.sh (stamps): Added, tests for above fix.
+
+Fri May 16 13:14:30 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * subr.c (free_names): Update documentation to reflect fact that
+ free_names is now called to free vectors allocated by expand_wild
+ as well as by line2argv.
+
+ * main.c (main): Use "xstrdup (foo)" not "xstrdup(foo)" as
+ specified in HACKING.
+
+Fri May 16 15:10:37 1997 Norbert Kiesel <nk@cosa.de>
+
+ * modules.c (do_module): initialize optind to 0. use local copies
+ of optarg's (because they might me freed within free_names).
+
+Thu May 15 11:50:15 1997 Norbert Kiesel <nk@cosa.de>
+
+ * main.c (main): initialize optind to 0. use local copies of
+ optarg's (because they might me freed within read_cvsrc).
+
+ * cvsrc.c (read_cvsrc): free old argv after constructing a new
+ one. This fixes a memory leak.
+
+ * recurse.c (start_recursion): use free_names() instead of
+ reimplementing it
+
+ * rcs.c (RCS_deltas): free branchversion (memory leak).
+
+ * parseinfo.c (Parse_Info): free some vars (3 memory leaks).
+
+ * logmsg.c (logfile_write): free str_list_format (memory leak).
+
+ * watch.c (watch_addremove), (watchers), update.c (update), tag.c
+ (cvstag), status.c (status), rtag.c (rtag), remove.c (cvsremove),
+ release.c (release), patch.c (patch), log.c (cvslog), import.c
+ (import), history.c (history), edit.c (watch_onoff), (edit),
+ (unedit), (editors), diff.c (diff), commit.c (commit), checkout.c
+ (checkout), add.c (add): initialize optind to 0
+
+ * diff.c (diff_fileproc): cosmetic change (whitespace added).
+
+ * checkout.c (checkout): move local variable definition into the
+ block where the variable is used.
+
+ * client.c (update_entries): initialize some local variables to shut up
+ gcc -O -Wall.
+
+ * buffer.c (buf_read_line): initialize a local variable to shut up
+ gcc -O -Wall.
+
+
+Wed May 14 16:29:50 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * admin.c (admin): When sending options to server, don't try to
+ send av[ac]. It may contain one of the names that we'll send in
+ send_file_names (which caused tests like keyword-6 to work,
+ sort of accidentally), or it may contain NULL (which would tend to
+ cause a coredump).
+ * sanity.sh (basicb): New test basicb-21 tests for above fix.
+
+Mon May 12 16:22:00 1997 Larry Jones <larry.jones@sdrc.com>
+
+ * add.c (add): Free message and repository in client code.
+ * checkout.c (checkout): Don't free repository unless allocated.
+ * client.c (start_rsh_server): Free command.
+
+Sun May 11 11:43:54 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c: Remove all references to USE_DIRECT_TCP; see
+ ../ChangeLog for rationale.
+
+Fri May 9 22:19:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * main.c (main): Add comment explaining why we call exit. Pass 0
+ not EXIT_SUCCESS, because lib/system.h has portability cruft for
+ EXIT_FAILURE but not EXIT_SUCCESS.
+
+Fri May 9 17:25:00 1997 Larry Jones <larry.jones@sdrc.com>
+
+ Fix miscellaneous memory allocation problems:
+ * add.c (add): Free repository.
+ * client.c (notified_a_file): Free getline buffer.
+ * edit.c (notify_check): Free getline buffer.
+ * hash.c (dellist): Free header node when not caching.
+ * login.c (login): Don't continually free & allocate getline
+ buffer, use xstrdup instead of xmalloc/strcpy, free getline
+ buffer before returning.
+ * main.c (main): Call exit instead of returning so tools like
+ Purify won't consider permanently allocated memory as leaks.
+ * mkmodules.c (mkmodules): Free getline buffer.
+ * modules.c (cat_module): Call close_module.
+ * rcs.c (rcsvers_delproc): Free state.
+ * recurse.c (start_recursion): Free files_by_dir.
+ (unroll_files_proc): NULL out p->data after using it to set
+ filelist to avoid multiple frees.
+ * server.c (check_command_legal_p): Don't continually free &
+ allocate getline buffer, free getline buffer before returning.
+ (check_repository_password): Ditto, use xstrdup instead of
+ xmalloc/strcpy.
+ * wrapper.c (wrap_add_file): Free getline buffer.
+
+Thu May 8 14:21:00 1997 Larry Jones <larry.jones@sdrc.com>
+ and Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * checkout.c (checkout_proc): Free finfo.rcs (memory leak).
+
+8 May 1997 Larry Jones <larry.jones@sdrc.com>
+ and Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * hash.c: Add #ifdef's to disable caching. This makes it easier
+ to track down memory allocation problems.
+
+Thu May 8 11:40:39 1997 Larry Jones <larry.jones@sdrc.com>
+
+ * sanity.sh: In setting "tests" use a number of statements rather
+ than one very long line.
+
+Thu May 8 11:40:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * cvsbug.sh: Remove $Id; we decided to get rid of these some time
+ ago.
+
+Thu May 8 11:34:02 1997 Larry Jones <larry.jones@sdrc.com>
+
+ * cvsbug.sh: Put separate statements on separate lines, so it
+ works if awk is AT&T nawk.
+
+Tue May 6 16:56:00 1997 Larry Jones <larry.jones@sdrc.com>
+ and Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * cvsrc.c (read_cvsrc): Fix various memory allocation problems:
+ rearrange code to avoid leaks, use xrealloc instead of xmalloc/
+ copy/free, make sure there's room for the remaining args before
+ appending them.
+
+Tue May 6 14:20:00 1997 Larry Jones <larry.jones@sdrc.com>
+
+ * edit.c (watch_onoff, edit, unedit, editors): Add -R like
+ other things with -l.
+ * watch.c (watch_addremove, watchers): Ditto.
+
+Mon May 5 18:10:37 1997 larry.jones@sdrc.com
+ and Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh: Change all /tmp/cvs-sanity to TESTDIR. If TESTDIR
+ environment variable is set, use it instead of /tmp/cvs-sanity.
+ * sanity.sh: Make TMPPWD the pwd equivalent of TESTDIR, not of /tmp.
+
+4 May 1997 Larry jones <larry.jones@sdrc.com>
+ and Jim Kingdon
+
+ * checkout.c, diff.c, patch.c, rcs.c: Update usage messages.
+ * rcs.c (annotate): Add -R like other things with -l.
+
+Sat May 3 14:57:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (basic1): Rewrite test (use dotest, unroll the loops
+ which IMHO makes the test a zillion times more understandable, and
+ only do the variant which tests for 4 files at a time--we test one
+ file at a time lots of places).
+
+2 May 1997 Ziv Gigus <ziv@rest.home.net>
+ and Jim Kingdon
+
+ * client.c, client.h (client_process_import_file): New argument
+ all_files_binary means treat all files as binary.
+ * import.c (import_descend): Pass it if -kb is specified.
+ * client.c (client_process_import_file): In the
+ non-all_files_binary case, call wrap_rcsoption to determine
+ whether the file is binary.
+
+Thu May 1 13:44:51 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (binfiles2): New tests, for update -j and binary files.
+
+Wed Apr 30 11:18:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * recurse.c (start_recursion): Also free reposfile.
+ Don't look in repository if client_active (latter bug reported by Paul
+ Sanders <p.sanders@dial.pipex.com>).
+
+Mon Apr 28 22:36:39 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * diff.c (diff_file_nodiff): Remove SERVER_SUPPORT ifdefs. They
+ were not based on server_active, which doesn't really make any
+ sense (it meant that compiling --disable-server could affect the
+ behavior of the non-client/server CVS). This affected the output
+ in tests death2-diff-11 and death2-diff-12 in the testsuite.
+ * sanity.sh (newb-123j0): Also accept "Needs Checkout", for a
+ --disable-server CVS.
+
+ * main.c (cmd_usage): Change "run diffs" to "show differences";
+ the former is jargon.
+ * edit.c (edit_usage): Fix typo ("." -> ",").
+ * edit.c (editors_usage), watch.c (watchers_usage): Mention -l.
+ * checkout.c (export_usage): Say what -P does.
+ * history.c (history_usg): Add comment about message wording.
+
+Mon Apr 28 14:47:45 1997 Norbert Kiesel <nk@cosa.de>
+
+ * checkin.c (Checkin): use filename without path when calling
+ wrapper (bug found by Michal Schmitz <ms@cosa.de>).
+
+Fri Apr 25 13:28:55 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * client.c (update_entries): In UPDATE_ENTRIES_RCS_DIFF case,
+ write to a temporary file and then rename it.
+
+Thu Apr 24 11:35:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * subr.c, cvs.h (pathname_levels): New function, from a piece of
+ send_file_names.
+ * client.c (send_file_names): Call pathname_levels in place of the
+ code which was moved there.
+ * server.c, server.h (server_pathname_check): New function.
+ * recurse.c (start_recursion): Call it.
+ * sanity.sh (modules3): New test modules3-11b tests for above fix.
+
+ * filesubr.c: Do not define L_tmpnam. It is in ANSI and SunOS4,
+ so I don't think there will be a problem with it being missing.
+ Defining it too small can cause memory corruption.
+ (cvs_temp_name): Do not use L_tmpnam in the mktemp code; this
+ could cause a buffer overflow if the -T global option was in use.
+
+Thu Apr 24 13:21:15 1997 Norbert Kiesel <nk@cosa.de>
+
+ * filesubr.c (cvs_temp_name): Use tempnam if available, else
+ mktemp, else tmpnam. See the comment for rationale.
+
+ * sanity.sh: use "tar cf - ." instead of "tar cf - *" for
+ directory copies.
+
+Wed Apr 23 23:41:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * server.c (serve_update_prog): If in readonly mode, give an error.
+
+Wed Apr 23 19:07:41 1997 Norbert Kiesel <nk@cosa.de>
+
+ * subr.c (line2argv): Allocate at least 4 slots for argv.
+
+ * checkout.c (checkout_proc): Add a comment which says why the
+ above change was necessary to avoid writing to unallocated memory.
+
+Wed Apr 23 11:20:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * entries.c (ParseTag): Always set *NONBRANCHP.
+
+21 Apr 1997 Jim Kingdon
+
+ * client.c (update_entries), rcs.c (expand_keywords): Rewrite
+ test to avoid signed/unsigned warning.
+
+Mon Apr 21 09:02:22 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * update.c (patch_file): Add comment about whether auto-detecting
+ features of the DIFF program is a good idea.
+
+Mon Apr 21 00:03:34 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ Don't require the patch program:
+ * client.c (struct update_entries_data): Add
+ UPDATE_ENTRIES_RCS_DIFF to contents enum.
+ (update_entries): Handle UPDATE_ENTRIES_RCS_DIFF.
+ (handle_rcs_diff): New static function.
+ (responses): Add "Rcs-diff".
+ * server.c (server_updated): Handle SERVER_RCS_DIFF.
+ (server_use_rcs_diff): New function.
+ * server.h (enum server_updated_arg4): Add SERVER_RCS_DIFF.
+ (server_use_rcs_diff): Declare.
+ * update.c (rcs_diff_patches): New static variable.
+ (update): Set rcs_diff_patches.
+ (update_fileproc): If rcs_diff_patches, pass SERVER_RCS_DIFF
+ rather than SERVER_PATCHED to server_updated.
+ (patch_file): Correct initial comment to say diff rather than
+ rcsdiff. If rcs_diff_options, pass -n to diff rather than -c.
+ * rcs.c (rcs_change_text): New function.
+ * rcs.h (rcs_change_text): Declare.
+
+Mon Apr 21 00:08:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * diff.c (diff_fileproc): Add comment concerning updating the
+ client timestamp.
+
+Sun Apr 20 23:20:37 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * commit.c (commit): Add comment regarding SEND_FORCE rationale.
+
+Sat Apr 19 17:10:36 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * server.c (dirswitch): If directory ends in '/', complain.
+
+Fri Apr 18 18:09:57 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * rcs.c (apply_rcs_changes): New static function, broken out of
+ RCS_deltas.
+ (RCS_deltas): Call it.
+ (linevector_add): Change return type to int. Return an indication
+ of an error for an invalid add, rather than calling error.
+
+Fri Apr 18 11:24:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * version.c: Change version number to 1.9.9.
+
+ * version.c: Version 1.9.8.
+
+ * commit.c (struct find_data): Add field force.
+ (find_fileproc, commit): Use it instead of force_ci to decide
+ whether to send files to server.
+ (commit): Set it if either -f or -r is specified.
+ * sanity.sh (basica): Add tests basica-8a0, basica-8a1, and
+ basica-8a2; tests for above fix.
+
+Wed Apr 16 11:50:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * zlib.c: Remove paragraph with Free Software Foundation address.
+ See 2 Jan 1997 entry in ../ChangeLog for rationale.
+
+Tue Apr 15 00:36:23 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * update.c (patch_file_write): Always assign to final_nl, so that
+ it ends up reflecting whether the data from the last call had a
+ newline, not whether the data from any of the calls ended in a
+ newline. Doesn't matter with the current RCS_checkout
+ implementation, but it will if RCS_checkout is changed to pass
+ less than the entire file.
+
+ * rcs.c (RCS_cmp_file): Change NULL to RUN_TTY in passing sout to
+ RCS_checkout, for clarity.
+
+ * import.c (update_rcs_file): Remove unused variable ierrno.
+
+ * add.c, checkout.c, commit.c, diff.c, edit.c, import.c,
+ history.c, log.c, main.c, patch.c, release.c, remove.c, rtag.c,
+ status.c, tag.c, update.c, watch.c: Pass "+" to all calls to
+ getopt. This ensures that we maintain existing behavior even with
+ glibc2.
+
+ * filesubr.c (fopen_case): Don't set *PATHP if we return an
+ error. Since the 9 Apr 1997 change, the behavior has been to
+ sometimes set it and sometimes not.
+ * rcs.c (RCS_parse): Adjust callers to not free it. Without this
+ change, they could call free() on an uninitialized variable.
+
+ * checkout.c (checkout): Add comment about export -k.
+
+ * root.c (check_root_consistent): Add comment about wording of
+ message.
+
+Mon Apr 14 11:51:49 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c (call_in_directory): If rdirp reaches the end of
+ reposdirname, then just set it to NULL. If server does not create
+ directories one at a time, give a warning.
+ * sanity.sh (modules3): Enable tests modules3-8 through
+ modules3-11 for remote; tests for above fix.
+
+ * client.c (call_in_directory): Don't set short_pathname to
+ pathname for a while; just use pathname itself (cleans up a relic
+ of the old "Repository" (not "Directory") code). Add comment
+ explaining short_pathname.
+
+Sun Apr 13 18:07:50 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * rcs.c (RCS_checkout): Add pfn and callerdat parameters. Change
+ all callers. Move setting of expand after retrieval of file
+ data.
+ (struct cmp_file_data): Define.
+ (RCS_cmp_file): New function.
+ (cmp_file_buffer): New static function.
+ * rcs.h (RCSCHECKOUTPROC): Define type.
+ (RCS_checkout): Update declaration.
+ (RCS_cmp_file): Define.
+ * diff.c (diff_file_nodiff): Call RCS_cmp_file rather than
+ RCS_checkout and xcmp.
+ * import.c (update_rcs_file): Likewise.
+ * no_diff.c (No_Difference): Likewise.
+ * update.c (struct patch_file_data): Define.
+ (patch_file): Just return if noexec, or if binary file. Pass
+ patch_file_write to RCS_checkout. Don't check for newlines or
+ compute checksums here. Stat RCS file to set modes.
+ (patch_file_write): New static function.
+
+ * update.c (patch_file): Checkout directly to file2, rather than
+ to finfo->file followed by rename. Remove check for whether
+ result of checkout is readable; that was for an old, obsolete,
+ form of death support.
+
+Sun Apr 13 13:16:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * checkout.c (build_one_dir): New function.
+ (struct dir_to_build): New structure.
+ (build_dirs_and_chir): Rewritten to accept a linked list of struct
+ dir_to_build rather than the silly string processing we had been
+ doing before.
+ (checkout_proc): Rewrite code that calls build_dirs_and_chdir
+ accordingly.
+ * sanity.sh: Enable tests modules3-10 and modules3-11 for local CVS;
+ tests for above fix.
+
+ * rcs.h (RCS_CO): Removed; no longer used.
+
+Sun Apr 13 00:04:34 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ Expand RCS keywords internally; never call co:
+ * rcs.h (struct rcsversnode): Add state field.
+ * rcs.c (kflags): Move out of RCS_check_kflag, and make file
+ static.
+ (enum kflag): Define.
+ (RCS_reparsercsfile): Always save lock information. Save state in
+ new state field, rather than other field.
+ (struct rcs_keyword): Define.
+ (keywords): New static variable.
+ (enum keyword): Define.
+ (printable_date, escape_keyword_value): New static functions.
+ (expand_keywords): New static function.
+ (RCS_checkout): Call expand_keywords. Don't call
+ RCS_exec_checkout.
+ (RCS_deltas): Add log and loglen parameters. Change all callers.
+ * log.c (log_version_requested): Use new state field.
+ (log_version): Likewise.
+ * cvs.h (RCS_exec_checkout): Don't declare.
+ * rcscmds.c (RCS_exec_checkout): Remove.
+
+Sat Apr 12 17:32:59 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * sanity.sh (modules3): Remove second-dir at end of tests.
+ (sticky): Correct removal of directories at end of tests.
+
+ * sanity.sh (keyword): New tests for RCS keyword expansion.
+
+Sat Apr 12 16:47:13 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (basicb): New tests basicb-1b, basicb-1c, basicb-9b,
+ basic-9c test current build_dirs_and_chdir behavior.
+
+Fri Apr 11 23:54:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (modules3): New tests modules3-7* test for ability to
+ supply a path in -d in modules. Similar to modules3-8 through
+ modules3-11 except because the nesting is different, these ones
+ work.
+
+Thu Apr 10 00:14:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (modules3): New tests modules3-12 through modules3-15
+ test use of a module name which contains a slash.
+
+ * sanity.sh (basicb): New tests basicb-14 to basicb-20 test use of
+ co -d with two or more arguments.
+
+ * rcscmds.c: Refer to doc/RCSFILES in comment.
+
+Wed Apr 9 09:49:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (basicb): New tests basicb-11 through basicb-13 test
+ ability to specify several directory levels in co -d (commented
+ out).
+
+ * filesubr.c (fopen_case): If CVS_OPENDIR gives an
+ existence_error, return it to the caller instead of giving a fatal
+ error.
+
+ * client.c (update_entries): Fix typo in call to error (1 -> errno).
+
+Tue Apr 8 23:02:22 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * error.h, error.c: Test for #ifdef __STDC__, not #if __STDC__.
+ This is consistent with other parts of CVS; it means that the
+ declaration for fperror will match the definition even if __STDC__
+ is defined to 0 as the SunPro 4.0 compiler does. Reported by
+ Richard Smith <rjsmith@cisco.com>.
+
+2 Apr 1997 Jim Kingdon
+
+ * entries.c (ParseTag): Add "break;" after "default:" to avoid
+ error from Visual C++.
+
+Wed Apr 2 12:06:44 1997 Vince Del Vecchio <vdelvecc@spd.analog.com>
+ and Jim Kingdon
+
+ * client.c: In reporting errors from socket calls, use
+ SOCK_STRERROR and SOCK_ERRNO since strerror(errno) doesn't work
+ for Win32.
+
+Tue Apr 8 10:45:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (modules3): Add tests modules3-8 to modules3-11, to
+ test for ability to supply a path to -d in modules. Mostly
+ commented out as CVS is buggy in this area.
+
+Mon Apr 7 12:41:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * add.c (add): Add comment about SEND_NO_CONTENTS.
+
+Sun Apr 6 21:46:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * update.c (update): Add comment about noexec and SEND_NO_CONTENTS.
+
+Sun Apr 6 17:34:08 1997 Robert Bihlmeyer <robbe@orcus.priv.at>
+
+ * Pass +f not f to getopt_long to prevent options from being
+ permuted with glibc 2.0.1.
+
+Sun Mar 30 00:07:05 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * cvs.h (struct vers_ts): Adjust comment regarding ts_user.
+ * server.c (serve_is_modified): New function. Set entries to show
+ that the file is modified but we don't know the contents.
+ * server.c (requests): Add "Is-modified" request.
+ * vers_ts.c (time_stamp_server): If the timestamp in entdata is
+ "M" or "D", just copy that over into ts_user.
+ * vers_ts.c (Version_TS): If timestamp is "D", use the entries
+ line for the sole purpose of passing it to time_stamp_server.
+ * no_diff.c (No_Difference): If ts_user is "M", conclude the files
+ are different.
+ * client.h, client.c (send_files): Replace arguments build_dirs
+ and force with argument flags. Add flag SEND_NO_CONTENTS and add
+ to struct send_data.
+ (send_fileproc): If no_contents, then send Is-modified instead of
+ Modified.
+ * add.c, admin.c, client.c, commit.c, diff.c, edit.c, log.c,
+ rcs.c, remove.c, status.c, tag.c, update.c, watch.c: Change all
+ send_files callers.
+
+Fri Mar 28 22:32:25 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * server.c (requests): Change "Repository" to rq_optional. I'm
+ not sure whether I overlooked this when I removed support for
+ Repository, or whether I was thinking that servers would need to
+ support it anyway, for CVS 1.5 to 1.9 clients, but making it
+ optional doesn't prevent the server from supporting it and it
+ seems silly for the client to complain about absence of a request
+ that it never will use.
+
+Fri Mar 28 10:06:59 1997 Steven Miller <Miller@wingra.com>
+
+ * entries.c (Subdirs_Known): Don't create Entries.Log if noexec.
+
+Thu Mar 27 18:14:12 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * sanity.sh (death2): Remove commented out test death2-21. It
+ would now pass, but it duplicates the new test sticky-11.
+
+Thu Mar 27 10:21:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (dotest_internal): Write test output to logfile even
+ if test succeeds. This was the behavior prior to 30 Sep 1996.
+ See the comment for rationale.
+
+Tue Mar 25 13:26:52 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * cvs.h, entries.c (WriteTag): Add arguments nonbranch,
+ update_dir, and repository. Move the server_set_sticky call from
+ callers to here.
+ * cvs.h, create_adm.c (Create_Admin): New argument nonbranch.
+ * cvs.h, entries.c (ParseTag): Add argument nonbranchp.
+ * cvs.h (struct stickydirtag): Add field nonbranch.
+ * entries.c (Entries_Open): Set it.
+ * cvs.h (Vers_TS): Add field nonbranch.
+ * vers_ts.c (Version_TS): Copy it from struct stickydirtag.
+ * server.c, server.h (server_set_sticky): Add argument nonbranch.
+ * add.c, client.c, checkout.c, modules.c, update.c, create_adm.c,
+ commit.c: Update callers.
+ * add.c (add): If nonbranch, don't add the file on that "branch".
+ * commit.c (write_dirnonbranch): New variable.
+ (commit_fileproc, commit): Set it.
+ (commit_dirleaveproc): Pass it to WriteTag.
+ * update.c (rewrite_tag, nonbranch): New variables.
+ (update, update_dirent_proc, update_fileproc): Set them.
+ (update_filesdoneproc): If rewrite_tag, call WriteTag.
+ * sanity.sh (sticky): New tests, test for above fix.
+
+ * version.c: Change version number to 1.9.7.
+
+ * version.c: Version 1.9.6.
+
+Mon Mar 24 13:02:04 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * entries.c (ParseTag): Add comment about unrecognized characters
+ in CVS/Tag file.
+
+ * classify.c (Classify_File): Add comment about how specifying a
+ tag (bogusly?) suppresses certain messages.
+
+Fri Mar 21 13:37:46 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * rcs.h (struct rcsnode): Add comment about case of PATH.
+ * rcs.c (RCS_parse): If ign_case, then try opening the file with
+ fopen_case.
+ * ignore.c (ign_case): Adjust comment.
+ * cvs.h, filesubr.c (cvs_casecmp, fopen_case): New functions.
+
+20 Mar 1997 Jim Kingdon
+
+ * client.c (send_repository): When sending Directory request,
+ send any ISDIRSEP character as '/'. Fixes
+ "cvs log foo\bar\baz.c" on NT & friends.
+
+ * client.c (send_file_names): Don't try to read Entries file if
+ CVSADM directory does not exist. Fixes fairly serious regression
+ (warning on all fresh checkouts) introduced by 1997-01-08 change.
+
+Tue Mar 18 13:03:33 1997 Jim Meyering <meyering@totoro.cyclic.com>
+
+ * sanity.sh (RCSINIT): Define to be empty and export, to hide any
+ existing value that might cause spurious failures.
+
+ * Makefile.in: (install): Depend on installdirs.
+ Remove `CYGNUS LOCAL' comment saying not to.
+
+Tue Mar 18 09:36:26 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * recurse.c (struct recursion_frame): Reindent.
+ (do_dir_proc): Print message if we try to recurse into a CVSADM
+ directory.
+ * sanity.sh (basicb): New test basicb-4a tests for above fix.
+
+Sun Mar 16 10:18:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (death2): Replace regexp matching temporary file name
+ with new variable ${tempname}. For most of the tests this is a
+ cosmetic change, but death2-diff-6 had been missing _ which caused
+ it to fail on Solaris (at least sometimes).
+
+ * sanity.sh (modes): Don't use export -n; it doesn't seem
+ to be sufficiently portable.
+
+ * version.c: Change version number to 1.9.5.
+
+ * version.c: Version 1.9.4.
+
+ * rcscmds.c (RCS_checkin): Preserve the mode of the rcsfile.
+ RCS_CI usually, but not always, does this for us.
+ * commit.c (fix_rcs_modes): Replace algorithm with a more
+ CVSUMASK-friendly one.
+ * sanity.sh (modes): Update tests modes-5, modes-7, modes-10, and
+ modes-15 so they test that CVSUMASK is honored.
+
+Sun Mar 16 10:18:28 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (modes): New tests modes-7a and modes-7b test behavior
+ if one manually changes the modes in the repository.
+
+ * server.c (server): Revise code which checks for errors creating
+ temporary directory. This won't solve the intermittent
+ can't create temporary directory
+ Unknown error -1
+ but it will mean (a) the right message based on errno gets
+ printed, instead of "unknown error -1", and (b) the message says
+ that it happened in chmod instead of mkdir_p.
+
+Sat Mar 15 16:47:12 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (modes): New tests. Note that (for now) these are
+ just testing how CVS already behaves; I want to record that before
+ I move on to changing CVS's behavior with modes of RCS files.
+
+13 Mar 1997 Jim Kingdon
+
+ * subr.c (line2argv): Change argv_allocated from size_t to int.
+
+Wed Mar 12 22:16:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * add.c (add_directory): If repository has an extraneous "."
+ directory at the end, strip it off. This fixes a bug which was
+ introduced when strip_path was nuked (this fix is much more
+ limited in scope than strip_path was; I _think_ that is a good
+ thing).
+ (add): Likewise, for client.
+ (combine_dir): New function, helps with above.
+ * sanity.sh (modules3): Reenable tests for this behavior.
+ (basica-0b, basicb-0e): Adjust test to reflect "foo/bar" instead
+ of "foo/./bar" in message. As with the rest of this, I believe
+ this is just restoring the behavior prior to the strip_path nuking
+ (I tried it with CVS 1.9).
+
+Sun Mar 9 10:06:29 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * root.c (parse_cvsroot), server.c (serve_root, serve_init):
+ If CVSroot_directory is not an absolute pathname, give a fatal error.
+ * sanity.sh (crerepos): New tests crerepos-6* test for above fixes.
+
+Sat Mar 8 22:06:17 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ This cleans up the last known code which can overflow its buffers
+ (except the Mac client). I've skimmed through much of CVS looking
+ for other such places; but I didn't read everything. If I missed
+ any please report it to bug-cvs.
+ * logmsg.c (logfile_write, title_proc): Realloc str_list as
+ needed; don't assume MAXLISTLEN is enough.
+ * cvs.h (MAXLISTLEN, MAXFILEPERDIR): Removed; no longer used.
+ * add.c, myndbm.c, parseinfo.c, update.c: Nuke MAXLINELEN limit.
+ * parseinfo.c, update.c, mkmodules.c: Check for errors reading file.
+ * cvs.h (MAXLINELEN): Removed; no longer used.
+ * logmsg (MAXHOSTNAMELEN): Removed; not used.
+ * main.c (cmd_synonyms): Allocate based on fullname, nick1, and
+ nick2, just in case someone makes those big enough so that 100
+ bytes is not enough.
+ (Make_Date): Use MAXDATELEN rather than our own fixed size.
+ * mkmodules.c (mkmodules): Nuke arbitrary limit on line length.
+ * rcs.c (ALLOCINCR): Remove; not used.
+ (RCS_check_kflag): Add comment concerning karg size.
+ * run.c: Allocate run_prog to the needed size, rather than
+ allocating a fixed size buffer.
+
+Fri Mar 7 22:39:08 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * logmsg.c (logfile_write): Allocate prog to needed length rather
+ than assuming MAXPROGLEN is enough.
+ * cvs.h (MAXPROGLEN): Removed; no longer used.
+ * subr.c (MIN_INCR): Update comment to reflect MAXPROGLEN's demise.
+
+ * subr.c (free_names): Fix comment: this function is not used to
+ free memory allocated by Find_Names (at least it hasn't for a long
+ time).
+ * subr.c, cvs.h (line2argv): Change calling convention so that we
+ allocate argv array rather than the caller. The previous one had
+ no way of checking whether we overflowed the passed-in buffer.
+ * subr.c (free_names): Free the argv array too.
+ * modules.c (do_module, cat_module): Update callers.
+
+Thu Mar 6 12:44:42 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * import.c: Allocate vhead and vbranch dynamically; removes
+ arbitrary limit.
+ * history.c: Likewise (since_rev, since_tag, backto, rec_types).
+ * ignore.c: Likewise (line). Also check for errors from getline
+ and add 'copyright' notice to top of file.
+ * wrapper.c (wrap_add_file): Likewise (line). Also check for
+ errors from various calls and add 'copyright' notice to top of file.
+
+Tue Mar 4 17:39:15 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c (update_entries): Add comment about "move away <file>"
+ message.
+
+Mon Mar 3 21:51:40 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (basicb): Clean up topfile,v at end of test. Fixes
+ failure in modules-155b.
+
+Sun Mar 2 18:11:09 1997 Dan Wilder <dan@gasboy.com>
+ and Jim Kingdon
+
+ * admin.c (admin): Arrange to perform recursion if "cvs admin"
+ is passed only options.
+
+Sun Mar 2 18:11:09 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (basicb): New tests basicb-0* test for files at top
+ level.
+
+ * error.c (error): Add newline to "out of memory" message. I think
+ that its omission probably could cause the message to be lost in
+ the bowels of server.c and never passed to the user.
+
+ * client.c (start_rsh_server): Add comment about "remsh" vs. "rsh".
+
+ * cvs.h: Move copyright notice to top of file.
+
+Sun Mar 2 13:44:36 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * sanity.sh: Use -n when testing whether rsh works.
+
+ * server.c (serve_root): Free path.
+
+Sun Mar 2 13:12:46 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ The following are things that I noticed in the process of trying
+ to track down:
+ can't create temporary directory
+ Unknown error -1
+ FAIL: test 28
+ from nightly testing. I'm not sure that either item explains that
+ message however.
+ * server.c (server): Allocate pending_error_text;
+ print_pending_error will try to free it so
+ pending_error_text = "foo"
+ won't work.
+ (mkdir_p): Don't assume that isdir will leave errno unmolested.
+
+Thu Feb 27 15:29:58 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * remove.c (cvsremove): When forcing removal in client mode, use
+ start_recursion rather than calling CVS_UNLINK on each argument.
+ (remove_force_fileproc): New static function.
+ * sanity.sh (deep): Add tests deep-rm7 through deep-rm10 for above
+ patch.
+
+ * sanity.sh (death): Enable death-76a0 and death-76a1 tests for
+ remote, since they now work.
+
+Wed Feb 26 16:13:26 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * client.c (add_prune_candidate): Skip adding this directory if
+ it is the same as the first directory already on the list.
+
+Mon Feb 24 21:36:43 1997 Noel Cragg <noel@gargle.rain.org>
+
+ * main.c (lookup_command_attribute): Add the "init" command to the
+ list of commands that don't use the current working directory.
+
+Sun Feb 23 09:54:49 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (devcom3): Clean up at end of test.
+
+ * sanity.sh (basicb): Add commented out test basicb-8a0, for
+ whether CVS can print an error on bad numeric revision to diff.
+ Commented out until we get around to fixing CVS.
+ * diff.c (diff_file_nodiff): Add comment about this case.
+
+ * fileattr.c (fileattr_read): If a filename is duplicated,
+ continue to ignore subsequent lines but free the node so that we
+ don't leak memory.
+ * sanity.sh (devcom3): New tests devcom3-8 and devcom3-9 test for
+ behavior on duplicated filenames.
+
+ * fileattr.h: Add comment about unrecognized ENT-TYPE and order of
+ lines in fileattr file.
+ * fileattr.c (struct unrecog, unrecog_head): New variables, to
+ record unrecognized lines.
+ (fileattr_startdir): Assert that unrecog_head == NULL.
+ (fileattr_read): Record unrecognized lines in unrecog_head linked
+ list rather than ignoring them.
+ (fileattr_write): Also write out unrecognized lines, if any.
+ * sanity.sh (devcom3): New tests, test for above fix.
+
+ * fileattr.h (fileattr_modify): Fix example in comment.
+
+Sat Feb 22 08:30:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh: Add variable username.
+ (basica rdiff multibranch log log2): Use it instead of our own
+ (inconsistent) ways of matching an author name.
+
+ * filesubr.c, root.c, rtag.c, server.c, subr.c, update.c,
+ wrapper.c: Nuke PATH_MAX.
+ * cvs.h, wrapper.c (wrap_fromcvs_process_file): Now returns void
+ (return value had been unused).
+ * cvs.h: Adjust comment to reflect the fact that PATH_MAX is
+ gone, at least from src/*.c (except safe_location, as noted).
+
+22 Feb 1997 patch by Tom Hageman <tom@basil.icce.rug.nl> (4 Jun 1996)
+ updated and commented by Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * update.c (checkout_file): Call unlink_file_dir on backup, not
+ unlink_file.
+
+Fri Feb 21 16:40:03 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * Makefile.in (DISTFILES): Remove NOTES.
+
+ * NOTES: Removed. bcopy->memcpy is done. "static buffers" I
+ assume refers to what is covered by reentrancy text in HACKING.
+ Obstack idea moved to comment in hash.c (at nodecache). Checking
+ system calls for error returns largely done, and isn't a very
+ helpful suggestion unless you know where the bogus calls are
+ anyway. Sizing limits--we're in the progress of removing them
+ (assuming it meant things like PATH_MAX and earlier, already
+ nuked, limits). Removed various items about changes which were
+ done a long time ago (I realize that the ChangeLog's probably
+ aren't reliable that far back, but I'm not convinced anyone cares
+ anymore). CONFIRM_DIRECTORY_ADDS: I assume this is a
+ reference to the #if 0'd code in add_directory which asks for
+ confirmation--a better way of making it harder to accidentally add
+ directories would be to have to add and commit directories like
+ for files. I don't know what FORCE_MESSAGE_ON_ADD meant.
+
+ * rcs.c (RCS_getrevtime): Fix documentation (in particular, the
+ size of the array that DATE must point to, but many other things
+ too).
+ * patch.c, recurse.c, release.c, remove.c, repos.c: Nuke PATH_MAX.
+ (patch_fileproc): Use MAXDATELEN not hardcoded 50.
+
+Sun Feb 16 12:00:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c (client_process_import_file): New variable fullname;
+ pass it to send_modified. This finishes the job of untangling the
+ old short_pathname variable into update_dir vs. fullname.
+
+ * client.c (client_process_import_file): Nuke first_time. If
+ toplevel_repos were ever NULL here, the code would dump core in
+ strncmp a few lines down. And client_import_setup ensures
+ toplevel_repos is not NULL.
+
+Sun Feb 16 08:16:48 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * client.c (client_process_import_file): Rename short_pathname to
+ update_dir (to reflect its function) and make sure that it doesn't
+ point to uninitialized memory if repository and toplevel_repos
+ contain the same string.
+
+Sun Feb 16 08:16:48 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c (start_rsh_server): Nuke comment about weirdnesses with
+ pre-1.5 versions of CVS and .bashrc/.cshrc. The remote protocol
+ is interoperable only back to 1.5, and people who need to know are
+ unlikely to see this comment anyway.
+
+Sun Dec 15 13:12:30 1996 Michael Douglass <mikedoug@texas.net>
+ and Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * main.c (cmds): Added an entry for new logout command.
+ (cmd_usage): Added an entry for new logout command.
+ (lookup_command_attribute): Added 'logout' to list of commands
+ that set need_to_crate_root to 1.
+ * login.c, cvs.h (logout): New command for removing entries from
+ the .cvspass file.
+ (logout_usage): Usage information on the logout command.
+
+Wed Feb 12 11:19:42 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c (struct send_data): Fix indentation.
+
+Wed Feb 12 08:48:04 1997 Greg A. Woods <woods@most.weird.com>
+
+ * mkmodules.c (loginfo_contents): add missing comma in
+ initializer statement (caused syntax error on SunOS-4).
+
+Tue Feb 11 21:14:28 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * commit.c (find_fileproc): If force_ci is set, set the status to
+ T_MODIFIED even if the file hasn't changed.
+ (commit): Pass force_ci to send_files as new force argument.
+ * client.c (struct send_data): Define.
+ (send_fileproc): The callerdat parameter now points to a send_data
+ struct. If force is set, always call send_modified.
+ (send_dirent_proc): The callerdat parameter now points to a
+ send_data struct.
+ (send_files): Add force parameter. Change all callers. Set up a
+ send_data struct and pass it to start_recursion as callerdat.
+ * client.h (send_files): Update declaration.
+ * sanity.sh (basica): Add a simple test for the above patch.
+
+Sun Feb 9 12:58:59 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * tag.c (cvstag), rtag.c (rtag): Pass -f to server if specified in
+ the client. I haven't tried to come up with a test case because
+ the fix seems obvious.
+
+ * import.c (add_rcs_file): Change size of altdate1 and altdate2 to
+ MAXDATELEN.
+ * cvs.h (MAXDATELEN): Fix comments; describe what this is for.
+
+ * diff.c (diff_usage): Document --ifdef and try to briefly say
+ what "rcsdiff-options" means.
+
+ * update.c (update): If update had a nonzero status and we haven't
+ yet tried to fetch unpatchable files, go ahead and try it again.
+ The previous behavior was to quit, which meant that updates would
+ keep failing until you hacked around the problem. Patch and bug
+ report by Ian; comment, ChangeLog entry, and willingness to take
+ the flak if checking it is premature by Jim.
+
+ * server.c (alloc_pending): New function.
+ * server.c: Call it. Fixes places where we had neglected to
+ check for NULL return from malloc.
+
+ * sanity.sh (binwrap): Add test binwrap-0, tests for import.c fix
+ below.
+
+Sun, 9 Feb 1997 (submitted 19 Jul 1996) John Polstra <jdp@polstra.com>
+
+ * import.c (import): Give error if the same tag is specified more
+ than once. The previous behavior was to write an RCS file which
+ had the same tag listed twice, once pointing to each revision,
+ which is not legal.
+
+Sun Feb 9 12:37:09 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * checkin.c (Checkin): Use cvs_output to print message (should
+ make out of order bugs no worse, as it merely substitues a
+ protocol_pipe vs. stderr_pipe race instead of a stdout_pipe
+ vs. stderr_pipe race). Add comment about stdout vs. stderr.
+
+Fri Feb 7 08:29:52 1997 Josef Nelissen <josef.nelissen@munich.ixos.de>
+
+ * server.c (check_command_legal_p): Don't use ANSI-style definition.
+
+Thu Feb 6 10:55:37 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * patch.c (patch): Give a fatal error for -V option (see comment
+ for rationale).
+
+ * diff.c (diff): Also send "options" to server. Pretty much the
+ patch submitted independently by josef.nelissen@munich.ixos.de and
+ Ronald Khoo <ronald@demon.net>.
+
+Wed Feb 5 18:57:14 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * modules.c (do_module): Fix typo in 30 Jan 97 PATH_MAX nuking
+ (free -> free_cwd). Testsuite test 151 gets credit for catching
+ this one.
+
+Mon Feb 3 16:14:54 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * main.c (lookup_command_attribute): Don't use an ANSI prototype
+ when defining the function.
+
+Fri Jan 31 12:49:02 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * modules.c (do_module): Actually goto found if is_found is set
+ (fixes thinko in PATH_MAX nuking of 30 Jan 97).
+
+Fri Jan 31 12:49:02 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh: Add modules3 and big to list of tests to run
+ by default; they were omitted by accident.
+
+Thu Jan 30 11:46:33 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * logmsg.c, main.c, mkmodules.c, modules.c, parseinfo.c, patch.c:
+ Nuke more PATH_MAX.
+
+ * server.c (server_updated): After we send Created or
+ Update-existing for a file, mark it as unchanged, in case we
+ process it again.
+ * sanity.sh (modules3): New tests, test for above fix.
+
+ * logmsg.c (do_verify): Error return from fopen is NULL, not -1.
+ Pass errno to error().
+
+ * login.c [_CRAY]: Don't declare getpass.
+
+Mon Jan 27 17:25:27 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * import.c (process_import_file): Fix freeing of rcs (Don't free
+ it before we are done using it, and don't free it twice).
+
+ * modules.c (cat_module): Allocate line right before we use
+ it. The previous code was wrong because the length of the
+ s_h->rest changes between the time we allocate line and the time we
+ sprintf s_h->rest into it.
+
+Sun Jan 26 21:58:16 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * expand_path.c (expand_path): Revise to call expand_string as
+ needed. Nuke PATH_MAX.
+ * find_names.c (find_dirs): Likewise.
+ * import.c, lock.c: Nuke more PATH_MAX.
+
+ * server.c (mkdir_p): Set retval to 0 at start of function.
+ Previously it had been uninitialized for some cases. Thanks are
+ due to nightly testing for catching this one.
+
+Sat Jan 25 21:34:19 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * subr.c, cvs.h (expand_string): New function.
+ * rcs.c (getrcskey, getrcsrev): Call it. This greatly reduces the
+ number of calls to realloc if there is a very large file in the
+ RCS file. Credit goes to Mike Heath <mike@pswtech.com> for
+ pointing out the problem and the basic solution (MIN_INCR,
+ MAX_INCR); I adapted it into the separate function expand_string.
+ * sanity.sh (big): New test helps insure this hasn't broken
+ anything obvious.
+
+Wed Jan 22 10:06:13 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * status.c (status_fileproc): Change message which is printed for
+ T_MODIFIED and ts_conflict set, so that it doesn't say "unresolved
+ confict". This message occurs whether the conflict is resolved or
+ not.
+ * sanity.sh (conflicts): Add tests conflicts-status-* to test
+ output of "cvs status" in the context of conflicts. Tests for
+ above fix.
+
+ * rtag.c (rtag): Send -n if run_module_prog is NOT true.
+
+Thu Jan 16 00:06:00 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * version.c: Change version number to 1.9.3.
+
+ * version.c: Version 1.9.2.
+
+Wed Jan 15 09:14:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * client.c (call_in_directory): Take code that creates CVSADM at
+ top level, move it before the CVS_CHDIR (dir_name) call, and do it
+ regardless of whether dir_name is ".". Pass "." not dir_name to
+ Create_Admin (when the code was written they were always the
+ same). Don't add reposdirname to the repository we pass to
+ Create_Admin (when the code was written, I think reposdirname
+ probably would always be "."). Don't create CVSADM if
+ reposdirname_absolute.
+ * sanity.sh (basicb): Enable tests basicb-1a and basicb-9a for
+ remote; tests for above fix.
+ (basic1): Do entire test within a "1" directory to deal with
+ creation of CVS directories at top level. Support --keep.
+ (conflicts): In test conflicts-136, only update first-dir.
+ (basica): Uncomment the part that tests "cvs co -l .". That tests
+ the existing functionality which I might have (but hopefully did not)
+ perturbed with the call_in_directory changes.
+
+Mon Jan 13 11:04:32 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * server.c (check_command_legal_p): Do not call error (1, ...)
+ here; that will always cause a protocol violation by shutting down
+ the connection prematurely. Remove croak_on_illegal arg.
+ (do_cvs_command): Move call to check_command_legal_p until after
+ the call to print_pending_error. Print the error message ourself.
+
+ * mkmodules.c (filelist): Add readers and writers. Add comment
+ about why passwd is not included. Add comment about meaning of
+ NULL contents field.
+
+Fri Jan 10 13:23:09 1997 Norbert Kiesel <nk@col.sw-ley.de>
+
+ * release.c (release): Initialize delete_flag before reading it
+ (found by running purify)
+
+ * logmsg.c (do_verify): Fix reading unallocated memory (found by
+ running purify)
+
+Thu Jan 9 16:32:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * checkout.c (build_dirs_and_chdir): Partially revert 3 Jan
+ change--move call to Subdir_Register back above the CVS_CHDIR call
+ (we need to register in the old, not the new, directory). Instead
+ of calling CVS_MKDIR and ignoring errors, call mkdir_if_needed;
+ this is an effort to catch errors there rather than catching them
+ in the CVS_CHDIR. This makes test 27-add-add in sanity.sh work
+ again.
+
+ * find_names.c (Find_Directories): Remove code inside
+ #ifdef ATTIC_DIR_SUPPORT and replace it with a comment explaining
+ why we don't look in the attic. ATTIC_DIR_SUPPORT was never defined.
+
+ * find_names.c (find_dirs): Add comment about tmp being unset.
+
+ * commit.c (checkaddfile): Report errors with errno and specific
+ error messages.
+
+ * rcs.c, commit.c, create_adm.c, entries.c, find_names.c,
+ ignore.c, history.c: Nuke PATH_MAX arbitrary limits.
+
+Wed Jan 8 23:07:41 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * add.c (add): Reindent a portion which needed it.
+
+1997-01-08 Jim Kingdon
+
+ * client.c (send_file_names): When looking name up in Entries,
+ call Entries_Open and Entries_Close. This has two effects:
+ (1) we look at Entries.Log, and (2) we don't skip 'D' entries,
+ both of which are needed to make us get the right (command
+ line) name for a directory we are adding.
+
+Wed Jan 8 14:50:47 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * Makefile.in, cvs.h, hash.h, myndbm.h, rcs.h: Remove CVSid; we
+ decided to get rid of these some time ago.
+
+Tue Jan 7 12:56:10 1997 Karl Fogel <kfogel@ynu38.ynu.edu.cn>
+
+ * root.c (check_root_consistent): new func, compares below new
+ global var with CVSroot_directory, assuming both set.
+ (set_local_cvsroot): use above new func for security check.
+ (parse_cvsroot): same.
+ But do all of above only #ifdef AUTH_SERVER_SUPPORT.
+
+ * server.c: (Pserver_Repos): new global var, init to NULL.
+ (pserver_authenticate_connection): set above new global.
+ (check_repository_password): be a good scout and use
+ CVSROOTADM and CVSROOTADM_PASSWD, now that they are the standard.
+ Make sure all of above is in #ifdef AUTH_SERVER_SUPPORT.
+ (check_command_legal_p): wrap most of body in #ifdef
+ AUTH_SERVER_SUPPORT.
+ Everywhere: wrap all references to CVS_Username in #ifdef
+ AUTH_SERVER_SUPPORT.
+
+ * cvs.h (Pserver_Repos): new var, used in consistency [security]
+ check. Defined only #ifdef AUTH_SERVER_SUPPORT.
+ (CVSROOTADM_PASSWD): new #define, trying to get with the program.
+
+Fri Jan 3 18:10:39 1997 Ian Lance Taylor <ian@cygnus.com>
+
+ * checkout.c (build_dirs_and_chdir): Move call to Subdir_Register
+ until after we know that the directory exists.
+
+Thu Jan 2 13:30:56 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * Makefile.in, cvsbug.sh, edit.c, edit.h, error.c, error.h,
+ fileattr.c, fileattr.h, filesubr.c, run.c, update.h, watch.c,
+ watch.h: Remove "675" paragraph; see ../ChangeLog for rationale.
+
+Thu Jan 2 12:27:46 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * sanity.sh (info): New test info-cleanup-verifymsg gets rid of
+ verifymsg when we are done with it.
+
+ * sanity.sh (basicb): Skip tests basicb-1a and basicb-9a for remote.
+ * sanity.sh (modules-155a4): It is OK if a CVS directory exists.
+ * sanity.sh (ignore): Do everything inside a "1" directory. The
+ change to create CVS directories at top-level causes messages such as
+ "? home" otherwise. In test 191, specify -I CVS so that new CVS
+ directory is ignored.
+ * sanity.sh (crerepos): Manually remove CVS directory which had not
+ existed before.
+
+Thu Jan 2 09:06:20 1997 Karl Fogel <kfogel@ynu38.ynu.edu.cn>
+
+ * server.c: Changes for pserver read-only repository access:
+ (check_command_legal_p): new func. Right now, just checks if
+ repository modification is permitted, and that only if pserver is
+ active.
+ (do_cvs_command): take new parameter `cmd_name', a string. All
+ callers changed. Pass it on to new func check_command_legal_p()
+ before executing the command.
+ (CVS_Username): new global, init to NULL. Used by
+ check_command_legal_p(), set in check_password().
+ (check_password): set above new global CVS_Username; reorganized a
+ bit to facilitate this.
+ (check_repository_password): give *host_user_ptr permanent
+ storage iff success.
+
+ * main.c: Changes for pserver read-only repository access:
+ (lookup_command_attribute): new func.
+ (main): use new func lookup_command_attribute() to establish if
+ CVS_CMD_IGNORE_ADMROOT and CVS_CMD_USES_WORK_DIR.
+
+ * cvs.h: Changes for pserver read-only repository access:
+ (CVSROOTADM_READERS, CVSROOTADM_WRITERS): new #defines.
+ Prototype lookup_command_attribute().
+ (CVS_CMD_IGNORE_ADMROOT, CVS_CMD_USES_WORK_DIR,
+ CVS_CMD_MODIFIES_REPOSITORY): new #defines for
+ lookup_command_attribute() and its callers.
+
+Wed Jan 1 19:50:38 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * options.h.in: Reword comment for TMPDIR_DFLT to make it clear
+ that this isn't specific to the pserver server.
+
+ * modules.c (do_module): Give an error message if one tries to
+ specify -a together with another option.
+ * sanity.sh (modules2): New tests modules2-a* test for above fix.
+
+ * sanity.sh (devcom): Add tests devcom-a-nonexist and
+ devcom-t-nonexist for "cvs watchers" on nonexistent argument.
+
+1997-01-01 Fred Fish <fnf@ninemoons.com>
+
+ * run.c (piped_child, filter_stream_through_program): Actually
+ install these HAVE_VFORK patches that got missed.
+ (There was a log entry for these changes for 29 Nov 1996 but it
+ seems I accidentally forgot to actually check them in -kingdon).
+
+Wed Jan 1 18:32:44 1997 Jim Kingdon <kingdon@harvey.cyclic.com>
+
+ * Makefile.in: Add ChangeLog-96.
+ * ChangeLog-96: New file, contains former contents of ChangeLog.
+ * ChangeLog: Now just contains 1997 changes.
+
+
+For older changes see ChangeLog-96.
diff --git a/contrib/cvs/src/Makefile.in b/contrib/cvs/src/Makefile.in
index f02edf2..296554a 100644
--- a/contrib/cvs/src/Makefile.in
+++ b/contrib/cvs/src/Makefile.in
@@ -60,7 +60,7 @@ HEADERS = buffer.h cvs.h rcs.h hash.h myndbm.h \
TAGFILES = $(HEADERS) options.h.in $(SOURCES)
DISTFILES = .cvsignore Makefile.in \
- ChangeLog ChangeLog-96 ChangeLog-9395 ChangeLog-9194 \
+ ChangeLog ChangeLog-97 ChangeLog-96 ChangeLog-9395 ChangeLog-9194 \
sanity.sh cvsbug.sh $(TAGFILES) build_src.com
PROGS = cvs cvsbug
@@ -144,10 +144,10 @@ dist-dir:
# Linking rules.
-$(PROGS): ../lib/libcvs.a ../zlib/libz.a
+$(PROGS): ../lib/libcvs.a ../zlib/libz.a ../diff/libdiff.a
cvs: $(OBJECTS)
- $(CC) $(OBJECTS) ../lib/libcvs.a ../zlib/libz.a $(LIBS) $(LDFLAGS) -o $@
+ $(CC) $(OBJECTS) ../lib/libcvs.a ../zlib/libz.a ../diff/libdiff.a $(LIBS) $(LDFLAGS) -o $@
xlint: $(SOURCES)
files= ; \
diff --git a/contrib/cvs/src/add.c b/contrib/cvs/src/add.c
index 9220930..ab667df 100644
--- a/contrib/cvs/src/add.c
+++ b/contrib/cvs/src/add.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Add
*
@@ -26,8 +26,9 @@
#include "cvs.h"
#include "savecwd.h"
+#include "fileattr.h"
-static int add_directory PROTO((char *repository, List *, char *dir));
+static int add_directory PROTO ((struct file_info *finfo));
static int build_entry PROTO((char *repository, char *user, char *options,
char *message, List * entries, char *tag));
@@ -36,57 +37,16 @@ static const char *const add_usage[] =
"Usage: %s %s [-k rcs-kflag] [-m message] files...\n",
"\t-k\tUse \"rcs-kflag\" to add the file with the specified kflag.\n",
"\t-m\tUse \"message\" for the creation log.\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
-static char *combine_dir PROTO ((char *, char *));
-
-/* Given a directory DIR and a subdirectory within it, SUBDIR, combine
- the two into a new directory name. Returns a newly malloc'd string.
- For now this is a fairly simple affair, but perhaps it will want
- to have grander ambitions in the context of VMS or others (or perhaps
- not, perhaps that should all be hidden inside CVS_FOPEN and libc and so
- on, and CVS should just see foo/bar/baz style pathnames). */
-static char *
-combine_dir (dir, subdir)
- char *dir;
- char *subdir;
-{
- char *retval;
- size_t dir_len;
-
- dir_len = strlen (dir);
- retval = xmalloc (dir_len + strlen (subdir) + 10);
- if (dir_len >= 2
- && dir[dir_len - 1] == '.'
- && ISDIRSEP (dir[dir_len - 2]))
- {
- /* The dir name has an extraneous "." at the end.
- I'm not completely sure that this is the best place
- to strip it off--it is possible that Name_Repository
- should do so, or it shouldn't be in the CVS/Repository
- file in the first place. Fixing it here seems like
- a safe, small change, but I'm not sure it catches
- all the cases. */
- strncpy (retval, dir, dir_len - 2);
- retval[dir_len - 2] = '\0';
- }
- else
- {
- strcpy (retval, dir);
- }
- strcat (retval, "/");
- strcat (retval, subdir);
- return retval;
-}
-
int
add (argc, argv)
int argc;
char **argv;
{
char *message = NULL;
- char *user;
int i;
char *repository;
int c;
@@ -95,6 +55,7 @@ add (argc, argv)
char *options = NULL;
List *entries;
Vers_TS *vers;
+ struct saved_cwd cwd;
if (argc == 1 || argc == -1)
usage (add_usage);
@@ -128,17 +89,64 @@ add (argc, argv)
if (argc <= 0)
usage (add_usage);
- /* find the repository associated with our current dir */
- repository = Name_Repository ((char *) NULL, (char *) NULL);
+ /* First some sanity checks. I know that the CVS case is (sort of)
+ also handled by add_directory, but we need to check here so the
+ client won't get all confused in send_file_names. */
+ for (i = 0; i < argc; i++)
+ {
+ int skip_file = 0;
+
+ /* If it were up to me I'd probably make this a fatal error.
+ But some people are really fond of their "cvs add *", and
+ don't seem to object to the warnings.
+ Whatever. */
+ strip_trailing_slashes (argv[i]);
+ if (strcmp (argv[i], ".") == 0
+ || strcmp (argv[i], "..") == 0
+ || fncmp (argv[i], CVSADM) == 0)
+ {
+ error (0, 0, "cannot add special file `%s'; skipping", argv[i]);
+ skip_file = 1;
+ }
+
+ if (skip_file)
+ {
+ int j;
+
+ /* FIXME: We don't do anything about free'ing argv[i]. But
+ the problem is that it is only sometimes allocated (see
+ cvsrc.c). */
+
+ for (j = i; j < argc - 1; ++j)
+ argv[j] = argv[j + 1];
+ --argc;
+ /* Check the new argv[i] again. */
+ --i;
+ ++err;
+ }
+ }
#ifdef CLIENT_SUPPORT
if (client_active)
{
int i;
+
+ if (argc == 0)
+ /* We snipped out all the arguments in the above sanity
+ check. We can just forget the whole thing (and we
+ better, because if we fired up the server and passed it
+ nothing, it would spit back a usage message). */
+ return err;
+
start_server ();
ign_setup ();
if (options) send_arg(options);
option_with_arg ("-m", message);
+
+ repository = Name_Repository (NULL, NULL);
+ send_a_repository ("", repository, "");
+ free (repository);
+
for (i = 0; i < argc; ++i)
/* FIXME: Does this erroneously call Create_Admin in error
conditions which are only detected once the server gets its
@@ -149,16 +157,48 @@ add (argc, argv)
char *date;
int nonbranch;
char *rcsdir;
+ char *p;
+ char *update_dir;
+ /* This is some mungeable storage into which we can point
+ with p and/or update_dir. */
+ char *filedir;
+
+ if (save_cwd (&cwd))
+ error_exit ();
+
+ filedir = xstrdup (argv[i]);
+ p = last_component (filedir);
+ if (p == filedir)
+ {
+ update_dir = "";
+ }
+ else
+ {
+ p[-1] = '\0';
+ update_dir = filedir;
+ if (CVS_CHDIR (update_dir) < 0)
+ error (1, errno,
+ "could not chdir to %s", update_dir);
+ }
+
+ /* find the repository associated with our current dir */
+ repository = Name_Repository (NULL, update_dir);
/* before we do anything else, see if we have any
per-directory tags */
ParseTag (&tag, &date, &nonbranch);
- rcsdir = combine_dir (repository, argv[i]);
+ rcsdir = xmalloc (strlen (repository) + strlen (p) + 5);
+ sprintf (rcsdir, "%s/%s", repository, p);
+
+ Create_Admin (p, argv[i], rcsdir, tag, date,
+ nonbranch, 0);
- strip_trailing_slashes (argv[i]);
+ send_a_repository ("", repository, update_dir);
- Create_Admin (argv[i], argv[i], rcsdir, tag, date, nonbranch);
+ if (restore_cwd (&cwd, NULL))
+ error_exit ();
+ free_cwd (&cwd);
if (tag)
free (tag);
@@ -166,32 +206,24 @@ add (argc, argv)
free (date);
free (rcsdir);
- if (strchr (argv[i], '/') == NULL)
+ if (p == filedir)
Subdir_Register ((List *) NULL, (char *) NULL, argv[i]);
else
{
- char *cp, *b;
-
- cp = xstrdup (argv[i]);
- b = strrchr (cp, '/');
- *b++ = '\0';
- Subdir_Register ((List *) NULL, cp, b);
- free (cp);
+ Subdir_Register ((List *) NULL, update_dir, p);
}
+ free (repository);
+ free (filedir);
}
send_file_names (argc, argv, SEND_EXPAND_WILD);
- /* FIXME: should be able to pass SEND_NO_CONTENTS, I think. */
- send_files (argc, argv, 0, 0, SEND_BUILD_DIRS);
+ send_files (argc, argv, 0, 0, SEND_BUILD_DIRS | SEND_NO_CONTENTS);
send_to_server ("add\012", 0);
if (message)
free (message);
- free (repository);
- return get_responses_and_close ();
+ return err + get_responses_and_close ();
}
#endif
- entries = Entries_Open (0);
-
/* walk the arg list adding files/dirs */
for (i = 0; i < argc; i++)
{
@@ -200,24 +232,42 @@ add (argc, argv)
int begin_added_files = added_files;
#endif
struct file_info finfo;
+ char *p;
+
+ memset (&finfo, 0, sizeof finfo);
- user = argv[i];
- strip_trailing_slashes (user);
- if (strchr (user, '/') != NULL)
+ if (save_cwd (&cwd))
+ error_exit ();
+
+ finfo.fullname = xstrdup (argv[i]);
+ p = last_component (argv[i]);
+ if (p == argv[i])
{
- error (0, 0,
- "cannot add files with '/' in their name; %s not added", user);
- err++;
- continue;
+ finfo.update_dir = "";
+ finfo.file = p;
+ }
+ else
+ {
+ p[-1] = '\0';
+ finfo.update_dir = argv[i];
+ finfo.file = p;
+ if (CVS_CHDIR (finfo.update_dir) < 0)
+ error (1, errno, "could not chdir to %s", finfo.update_dir);
}
- memset (&finfo, 0, sizeof finfo);
- finfo.file = user;
- finfo.update_dir = "";
- finfo.fullname = user;
+ /* Add wrappers for this directory. They exist only until
+ the next call to wrap_add_file. */
+ wrap_add_file (CVSDOTWRAPPER, 1);
+
+ finfo.rcs = NULL;
+
+ /* Find the repository associated with our current dir. */
+ repository = Name_Repository (NULL, finfo.update_dir);
+
+ entries = Entries_Open (0);
+
finfo.repository = repository;
finfo.entries = entries;
- finfo.rcs = NULL;
/* We pass force_tag_match as 1. If the directory has a
sticky branch tag, and there is already an RCS file which
@@ -233,23 +283,25 @@ add (argc, argv)
if (vers->ts_user == NULL)
{
/* There is no user file either */
- error (0, 0, "nothing known about %s", user);
+ error (0, 0, "nothing known about %s", finfo.fullname);
err++;
}
- else if (!isdir (user) || wrap_name_has (user, WRAP_TOCVS))
+ else if (!isdir (finfo.file)
+ || wrap_name_has (finfo.file, WRAP_TOCVS))
{
/*
* See if a directory exists in the repository with
* the same name. If so, blow this request off.
*/
- char *dname = xmalloc (strlen (repository) + strlen (user)
+ char *dname = xmalloc (strlen (repository)
+ + strlen (finfo.file)
+ 10);
- (void) sprintf (dname, "%s/%s", repository, user);
+ (void) sprintf (dname, "%s/%s", repository, finfo.file);
if (isdir (dname))
{
error (0, 0,
"cannot add file `%s' since the directory",
- user);
+ finfo.fullname);
error (0, 0, "`%s' already exists in the repository",
dname);
error (1, 0, "illegal filename overlap");
@@ -262,11 +314,11 @@ add (argc, argv)
rcs file if it existed, e.g. the file exists
on another branch). Check for a value from
the wrapper stuff. */
- if (wrap_name_has (user, WRAP_RCSOPTION))
+ if (wrap_name_has (finfo.file, WRAP_RCSOPTION))
{
if (vers->options)
free (vers->options);
- vers->options = wrap_rcsoption (user, 1);
+ vers->options = wrap_rcsoption (finfo.file, 1);
}
}
@@ -280,7 +332,7 @@ add (argc, argv)
else
{
/* There is a user file, so build the entry for it */
- if (build_entry (repository, user, vers->options,
+ if (build_entry (repository, finfo.file, vers->options,
message, entries, vers->tag) != 0)
err++;
else
@@ -291,17 +343,19 @@ add (argc, argv)
if (vers->tag)
error (0, 0, "\
scheduling %s `%s' for addition on branch `%s'",
- (wrap_name_has (user, WRAP_TOCVS)
+ (wrap_name_has (finfo.file,
+ WRAP_TOCVS)
? "wrapper"
: "file"),
- user, vers->tag);
+ finfo.fullname, vers->tag);
else
error (0, 0,
"scheduling %s `%s' for addition",
- (wrap_name_has (user, WRAP_TOCVS)
+ (wrap_name_has (finfo.file,
+ WRAP_TOCVS)
? "wrapper"
: "file"),
- user);
+ finfo.fullname);
}
}
}
@@ -309,10 +363,11 @@ scheduling %s `%s' for addition on branch `%s'",
}
else if (RCS_isdead (vers->srcfile, vers->vn_rcs))
{
- if (isdir (user) && !wrap_name_has (user, WRAP_TOCVS))
+ if (isdir (finfo.file)
+ && !wrap_name_has (finfo.file, WRAP_TOCVS))
{
error (0, 0, "\
-the directory `%s' cannot be added because a file of the", user);
+the directory `%s' cannot be added because a file of the", finfo.fullname);
error (1, 0, "\
same name already exists in the repository.");
}
@@ -330,7 +385,7 @@ same name already exists in the repository.");
if (vers->tag)
error (0, 0, "\
file `%s' will be added on branch `%s' from version %s",
- user, vers->tag, vers->vn_rcs);
+ finfo.fullname, vers->tag, vers->vn_rcs);
else
/* I'm not sure that mentioning
vers->vn_rcs makes any sense here; I
@@ -338,8 +393,9 @@ file `%s' will be added on branch `%s' from version %s",
message which is not confusing. */
error (0, 0, "\
re-adding file %s (in place of dead revision %s)",
- user, vers->vn_rcs);
- Register (entries, user, "0", vers->ts_user, NULL,
+ finfo.fullname, vers->vn_rcs);
+ Register (entries, finfo.file, "0", vers->ts_user,
+ NULL,
vers->tag, NULL, NULL);
++added_files;
}
@@ -351,7 +407,8 @@ re-adding file %s (in place of dead revision %s)",
* There is an RCS file already, so somebody else must've
* added it
*/
- error (0, 0, "%s added independently by second party", user);
+ error (0, 0, "%s added independently by second party",
+ finfo.fullname);
err++;
}
}
@@ -362,7 +419,7 @@ re-adding file %s (in place of dead revision %s)",
* An entry for a new-born file, ts_rcs is dummy, but that is
* inappropriate here
*/
- error (0, 0, "%s has already been entered", user);
+ error (0, 0, "%s has already been entered", finfo.fullname);
err++;
}
else if (vers->vn_user[0] == '-')
@@ -379,7 +436,7 @@ re-adding file %s (in place of dead revision %s)",
* it from under us
*/
error (0, 0, "\
-cannot resurrect %s; RCS file removed by second party", user);
+cannot resurrect %s; RCS file removed by second party", finfo.fullname);
err++;
}
else
@@ -389,12 +446,13 @@ cannot resurrect %s; RCS file removed by second party", user);
* There is an RCS file, so remove the "-" from the
* version number and restore the file
*/
- char *tmp = xmalloc (strlen (user) + 50);
+ char *tmp = xmalloc (strlen (finfo.file) + 50);
(void) strcpy (tmp, vers->vn_user + 1);
(void) strcpy (vers->vn_user, tmp);
- (void) sprintf (tmp, "Resurrected %s", user);
- Register (entries, user, vers->vn_user, tmp, vers->options,
+ (void) sprintf (tmp, "Resurrected %s", finfo.file);
+ Register (entries, finfo.file, vers->vn_user, tmp,
+ vers->options,
vers->tag, vers->date, vers->ts_conflict);
free (tmp);
@@ -404,12 +462,13 @@ cannot resurrect %s; RCS file removed by second party", user);
check the file out. */
if (update (2, argv + i - 1) == 0)
{
- error (0, 0, "%s, version %s, resurrected", user,
+ error (0, 0, "%s, version %s, resurrected",
+ finfo.fullname,
vers->vn_user);
}
else
{
- error (0, 0, "could not resurrect %s", user);
+ error (0, 0, "could not resurrect %s", finfo.fullname);
err++;
}
}
@@ -418,14 +477,15 @@ cannot resurrect %s; RCS file removed by second party", user);
{
/* The user file shouldn't be there */
error (0, 0, "\
-%s should be removed and is still there (or is back again)", user);
+%s should be removed and is still there (or is back again)", finfo.fullname);
err++;
}
}
else
{
/* A normal entry, ts_rcs is valid, so it must already be there */
- error (0, 0, "%s already exists, with version number %s", user,
+ error (0, 0, "%s already exists, with version number %s",
+ finfo.fullname,
vers->vn_user);
err++;
}
@@ -433,26 +493,34 @@ cannot resurrect %s; RCS file removed by second party", user);
/* passed all the checks. Go ahead and add it if its a directory */
if (begin_err == err
- && isdir (user)
- && !wrap_name_has (user, WRAP_TOCVS))
+ && isdir (finfo.file)
+ && !wrap_name_has (finfo.file, WRAP_TOCVS))
{
- err += add_directory (repository, entries, user);
- continue;
+ err += add_directory (&finfo);
}
+ else
+ {
#ifdef SERVER_SUPPORT
- if (server_active && begin_added_files != added_files)
- server_checked_in (user, ".", repository);
+ if (server_active && begin_added_files != added_files)
+ server_checked_in (finfo.file, finfo.update_dir, repository);
#endif
+ }
+ free (repository);
+ Entries_Close (entries);
+
+ if (restore_cwd (&cwd, NULL))
+ error_exit ();
+ free_cwd (&cwd);
+
+ free (finfo.fullname);
}
if (added_files)
- error (0, 0, "use 'cvs commit' to add %s permanently",
+ error (0, 0, "use '%s commit' to add %s permanently",
+ program_name,
(added_files == 1) ? "this file" : "these files");
- Entries_Close (entries);
-
if (message)
free (message);
- free (repository);
return (err);
}
@@ -465,24 +533,28 @@ cannot resurrect %s; RCS file removed by second party", user);
* Returns 1 on failure, 0 on success.
*/
static int
-add_directory (repository, entries, dir)
- char *repository;
- List *entries;
- char *dir;
+add_directory (finfo)
+ struct file_info *finfo;
{
+ char *repository = finfo->repository;
+ List *entries = finfo->entries;
+ char *dir = finfo->file;
+
char *rcsdir = NULL;
struct saved_cwd cwd;
char *message = NULL;
char *tag, *date;
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 (strcmp (dir, CVSADM) == 0)
+ if (fncmp (dir, CVSADM) == 0)
{
error (0, 0, "cannot add a `%s' directory", CVSADM);
return (1);
@@ -491,12 +563,18 @@ add_directory (repository, entries, dir)
/* before we do anything else, see if we have any per-directory tags */
ParseTag (&tag, &date, &nonbranch);
+ /* Remember the default attributes from this directory, so we can apply
+ them to the new directory. */
+ fileattr_startdir (repository);
+ attrs = fileattr_getall (NULL);
+ fileattr_free ();
+
/* now, remember where we were, so we can get back */
if (save_cwd (&cwd))
return (1);
if ( CVS_CHDIR (dir) < 0)
{
- error (0, errno, "cannot chdir to %s", dir);
+ error (0, errno, "cannot chdir to %s", finfo->fullname);
return (1);
}
#ifdef SERVER_SUPPORT
@@ -505,19 +583,24 @@ add_directory (repository, entries, dir)
if (isfile (CVSADM))
#endif
{
- error (0, 0, "%s/%s already exists", dir, CVSADM);
+ error (0, 0, "%s/%s already exists", finfo->fullname, CVSADM);
goto out;
}
- rcsdir = combine_dir (repository, dir);
+ rcsdir = xmalloc (strlen (repository) + strlen (dir) + 5);
+ sprintf (rcsdir, "%s/%s", repository, dir);
if (isfile (rcsdir) && !isdir (rcsdir))
{
- error (0, 0, "%s is not a directory; %s not added", rcsdir, dir);
+ error (0, 0, "%s is not a directory; %s not added", rcsdir,
+ finfo->fullname);
goto out;
}
/* setup the log message */
- message = xmalloc (strlen (rcsdir) + 80);
+ message = xmalloc (strlen (rcsdir)
+ + 80
+ + (tag == NULL ? 0 : strlen (tag) + 80)
+ + (date == NULL ? 0 : strlen (date) + 80));
(void) sprintf (message, "Directory %s added to the repository\n", rcsdir);
if (tag)
{
@@ -559,6 +642,15 @@ add_directory (repository, entries, dir)
(void) umask (omask);
}
+ /* Now set the default file attributes to the ones we inherited
+ from the parent directory. */
+ fileattr_startdir (rcsdir);
+ fileattr_setall (NULL, attrs);
+ fileattr_write ();
+ fileattr_free ();
+ if (attrs != NULL)
+ free (attrs);
+
/*
* Set up an update list with a single title node for Update_Logfile
*/
@@ -579,9 +671,9 @@ add_directory (repository, entries, dir)
#ifdef SERVER_SUPPORT
if (!server_active)
- Create_Admin (".", dir, rcsdir, tag, date, nonbranch);
+ Create_Admin (".", finfo->fullname, rcsdir, tag, date, nonbranch, 0);
#else
- Create_Admin (".", dir, rcsdir, tag, date, nonbranch);
+ Create_Admin (".", finfo->fullname, rcsdir, tag, date, nonbranch, 0);
#endif
if (tag)
free (tag);
@@ -594,7 +686,8 @@ add_directory (repository, entries, dir)
Subdir_Register (entries, (char *) NULL, dir);
- (void) printf ("%s", message);
+ cvs_output (message, 0);
+
free (rcsdir);
free (message);
diff --git a/contrib/cvs/src/admin.c b/contrib/cvs/src/admin.c
index d1401f4..a78bada 100644
--- a/contrib/cvs/src/admin.c
+++ b/contrib/cvs/src/admin.c
@@ -3,18 +3,17 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
- * Administration
+ * Administration ("cvs admin")
*
- * For now, this is basically a front end for rcs. All options are passed
- * directly on.
*/
#include "cvs.h"
#ifdef CVS_ADMIN_GROUP
#include <grp.h>
#endif
+#include <assert.h>
static Dtype admin_dirproc PROTO ((void *callerdat, char *dir,
char *repos, char *update_dir,
@@ -24,11 +23,89 @@ static int admin_fileproc PROTO ((void *callerdat, struct file_info *finfo));
static const char *const admin_usage[] =
{
"Usage: %s %s rcs-options files...\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
-static int ac;
-static char **av;
+/* This structure is used to pass information through start_recursion. */
+struct admin_data
+{
+ /* Set default branch (-b). It is "-b" followed by the value
+ given, or NULL if not specified, or merely "-b" if -b is
+ specified without a value. */
+ char *branch;
+
+ /* Set comment leader (-c). It is "-c" followed by the value
+ given, or NULL if not specified. The comment leader is
+ relevant only for old versions of RCS, but we let people set it
+ anyway. */
+ char *comment;
+
+ /* Set strict locking (-L). */
+ int set_strict;
+
+ /* Set nonstrict locking (-U). */
+ int set_nonstrict;
+
+ /* Delete revisions (-o). It is "-o" followed by the value specified. */
+ char *delete_revs;
+
+ /* Keyword substitution mode (-k), e.g. "-kb". */
+ char *kflag;
+
+ /* Description (-t). See sanity.sh for various moanings about
+ files and stdin and such. "" if -t specified without an
+ argument. It is "-t" followed by the argument. */
+ char *desc;
+
+ /* Interactive (-I). Problematic with client/server. */
+ int interactive;
+
+ /* Quiet (-q). Not the same as the global -q option, which is a bit
+ on the confusing side, perhaps. */
+ int quiet;
+
+ /* This is the cheesy part. It is a vector with the options which
+ we don't deal with above (e.g. "-afoo" "-abar,baz"). In the future
+ this presumably will be replaced by other variables which break
+ out the data in a more convenient fashion. AV as well as each of
+ the strings it points to is malloc'd. */
+ int ac;
+ char **av;
+ int av_alloc;
+};
+
+/* Add an argument. OPT is the option letter, e.g. 'a'. ARG is the
+ argument to that option, or NULL if omitted (whether NULL can actually
+ happen depends on whether the option was specified as optional to
+ getopt). */
+static void
+arg_add (dat, opt, arg)
+ struct admin_data *dat;
+ int opt;
+ char *arg;
+{
+ char *newelt = xmalloc ((arg == NULL ? 0 : strlen (arg)) + 3);
+ strcpy (newelt, "-");
+ newelt[1] = opt;
+ if (arg == NULL)
+ newelt[2] = '\0';
+ else
+ strcpy (newelt + 2, arg);
+
+ if (dat->av_alloc == 0)
+ {
+ dat->av_alloc = 1;
+ dat->av = (char **) xmalloc (dat->av_alloc * sizeof (*dat->av));
+ }
+ else if (dat->ac >= dat->av_alloc)
+ {
+ dat->av_alloc *= 2;
+ dat->av = (char **) xrealloc (dat->av,
+ dat->av_alloc * sizeof (*dat->av));
+ }
+ dat->av[dat->ac++] = newelt;
+}
int
admin (argc, argv)
@@ -40,6 +117,10 @@ admin (argc, argv)
struct group *grp;
struct group *getgrnam();
#endif
+ struct admin_data admin_data;
+ int c;
+ int i;
+
if (argc <= 1)
usage (admin_usage);
@@ -70,39 +151,301 @@ admin (argc, argv)
wrap_setup ();
- /* skip all optional arguments to see if we have any file names */
- for (ac = 1; ac < argc; ac++)
- if (argv[ac][0] != '-')
- break;
- argc -= ac;
- av = argv + 1;
- argv += ac;
- ac--;
+ memset (&admin_data, 0, sizeof admin_data);
+
+ /* TODO: get rid of `-' switch notation in admin_data. For
+ example, admin_data->branch should be not `-bfoo' but simply `foo'. */
+
+ optind = 0;
+ while ((c = getopt (argc, argv,
+ "+ib::c:a:A:e:l::u::LUn:N:m:o:s:t::IqxV:k:")) != -1)
+ {
+ switch (c)
+ {
+ case 'i':
+ /* This has always been documented as useless in cvs.texinfo
+ and it really is--admin_fileproc silently does nothing
+ if vers->vn_user is NULL. */
+ error (0, 0, "the -i option to admin is not supported");
+ error (0, 0, "run add or import to create an RCS file");
+ goto usage_error;
+
+ case 'b':
+ if (admin_data.branch != NULL)
+ {
+ error (0, 0, "duplicate 'b' option");
+ goto usage_error;
+ }
+ if (optarg == NULL)
+ admin_data.branch = xstrdup ("-b");
+ else
+ {
+ admin_data.branch = xmalloc (strlen (optarg) + 5);
+ strcpy (admin_data.branch, "-b");
+ strcat (admin_data.branch, optarg);
+ }
+ break;
+
+ case 'c':
+ if (admin_data.comment != NULL)
+ {
+ error (0, 0, "duplicate 'c' option");
+ goto usage_error;
+ }
+ admin_data.comment = xmalloc (strlen (optarg) + 5);
+ strcpy (admin_data.comment, "-c");
+ strcat (admin_data.comment, optarg);
+ break;
+
+ case 'a':
+ arg_add (&admin_data, 'a', optarg);
+ break;
+
+ case 'A':
+ /* In the client/server case, this is cheesy because
+ we just pass along the name of the RCS file, which
+ then will want to exist on the server. This is
+ accidental; having the client specify a pathname on
+ the server is not a design feature of the protocol. */
+ arg_add (&admin_data, 'A', optarg);
+ break;
+
+ case 'e':
+ arg_add (&admin_data, 'e', optarg);
+ break;
+
+ case 'l':
+ /* Note that multiple -l options are legal. */
+ arg_add (&admin_data, 'l', optarg);
+ break;
+
+ case 'u':
+ /* Note that multiple -u options are legal. */
+ arg_add (&admin_data, 'u', optarg);
+ break;
+
+ case 'L':
+ /* Probably could also complain if -L is specified multiple
+ times, although RCS doesn't and I suppose it is reasonable
+ just to have it mean the same as a single -L. */
+ if (admin_data.set_nonstrict)
+ {
+ error (0, 0, "-U and -L are incompatible");
+ goto usage_error;
+ }
+ admin_data.set_strict = 1;
+ break;
+
+ case 'U':
+ /* Probably could also complain if -U is specified multiple
+ times, although RCS doesn't and I suppose it is reasonable
+ just to have it mean the same as a single -U. */
+ if (admin_data.set_strict)
+ {
+ error (0, 0, "-U and -L are incompatible");
+ goto usage_error;
+ }
+ admin_data.set_nonstrict = 1;
+ break;
+
+ case 'n':
+ /* Mostly similar to cvs tag. Could also be parsing
+ the syntax of optarg, although for now we just pass
+ it to rcs as-is. Note that multiple -n options are
+ legal. */
+ arg_add (&admin_data, 'n', optarg);
+ break;
+
+ case 'N':
+ /* Mostly similar to cvs tag. Could also be parsing
+ the syntax of optarg, although for now we just pass
+ it to rcs as-is. Note that multiple -N options are
+ legal. */
+ arg_add (&admin_data, 'N', optarg);
+ break;
+
+ case 'm':
+ /* Change log message. Could also be parsing the syntax
+ of optarg, although for now we just pass it to rcs
+ as-is. Note that multiple -m options are legal. */
+ arg_add (&admin_data, 'm', optarg);
+ break;
+
+ case 'o':
+ /* Delete revisions. Probably should also be parsing the
+ syntax of optarg, so that the client can give errors
+ rather than making the server take care of that.
+ Other than that I'm not sure whether it matters much
+ whether we parse it here or in admin_fileproc.
+
+ Note that multiple -o options are illegal, in RCS
+ as well as here. */
+
+ if (admin_data.delete_revs != NULL)
+ {
+ error (0, 0, "duplicate '-o' option");
+ goto usage_error;
+ }
+ admin_data.delete_revs = xmalloc (strlen (optarg) + 5);
+ strcpy (admin_data.delete_revs, "-o");
+ strcat (admin_data.delete_revs, optarg);
+ break;
+
+ case 's':
+ /* Note that multiple -s options are legal. */
+ arg_add (&admin_data, 's', optarg);
+ break;
+
+ case 't':
+ if (admin_data.desc != NULL)
+ {
+ error (0, 0, "duplicate 't' option");
+ goto usage_error;
+ }
+ if (optarg == NULL)
+ admin_data.desc = xstrdup ("-t");
+ else
+ {
+ admin_data.desc = xmalloc (strlen (optarg) + 5);
+ strcpy (admin_data.desc, "-t");
+ strcat (admin_data.desc, optarg);
+ }
+ break;
+
+ case 'I':
+ /* At least in RCS this can be specified several times,
+ with the same meaning as being specified once. */
+ admin_data.interactive = 1;
+ break;
+
+ case 'q':
+ admin_data.quiet = 1;
+ break;
+
+ case 'x':
+ error (0, 0, "the -x option has never done anything useful");
+ error (0, 0, "RCS files in CVS always end in ,v");
+ goto usage_error;
+
+ case 'V':
+ /* No longer supported. */
+ error (0, 0, "the `-V' option is obsolete");
+ break;
+
+ case 'k':
+ if (admin_data.kflag != NULL)
+ {
+ error (0, 0, "duplicate '-k' option");
+ goto usage_error;
+ }
+ admin_data.kflag = RCS_check_kflag (optarg);
+ break;
+ default:
+ case '?':
+ /* getopt will have printed an error message. */
+
+ usage_error:
+ /* Don't use command_name; it might be "server". */
+ error (1, 0, "specify %s -H admin for usage information",
+ program_name);
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ for (i = 0; i < admin_data.ac; ++i)
+ {
+ assert (admin_data.av[i][0] == '-');
+ switch (admin_data.av[i][1])
+ {
+ case 'm':
+ case 'l':
+ case 'u':
+ check_numeric (&admin_data.av[i][2], argc, argv);
+ break;
+ default:
+ break;
+ }
+ }
+ if (admin_data.branch != NULL)
+ check_numeric (admin_data.branch + 2, argc, argv);
+ if (admin_data.delete_revs != NULL)
+ {
+ char *p;
+
+ check_numeric (admin_data.delete_revs + 2, argc, argv);
+ p = strchr (admin_data.delete_revs + 2, ':');
+ if (p != NULL && isdigit (p[1]))
+ check_numeric (p + 1, argc, argv);
+ else if (p != NULL && p[1] == ':' && isdigit(p[2]))
+ check_numeric (p + 2, argc, argv);
+ }
#ifdef CLIENT_SUPPORT
if (client_active)
{
- int i;
-
/* We're the client side. Fire up the remote server. */
start_server ();
ign_setup ();
- for (i = 0; i < ac; ++i) /* XXX send -ko too with i = 0 */
- send_arg (av[i]);
+ /* Note that option_with_arg does not work for us, because some
+ of the options must be sent without a space between the option
+ and its argument. */
+ if (admin_data.interactive)
+ error (1, 0, "-I option not useful with client/server");
+ if (admin_data.branch != NULL)
+ send_arg (admin_data.branch);
+ if (admin_data.comment != NULL)
+ send_arg (admin_data.comment);
+ if (admin_data.set_strict)
+ send_arg ("-L");
+ if (admin_data.set_nonstrict)
+ send_arg ("-U");
+ if (admin_data.delete_revs != NULL)
+ send_arg (admin_data.delete_revs);
+ if (admin_data.desc != NULL)
+ send_arg (admin_data.desc);
+ if (admin_data.quiet)
+ send_arg ("-q");
+ if (admin_data.kflag != NULL)
+ send_arg (admin_data.kflag);
+
+ for (i = 0; i < admin_data.ac; ++i)
+ send_arg (admin_data.av[i]);
send_file_names (argc, argv, SEND_EXPAND_WILD);
send_files (argc, argv, 0, 0, SEND_NO_CONTENTS);
send_to_server ("admin\012", 0);
- return get_responses_and_close ();
+ err = get_responses_and_close ();
+ goto return_it;
}
#endif /* CLIENT_SUPPORT */
- /* start the recursion processor */
+ lock_tree_for_write (argc, argv, 0, 0);
+
err = start_recursion (admin_fileproc, (FILESDONEPROC) NULL, admin_dirproc,
- (DIRLEAVEPROC) NULL, NULL, argc, argv, 0,
- W_LOCAL, 0, 1, (char *) NULL, 1);
+ (DIRLEAVEPROC) NULL, (void *)&admin_data,
+ argc, argv, 0,
+ W_LOCAL, 0, 0, (char *) NULL, 1);
+ Lock_Cleanup ();
+
+ return_it:
+ if (admin_data.branch != NULL)
+ free (admin_data.branch);
+ if (admin_data.comment != NULL)
+ free (admin_data.comment);
+ if (admin_data.delete_revs != NULL)
+ free (admin_data.delete_revs);
+ if (admin_data.kflag != NULL)
+ free (admin_data.kflag);
+ if (admin_data.desc != NULL)
+ free (admin_data.desc);
+ for (i = 0; i < admin_data.ac; ++i)
+ free (admin_data.av[i]);
+ if (admin_data.av != NULL)
+ free (admin_data.av);
+
return (err);
}
@@ -115,12 +458,12 @@ admin_fileproc (callerdat, finfo)
void *callerdat;
struct file_info *finfo;
{
+ struct admin_data *admin_data = (struct admin_data *) callerdat;
Vers_TS *vers;
char *version;
- char **argv;
- int argc;
- int retcode = 0;
+ int i;
int status = 0;
+ RCSNode *rcs, *rcs2;
vers = Version_TS (finfo, NULL, NULL, NULL, 0, 0);
@@ -133,18 +476,326 @@ admin_fileproc (callerdat, finfo)
goto exitfunc;
}
- run_setup ("%s%s -x,v/", Rcsbin, RCS);
- for (argc = ac, argv = av; argc; argc--, argv++)
- run_arg (*argv);
- run_arg (vers->srcfile->path);
- if ((retcode = run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL)) != 0)
+ rcs = vers->srcfile;
+ if (rcs->flags & PARTIAL)
+ RCS_reparsercsfile (rcs, NULL);
+
+ status = 0;
+
+ if (!admin_data->quiet)
{
- if (!quiet)
- error (0, retcode == -1 ? errno : 0,
- "%s failed for `%s'", RCS, finfo->file);
- status = 1;
- goto exitfunc;
+ cvs_output ("RCS file: ", 0);
+ cvs_output (rcs->path, 0);
+ cvs_output ("\n", 1);
+ }
+
+ if (admin_data->branch != NULL)
+ RCS_setbranch (rcs, (admin_data->branch[2] == '\0'
+ ? NULL
+ : admin_data->branch + 2));
+ if (admin_data->comment != NULL)
+ {
+ if (rcs->comment != NULL)
+ free (rcs->comment);
+ rcs->comment = xstrdup (admin_data->comment + 2);
+ }
+ if (admin_data->set_strict)
+ rcs->strict_locks = 1;
+ if (admin_data->set_nonstrict)
+ rcs->strict_locks = 0;
+ if (admin_data->delete_revs != NULL)
+ {
+ char *s, *t, *rev1, *rev2;
+ /* Set for :, clear for ::. */
+ int inclusive;
+ char *t2;
+
+ s = admin_data->delete_revs + 2;
+ inclusive = 1;
+ t = strchr (s, ':');
+ if (t != NULL)
+ {
+ if (t[1] == ':')
+ {
+ inclusive = 0;
+ t2 = t + 2;
+ }
+ else
+ t2 = t + 1;
+ }
+
+ /* Note that we don't support '-' for ranges. RCS considers it
+ obsolete and it is problematic with tags containing '-'. "cvs log"
+ has made the same decision. */
+
+ if (t == NULL)
+ {
+ /* -orev */
+ rev1 = xstrdup (s);
+ rev2 = xstrdup (s);
+ }
+ else if (t == s)
+ {
+ /* -o:rev2 */
+ rev1 = NULL;
+ rev2 = xstrdup (t2);
+ }
+ else
+ {
+ *t = '\0';
+ rev1 = xstrdup (s);
+ *t = ':'; /* probably unnecessary */
+ if (*t2 == '\0')
+ /* -orev1: */
+ rev2 = NULL;
+ else
+ /* -orev1:rev2 */
+ rev2 = xstrdup (t2);
+ }
+
+ if (rev1 == NULL && rev2 == NULL)
+ {
+ /* RCS segfaults if `-o:' is given */
+ error (0, 0, "no valid revisions specified in `%s' option",
+ admin_data->delete_revs);
+ status = 1;
+ }
+ else
+ {
+ status |= RCS_delete_revs (rcs, rev1, rev2, inclusive);
+ if (rev1)
+ free (rev1);
+ if (rev2)
+ free (rev2);
+ }
+ }
+ if (admin_data->desc != NULL)
+ {
+ free (rcs->desc);
+ rcs->desc = NULL;
+ if (admin_data->desc[2] == '-')
+ rcs->desc = xstrdup (admin_data->desc + 3);
+ else
+ {
+ char *descfile = admin_data->desc + 2;
+ size_t bufsize = 0;
+ size_t len;
+
+ /* If -t specified with no argument, read from stdin. */
+ if (*descfile == '\0')
+ descfile = NULL;
+ get_file (descfile, descfile, "r", &rcs->desc, &bufsize, &len);
+ }
+ }
+ if (admin_data->kflag != NULL)
+ {
+ char *kflag = admin_data->kflag + 2;
+ if (!rcs->expand || strcmp (rcs->expand, kflag) != 0)
+ {
+ if (rcs->expand)
+ free (rcs->expand);
+ rcs->expand = xstrdup (kflag);
+ }
}
+
+ /* Handle miscellaneous options. TODO: decide whether any or all
+ of these should have their own fields in the admin_data
+ structure. */
+ for (i = 0; i < admin_data->ac; ++i)
+ {
+ char *arg;
+ char *p, *rev, *revnum, *tag, *msg;
+ char **users;
+ int argc, u;
+ Node *n;
+ RCSVers *delta;
+
+ arg = admin_data->av[i];
+ switch (arg[1])
+ {
+ case 'a': /* fall through */
+ case 'e':
+ line2argv (&argc, &users, arg + 2, " ,\t\n");
+ if (arg[1] == 'a')
+ for (u = 0; u < argc; ++u)
+ RCS_addaccess (rcs, users[u]);
+ else
+ for (u = 0; u < argc; ++u)
+ RCS_delaccess (rcs, users[u]);
+ free_names (&argc, users);
+ break;
+ case 'A':
+
+ /* See admin-19a-admin and friends in sanity.sh for
+ relative pathnames. It makes sense to think in
+ terms of a syntax which give pathnames relative to
+ the repository or repository corresponding to the
+ current directory or some such (and perhaps don't
+ include ,v), but trying to worry about such things
+ is a little pointless unless you first worry about
+ whether "cvs admin -A" as a whole makes any sense
+ (currently probably not, as access lists don't
+ affect the behavior of CVS). */
+
+ rcs2 = RCS_parsercsfile (arg + 2);
+ if (rcs2 == NULL)
+ error (1, 0, "cannot continue");
+
+ p = xstrdup (RCS_getaccess (rcs2));
+ line2argv (&argc, &users, p, " \t\n");
+ free (p);
+ freercsnode (&rcs2);
+
+ for (u = 0; u < argc; ++u)
+ RCS_addaccess (rcs, users[u]);
+ free_names (&argc, users);
+ break;
+ case 'n': /* fall through */
+ case 'N':
+ if (arg[2] == '\0')
+ {
+ cvs_outerr ("missing symbolic name after ", 0);
+ cvs_outerr (arg, 0);
+ cvs_outerr ("\n", 1);
+ break;
+ }
+ p = strchr (arg, ':');
+ if (p == NULL)
+ {
+ if (RCS_deltag (rcs, arg + 2) != 0)
+ {
+ error (0, 0, "%s: Symbolic name %s is undefined.",
+ rcs->path,
+ arg + 2);
+ status = 1;
+ continue;
+ }
+ break;
+ }
+ *p = '\0';
+ tag = xstrdup (arg + 2);
+ *p++ = ':';
+
+ /* Option `n' signals an error if this tag is already bound. */
+ if (arg[1] == 'n')
+ {
+ n = findnode (RCS_symbols (rcs), tag);
+ if (n != NULL)
+ {
+ error (0, 0,
+ "%s: symbolic name %s already bound to %s",
+ rcs->path,
+ tag, n->data);
+ status = 1;
+ continue;
+ }
+ }
+
+ /* Expand rev if necessary. */
+ rev = RCS_gettag (rcs, p, 0, NULL);
+ RCS_settag (rcs, tag, rev);
+ if (rev != NULL)
+ free (rev);
+ free (tag);
+ break;
+ case 's':
+ p = strchr (arg, ':');
+ if (p == NULL)
+ {
+ tag = xstrdup (arg + 2);
+ rev = RCS_head (rcs);
+ }
+ else
+ {
+ *p = '\0';
+ tag = xstrdup (arg + 2);
+ *p++ = ':';
+ rev = xstrdup (p);
+ }
+ revnum = RCS_gettag (rcs, rev, 0, NULL);
+ free (rev);
+ if (revnum != NULL)
+ n = findnode (rcs->versions, revnum);
+ if (revnum == NULL || n == NULL)
+ {
+ error (0, 0,
+ "%s: can't set state of nonexisting revision %s",
+ rcs->path,
+ rev);
+ if (revnum != NULL)
+ free (revnum);
+ status = 1;
+ continue;
+ }
+ delta = (RCSVers *) n->data;
+ free (delta->state);
+ delta->state = tag;
+ break;
+
+ case 'm':
+ p = strchr (arg, ':');
+ if (p == NULL)
+ {
+ error (0, 0, "%s: -m option lacks revision number",
+ rcs->path);
+ status = 1;
+ continue;
+ }
+ *p = '\0';
+ rev = RCS_gettag (rcs, arg + 2, 0, NULL);
+ if (rev == NULL)
+ {
+ error (0, 0, "%s: no such revision %s", rcs->path, rev);
+ status = 1;
+ continue;
+ }
+ *p++ = ':';
+ msg = p;
+
+ n = findnode (rcs->versions, rev);
+ delta = (RCSVers *) n->data;
+ if (delta->text == NULL)
+ {
+ delta->text = (Deltatext *) xmalloc (sizeof (Deltatext));
+ memset ((void *) delta->text, 0, sizeof (Deltatext));
+ }
+ delta->text->version = xstrdup (delta->version);
+ delta->text->log = make_message_rcslegal (msg);
+ break;
+
+ case 'l':
+ status |= RCS_lock (rcs, arg[2] ? arg + 2 : NULL, 0);
+ break;
+ case 'u':
+ status |= RCS_unlock (rcs, arg[2] ? arg + 2 : NULL, 0);
+ break;
+ default: assert(0); /* can't happen */
+ }
+ }
+
+ /* TODO: reconcile the weird discrepancies between
+ admin_data->quiet and quiet. */
+ if (status == 0)
+ {
+ RCS_rewrite (rcs, NULL, NULL);
+ if (!admin_data->quiet)
+ cvs_output ("done\n", 5);
+ }
+ else
+ {
+ /* Note that this message should only occur after another
+ message has given a more specific error. The point of this
+ additional message is to make it clear that the previous problems
+ caused CVS to forget about the idea of modifying the RCS file. */
+ error (0, 0, "cannot modify RCS file for `%s'", finfo->file);
+
+ /* Upon failure, we want to abandon any changes made to the
+ RCS data structure. Forcing a reparse does the trick,
+ but leaks memory and is kludgey. Should we export
+ free_rcsnode_contents for this purpose? */
+ RCS_reparsercsfile (rcs, NULL);
+ }
+
exitfunc:
freevers_ts (&vers);
return status;
diff --git a/contrib/cvs/src/buffer.c b/contrib/cvs/src/buffer.c
index d6ea895..0042e4c 100644
--- a/contrib/cvs/src/buffer.c
+++ b/contrib/cvs/src/buffer.c
@@ -1167,8 +1167,8 @@ static int stdio_buffer_flush PROTO((void *));
/* Initialize a buffer built on a stdio FILE. */
-struct buffer
-*stdio_buffer_initialize (fp, input, memory)
+struct buffer *
+stdio_buffer_initialize (fp, input, memory)
FILE *fp;
int input;
void (*memory) PROTO((struct buffer *));
@@ -1291,4 +1291,438 @@ stdio_buffer_flush (closure)
return 0;
}
+/* Certain types of communication input and output data in packets,
+ where each packet is translated in some fashion. The packetizing
+ buffer type supports that, given a buffer which handles lower level
+ I/O and a routine to translate the data in a packet.
+
+ This code uses two bytes for the size of a packet, so packets are
+ restricted to 65536 bytes in total.
+
+ The translation functions should just translate; they may not
+ significantly increase or decrease the amount of data. The actual
+ size of the initial data is part of the translated data. The
+ output translation routine may add up to PACKET_SLOP additional
+ bytes, and the input translation routine should shrink the data
+ correspondingly. */
+
+#define PACKET_SLOP (100)
+
+/* This structure is the closure field of a packetizing buffer. */
+
+struct packetizing_buffer
+{
+ /* The underlying buffer. */
+ struct buffer *buf;
+ /* The input translation function. Exactly one of inpfn and outfn
+ will be NULL. The input translation function should
+ untranslate the data in INPUT, storing the result in OUTPUT.
+ SIZE is the amount of data in INPUT, and is also the size of
+ OUTPUT. This should return 0 on success, or an errno code. */
+ int (*inpfn) PROTO((void *fnclosure, const char *input, char *output,
+ int size));
+ /* The output translation function. This should translate the
+ data in INPUT, storing the result in OUTPUT. The first two
+ bytes in INPUT will be the size of the data, and so will SIZE.
+ This should set *TRANSLATED to the amount of translated data in
+ OUTPUT. OUTPUT is large enough to hold SIZE + PACKET_SLOP
+ bytes. This should return 0 on success, or an errno code. */
+ int (*outfn) PROTO((void *fnclosure, const char *input, char *output,
+ int size, int *translated));
+ /* A closure for the translation function. */
+ void *fnclosure;
+ /* For an input buffer, we may have to buffer up data here. */
+ /* This is non-zero if the buffered data has been translated.
+ Otherwise, the buffered data has not been translated, and starts
+ with the two byte packet size. */
+ int translated;
+ /* The amount of buffered data. */
+ int holdsize;
+ /* The buffer allocated to hold the data. */
+ char *holdbuf;
+ /* The size of holdbuf. */
+ int holdbufsize;
+ /* If translated is set, we need another data pointer to track
+ where we are in holdbuf. If translated is clear, then this
+ pointer is not used. */
+ char *holddata;
+};
+
+static int packetizing_buffer_input PROTO((void *, char *, int, int, int *));
+static int packetizing_buffer_output PROTO((void *, const char *, int, int *));
+static int packetizing_buffer_flush PROTO((void *));
+static int packetizing_buffer_block PROTO((void *, int));
+static int packetizing_buffer_shutdown PROTO((void *));
+
+/* Create a packetizing buffer. */
+
+struct buffer *
+packetizing_buffer_initialize (buf, inpfn, outfn, fnclosure, memory)
+ struct buffer *buf;
+ int (*inpfn) PROTO ((void *, const char *, char *, int));
+ int (*outfn) PROTO ((void *, const char *, char *, int, int *));
+ void *fnclosure;
+ void (*memory) PROTO((struct buffer *));
+{
+ struct packetizing_buffer *pb;
+
+ pb = (struct packetizing_buffer *) xmalloc (sizeof *pb);
+ memset (pb, 0, sizeof *pb);
+
+ pb->buf = buf;
+ pb->inpfn = inpfn;
+ pb->outfn = outfn;
+ pb->fnclosure = fnclosure;
+
+ if (inpfn != NULL)
+ {
+ /* Add PACKET_SLOP to handle larger translated packets, and
+ add 2 for the count. This buffer is increased if
+ necessary. */
+ pb->holdbufsize = BUFFER_DATA_SIZE + PACKET_SLOP + 2;
+ pb->holdbuf = xmalloc (pb->holdbufsize);
+ }
+
+ return buf_initialize (inpfn != NULL ? packetizing_buffer_input : NULL,
+ inpfn != NULL ? NULL : packetizing_buffer_output,
+ inpfn != NULL ? NULL : packetizing_buffer_flush,
+ packetizing_buffer_block,
+ packetizing_buffer_shutdown,
+ memory,
+ pb);
+}
+
+/* Input data from a packetizing buffer. */
+
+static int
+packetizing_buffer_input (closure, data, need, size, got)
+ void *closure;
+ char *data;
+ int need;
+ int size;
+ int *got;
+{
+ struct packetizing_buffer *pb = (struct packetizing_buffer *) closure;
+
+ *got = 0;
+
+ if (pb->holdsize > 0 && pb->translated)
+ {
+ int copy;
+
+ copy = pb->holdsize;
+
+ if (copy > size)
+ {
+ memcpy (data, pb->holddata, size);
+ pb->holdsize -= size;
+ pb->holddata += size;
+ *got = size;
+ return 0;
+ }
+
+ memcpy (data, pb->holddata, copy);
+ pb->holdsize = 0;
+ pb->translated = 0;
+
+ data += copy;
+ need -= copy;
+ size -= copy;
+ *got = copy;
+ }
+
+ while (need > 0 || *got == 0)
+ {
+ int get, status, nread, count, tcount;
+ char *bytes;
+ char stackoutbuf[BUFFER_DATA_SIZE + PACKET_SLOP];
+ char *inbuf, *outbuf;
+
+ /* If we don't already have the two byte count, get it. */
+ if (pb->holdsize < 2)
+ {
+ get = 2 - pb->holdsize;
+ status = buf_read_data (pb->buf, get, &bytes, &nread);
+ if (status != 0)
+ {
+ /* buf_read_data can return -2, but a buffer input
+ function is only supposed to return -1, 0, or an
+ error code. */
+ if (status == -2)
+ status = ENOMEM;
+ return status;
+ }
+
+ if (nread == 0)
+ {
+ /* The buffer is in nonblocking mode, and we didn't
+ manage to read anything. */
+ return 0;
+ }
+
+ if (get == 1)
+ pb->holdbuf[1] = bytes[0];
+ else
+ {
+ pb->holdbuf[0] = bytes[0];
+ if (nread < 2)
+ {
+ /* We only got one byte, but we needed two. Stash
+ the byte we got, and try again. */
+ pb->holdsize = 1;
+ continue;
+ }
+ pb->holdbuf[1] = bytes[1];
+ }
+ pb->holdsize = 2;
+ }
+
+ /* Read the packet. */
+
+ count = (((pb->holdbuf[0] & 0xff) << 8)
+ + (pb->holdbuf[1] & 0xff));
+
+ if (count + 2 > pb->holdbufsize)
+ {
+ char *n;
+
+ /* We didn't allocate enough space in the initialize
+ function. */
+
+ n = realloc (pb->holdbuf, count + 2);
+ if (n == NULL)
+ {
+ (*pb->buf->memory_error) (pb->buf);
+ return ENOMEM;
+ }
+ pb->holdbuf = n;
+ pb->holdbufsize = count + 2;
+ }
+
+ get = count - (pb->holdsize - 2);
+
+ status = buf_read_data (pb->buf, get, &bytes, &nread);
+ if (status != 0)
+ {
+ /* buf_read_data can return -2, but a buffer input
+ function is only supposed to return -1, 0, or an error
+ code. */
+ if (status == -2)
+ status = ENOMEM;
+ return status;
+ }
+
+ if (nread == 0)
+ {
+ /* We did not get any data. Presumably the buffer is in
+ nonblocking mode. */
+ return 0;
+ }
+
+ if (nread < get)
+ {
+ /* We did not get all the data we need to fill the packet.
+ buf_read_data does not promise to return all the bytes
+ requested, so we must try again. */
+ memcpy (pb->holdbuf + pb->holdsize, bytes, nread);
+ pb->holdsize += nread;
+ continue;
+ }
+
+ /* We have a complete untranslated packet of COUNT bytes. */
+
+ if (pb->holdsize == 2)
+ {
+ /* We just read the entire packet (the 2 bytes in
+ PB->HOLDBUF are the size). Save a memcpy by
+ translating directly from BYTES. */
+ inbuf = bytes;
+ }
+ else
+ {
+ /* We already had a partial packet in PB->HOLDBUF. We
+ need to copy the new data over to make the input
+ contiguous. */
+ memcpy (pb->holdbuf + pb->holdsize, bytes, nread);
+ inbuf = pb->holdbuf + 2;
+ }
+
+ if (count <= sizeof stackoutbuf)
+ outbuf = stackoutbuf;
+ else
+ {
+ outbuf = malloc (count);
+ if (outbuf == NULL)
+ {
+ (*pb->buf->memory_error) (pb->buf);
+ return ENOMEM;
+ }
+ }
+
+ status = (*pb->inpfn) (pb->fnclosure, inbuf, outbuf, count);
+ if (status != 0)
+ return status;
+
+ /* The first two bytes in the translated buffer are the real
+ length of the translated data. */
+ tcount = ((outbuf[0] & 0xff) << 8) + (outbuf[1] & 0xff);
+
+ if (tcount > count)
+ error (1, 0, "Input translation failure");
+
+ if (tcount > size)
+ {
+ /* We have more data than the caller has provided space
+ for. We need to save some of it for the next call. */
+
+ memcpy (data, outbuf + 2, size);
+ *got += size;
+
+ pb->holdsize = tcount - size;
+ memcpy (pb->holdbuf, outbuf + 2 + size, tcount - size);
+ pb->holddata = pb->holdbuf;
+ pb->translated = 1;
+
+ if (outbuf != stackoutbuf)
+ free (outbuf);
+
+ return 0;
+ }
+
+ memcpy (data, outbuf + 2, tcount);
+
+ if (outbuf != stackoutbuf)
+ free (outbuf);
+
+ pb->holdsize = 0;
+
+ data += tcount;
+ need -= tcount;
+ size -= tcount;
+ *got += tcount;
+ }
+
+ return 0;
+}
+
+/* Output data to a packetizing buffer. */
+
+static int
+packetizing_buffer_output (closure, data, have, wrote)
+ void *closure;
+ const char *data;
+ int have;
+ int *wrote;
+{
+ struct packetizing_buffer *pb = (struct packetizing_buffer *) closure;
+ char inbuf[BUFFER_DATA_SIZE + 2];
+ char stack_outbuf[BUFFER_DATA_SIZE + PACKET_SLOP + 4];
+ struct buffer_data *outdata;
+ char *outbuf;
+ int size, status, translated;
+
+ if (have > BUFFER_DATA_SIZE)
+ {
+ /* It would be easy to malloc a buffer, but I don't think this
+ case can ever arise. */
+ abort ();
+ }
+
+ inbuf[0] = (have >> 8) & 0xff;
+ inbuf[1] = have & 0xff;
+ memcpy (inbuf + 2, data, have);
+
+ size = have + 2;
+
+ /* The output function is permitted to add up to PACKET_SLOP
+ bytes, and we need 2 bytes for the size of the translated data.
+ If we can guarantee that the result will fit in a buffer_data,
+ we translate directly into one to avoid a memcpy in buf_output. */
+ if (size + PACKET_SLOP + 2 > BUFFER_DATA_SIZE)
+ outbuf = stack_outbuf;
+ else
+ {
+ outdata = get_buffer_data ();
+ if (outdata == NULL)
+ {
+ (*pb->buf->memory_error) (pb->buf);
+ return ENOMEM;
+ }
+
+ outdata->next = NULL;
+ outdata->bufp = outdata->text;
+
+ outbuf = outdata->text;
+ }
+
+ status = (*pb->outfn) (pb->fnclosure, inbuf, outbuf + 2, size,
+ &translated);
+ if (status != 0)
+ return status;
+
+ /* The output function is permitted to add up to PACKET_SLOP
+ bytes. */
+ if (translated > size + PACKET_SLOP)
+ abort ();
+
+ outbuf[0] = (translated >> 8) & 0xff;
+ outbuf[1] = translated & 0xff;
+
+ if (outbuf == stack_outbuf)
+ buf_output (pb->buf, outbuf, translated + 2);
+ else
+ {
+ outdata->size = translated + 2;
+ buf_append_data (pb->buf, outdata, outdata);
+ }
+
+ *wrote = have;
+
+ /* We will only be here because buf_send_output was called on the
+ packetizing buffer. That means that we should now call
+ buf_send_output on the underlying buffer. */
+ return buf_send_output (pb->buf);
+}
+
+/* Flush data to a packetizing buffer. */
+
+static int
+packetizing_buffer_flush (closure)
+ void *closure;
+{
+ struct packetizing_buffer *pb = (struct packetizing_buffer *) closure;
+
+ /* Flush the underlying buffer. Note that if the original call to
+ buf_flush passed 1 for the BLOCK argument, then the buffer will
+ already have been set into blocking mode, so we should always
+ pass 0 here. */
+ return buf_flush (pb->buf, 0);
+}
+
+/* The block routine for a packetizing buffer. */
+
+static int
+packetizing_buffer_block (closure, block)
+ void *closure;
+ int block;
+{
+ struct packetizing_buffer *pb = (struct packetizing_buffer *) closure;
+
+ if (block)
+ return set_block (pb->buf);
+ else
+ return set_nonblock (pb->buf);
+}
+
+/* Shut down a packetizing buffer. */
+
+static int
+packetizing_buffer_shutdown (closure)
+ void *closure;
+{
+ struct packetizing_buffer *pb = (struct packetizing_buffer *) closure;
+
+ return buf_shutdown (pb->buf);
+}
+
#endif /* defined (SERVER_SUPPORT) || defined (CLIENT_SUPPORT) */
diff --git a/contrib/cvs/src/buffer.h b/contrib/cvs/src/buffer.h
index b62456c..c632490 100644
--- a/contrib/cvs/src/buffer.h
+++ b/contrib/cvs/src/buffer.h
@@ -110,6 +110,10 @@ extern struct buffer *stdio_buffer_initialize
PROTO((FILE *, int, void (*) (struct buffer *)));
extern struct buffer *compress_buffer_initialize
PROTO((struct buffer *, int, int, void (*) (struct buffer *)));
+extern struct buffer *packetizing_buffer_initialize
+ PROTO((struct buffer *, int (*) (void *, const char *, char *, int),
+ int (*) (void *, const char *, char *, int, int *), void *,
+ void (*) (struct buffer *)));
extern int buf_empty_p PROTO((struct buffer *));
extern void buf_output PROTO((struct buffer *, const char *, int));
extern void buf_output0 PROTO((struct buffer *, const char *));
diff --git a/contrib/cvs/src/checkin.c b/contrib/cvs/src/checkin.c
index 0da220c..1d89ae1 100644
--- a/contrib/cvs/src/checkin.c
+++ b/contrib/cvs/src/checkin.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Check In
*
@@ -69,7 +69,10 @@ Checkin (type, finfo, rcs, rev, tag, options, message)
}
}
- switch (RCS_checkin (rcs, NULL, message, rev, 0))
+ if (finfo->rcs == NULL)
+ finfo->rcs = RCS_parse (finfo->file, finfo->repository);
+
+ switch (RCS_checkin (finfo->rcs, NULL, message, rev, 0))
{
case 0: /* everything normal */
@@ -85,12 +88,6 @@ Checkin (type, finfo, rcs, rev, tag, options, message)
if (strcmp (options, "-V4") == 0) /* upgrade to V5 now */
options[0] = '\0';
- /* Reparse the RCS file, so that we can safely call
- RCS_checkout. FIXME: We could probably calculate
- all the changes. */
- freercsnode (&finfo->rcs);
- finfo->rcs = RCS_parse (finfo->file, finfo->repository);
-
/* FIXME: should be checking for errors. */
(void) RCS_checkout (finfo->rcs, finfo->file, rev,
(char *) NULL, options, RUN_TTY,
@@ -117,7 +114,7 @@ Checkin (type, finfo, rcs, rev, tag, options, message)
* If we want read-only files, muck the permissions here, before
* getting the file time-stamp.
*/
- if (cvswrite == FALSE || fileattr_get (finfo->file, "_watched"))
+ if (!cvswrite || fileattr_get (finfo->file, "_watched"))
xchmod (finfo->file, 0);
/* Re-register with the new data. */
@@ -173,6 +170,7 @@ Checkin (type, finfo, rcs, rev, tag, options, message)
if (rev)
{
(void) RCS_unlock (finfo->rcs, NULL, 1);
+ RCS_rewrite (finfo->rcs, NULL, NULL);
}
#ifdef SERVER_SUPPORT
diff --git a/contrib/cvs/src/checkout.c b/contrib/cvs/src/checkout.c
index e36e729..3c1eef7 100644
--- a/contrib/cvs/src/checkout.c
+++ b/contrib/cvs/src/checkout.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Create Version
*
@@ -61,6 +61,7 @@ static const char *const checkout_usage[] =
"\t-d dir\tCheck out into dir instead of module name.\n",
"\t-k kopt\tUse RCS kopt -k option on checkout.\n",
"\t-j rev\tMerge in changes made between current revision and rev.\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -76,6 +77,7 @@ static const char *const export_usage[] =
"\t-D date\tExport revisions as of date.\n",
"\t-d dir\tExport into dir instead of module name.\n",
"\t-k kopt\tUse RCS kopt -k option on checkout.\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -257,7 +259,7 @@ checkout (argc, argv)
server send the check-in and update programs for the
various modules/dirs requested. If we turn this off and
simply request the names of the modules and directories (as
- below in !expand_modules), those files (CVS/Checking.prog
+ below in !expand_modules), those files (CVS/Checkin.prog
or CVS/Update.prog) don't get created. Grrr. */
expand_modules = (!cat && !status && !pipeout
@@ -332,54 +334,16 @@ checkout (argc, argv)
}
db = open_module ();
- /*
- * if we have more than one argument and where was specified, we make the
- * where, cd into it, and try to shorten names as much as possible.
- * Otherwise, we pass the where as a single argument to do_module.
- */
- if (argc > 1 && where != NULL)
- {
- (void) CVS_MKDIR (where, 0777);
- if ( CVS_CHDIR (where) < 0)
- error (1, errno, "cannot chdir to %s", where);
- preload_update_dir = xstrdup (where);
- where = (char *) NULL;
- if (!isfile (CVSADM))
- {
- char *repository;
- repository = xmalloc (strlen (CVSroot_directory) + 80);
- (void) sprintf (repository, "%s/%s/%s", CVSroot_directory,
- CVSROOTADM, CVSNULLREPOS);
- if (!isfile (repository))
- {
- mode_t omask;
- omask = umask (cvsumask);
- (void) CVS_MKDIR (repository, 0777);
- (void) umask (omask);
- }
+ /* If we've specified something like "cvs co foo/bar baz/quux"
+ don't try to shorten names. There are a few cases in which we
+ could shorten (e.g. "cvs co foo/bar foo/baz"), but we don't
+ handle those yet. Better to have an extra directory created
+ than the thing checked out under the wrong directory name. */
- /* I'm not sure whether this check is redundant. */
- if (!isdir (repository))
- error (1, 0, "there is no repository %s", repository);
+ if (argc > 1)
+ shorten = 0;
- Create_Admin (".", preload_update_dir, repository,
- (char *) NULL, (char *) NULL, 0);
- if (!noexec)
- {
- FILE *fp;
-
- fp = open_file (CVSADM_ENTSTAT, "w+");
- if (fclose(fp) == EOF)
- error(1, errno, "cannot close %s", CVSADM_ENTSTAT);
-#ifdef SERVER_SUPPORT
- if (server_active)
- server_set_entstat (preload_update_dir, repository);
-#endif
- }
- free (repository);
- }
- }
/* If we will be calling history_write, work out the name to pass
it. */
@@ -396,29 +360,6 @@ checkout (argc, argv)
history_name = date;
}
- /*
- * if where was specified (-d) and we have not taken care of it already
- * with the multiple arg stuff, and it was not a simple directory name
- * but rather a path, we strip off everything but the last component and
- * attempt to cd to the indicated place. where then becomes simply the
- * last component
- */
- if (where != NULL && strchr (where, '/') != NULL)
- {
- char *slash;
-
- slash = strrchr (where, '/');
- *slash = '\0';
-
- if ( CVS_CHDIR (where) < 0)
- error (1, errno, "cannot chdir to %s", where);
-
- preload_update_dir = xstrdup (where);
-
- where = slash + 1;
- if (*where == '\0')
- where = NULL;
- }
for (i = 0; i < argc; i++)
err += do_module (db, argv[i], m_type, "Updating", checkout_proc,
@@ -456,6 +397,8 @@ safe_location ()
hardpath[x] = '\0';
}
current = xgetwd ();
+ if (current == NULL)
+ error (1, errno, "could not get working directory");
hardpath_len = strlen (hardpath);
if (strlen (current) >= hardpath_len
&& strncmp (current, hardpath, hardpath_len) == 0)
@@ -506,17 +449,18 @@ build_one_dir (repository, dirpath, sticky)
if (!isdir (repository))
error (1, 0, "there is no repository %s", repository);
- Create_Admin (".", dirpath, repository,
- sticky ? (char *) NULL : tag,
- sticky ? (char *) NULL : date,
+ if (Create_Admin (".", dirpath, repository,
+ sticky ? (char *) NULL : tag,
+ sticky ? (char *) NULL : date,
- /* FIXME? This is a guess. If it is important
- for nonbranch to be set correctly here I
- think we need to write it one way now and
- then rewrite it later via WriteTag, once
- we've had a chance to call RCS_nodeisbranch
- on each file. */
- 0);
+ /* FIXME? This is a guess. If it is important
+ for nonbranch to be set correctly here I
+ think we need to write it one way now and
+ then rewrite it later via WriteTag, once
+ we've had a chance to call RCS_nodeisbranch
+ on each file. */
+ 0, 1))
+ return;
if (!noexec)
{
@@ -536,11 +480,11 @@ build_one_dir (repository, dirpath, sticky)
*/
/* ARGSUSED */
static int
-checkout_proc (pargc, argv, where, mwhere, mfile, shorten,
+checkout_proc (pargc, argv, where_orig, mwhere, mfile, shorten,
local_specified, omodule, msg)
int *pargc;
char **argv;
- char *where;
+ char *where_orig;
char *mwhere;
char *mfile;
int shorten;
@@ -551,11 +495,9 @@ checkout_proc (pargc, argv, where, mwhere, mfile, shorten,
int err = 0;
int which;
char *cp;
- char *cp2;
char *repository;
- char *xwhere = NULL;
char *oldupdate = NULL;
- char *prepath;
+ char *where;
/*
* OK, so we're doing the checkout! Our args are as follows:
@@ -563,152 +505,172 @@ checkout_proc (pargc, argv, where, mwhere, mfile, shorten,
* where contains where to put it (if supplied by checkout)
* mwhere contains the module name or -d from module file
* mfile says do only that part of the module
- * shorten = TRUE says shorten as much as possible
+ * shorten = 1 says shorten as much as possible
* omodule is the original arg to do_module()
*/
- /* set up the repository (maybe) for the bottom directory */
- repository = xmalloc (strlen (CVSroot_directory) + strlen (argv[0]) + 5);
+ /* Set up the repository (maybe) for the bottom directory.
+ Allocate more space than we need so we don't need to keep
+ reallocating this string. */
+ repository = xmalloc (strlen (CVSroot_directory)
+ + strlen (argv[0])
+ + (mfile == NULL ? 0 : strlen (mfile))
+ + 10);
(void) sprintf (repository, "%s/%s", CVSroot_directory, argv[0]);
+ Sanitize_Repository_Name (repository);
+
/* save the original value of preload_update_dir */
if (preload_update_dir != NULL)
oldupdate = xstrdup (preload_update_dir);
- /* fix up argv[] for the case of partial modules */
- if (mfile != NULL)
- {
- char *file;
- /* if mfile is really a path, straighten it out first */
- if ((cp = strrchr (mfile, '/')) != NULL)
+ /* Allocate space and set up the where variable. We allocate more
+ space than necessary here so that we don't have to keep
+ reallocaing it later on. */
+
+ where = xmalloc (strlen (argv[0])
+ + (mfile == NULL ? 0 : strlen (mfile))
+ + (mwhere == NULL ? 0 : strlen (mwhere))
+ + (where_orig == NULL ? 0 : strlen (where_orig))
+ + 10);
+
+ /* Yes, this could be written in a less verbose way, but in this
+ form it is quite easy to read.
+
+ FIXME? The following code that sets should probably be moved
+ to do_module in modules.c, since there is similar code in
+ patch.c and rtag.c. */
+
+ if (shorten)
+ {
+ if (where_orig != NULL)
{
- *cp = 0;
- repository = xrealloc (repository,
- strlen (repository) + strlen (mfile) + 10);
- (void) strcat (repository, "/");
- (void) strcat (repository, mfile);
-
- /*
- * Now we need to fill in the where correctly. if !shorten, tack
- * the rest of the path onto where if where is filled in
- * otherwise tack the rest of the path onto mwhere and make that
- * the where
- *
- * If shorten is enabled, we might use mwhere to set where if
- * nobody set it yet, so we'll need to setup mwhere as the last
- * component of the path we are tacking onto repository
- */
- if (!shorten)
- {
- if (where != NULL)
- {
- xwhere = xmalloc (strlen (where) + strlen (mfile) + 5);
- (void) sprintf (xwhere, "%s/%s", where, mfile);
- }
- else
- {
- xwhere = xmalloc (strlen (mwhere) + strlen (mfile) + 5);
- (void) sprintf (xwhere, "%s/%s", mwhere, mfile);
- }
- where = xwhere;
- }
- else
- {
- char *slash;
-
- if ((slash = strrchr (mfile, '/')) != NULL)
- mwhere = slash + 1;
- else
- mwhere = mfile;
- }
- mfile = cp + 1;
+ /* If the user has specified a directory with `-d' on the
+ command line, use it preferentially, even over the `-d'
+ flag in the modules file. */
+
+ (void) strcpy (where, where_orig);
}
-
- file = xmalloc (strlen (repository) + strlen (mfile) + 5);
- (void) sprintf (file, "%s/%s", repository, mfile);
- if (isdir (file))
+ else if (mwhere != NULL)
{
+ /* Second preference is the value of mwhere, which is from
+ the `-d' flag in the modules file. */
- /*
- * The portion of a module was a directory, so kludge up where to
- * be the subdir, and fix up repository
- */
- free (repository);
- repository = xstrdup (file);
-
- /*
- * At this point, if shorten is not enabled, we make where either
- * where with mfile concatenated, or if where hadn't been set we
- * set it to mwhere with mfile concatenated.
- *
- * If shorten is enabled and where hasn't been set yet, then where
- * becomes mfile
- */
- if (!shorten)
- {
- if (where != NULL)
- {
- xwhere = xmalloc (strlen (where) + strlen (mfile) + 5);
- (void) sprintf (xwhere, "%s/%s", where, mfile);
- }
- else
- {
- xwhere = xmalloc (strlen (mwhere) + strlen (mfile) + 5);
- (void) sprintf (xwhere, "%s/%s", mwhere, mfile);
- }
- where = xwhere;
- }
- else if (where == NULL)
- where = mfile;
+ (void) strcpy (where, mwhere);
}
else
{
- int i;
-
- /*
- * The portion of a module was a file, so kludge up argv to be
- * correct
- */
- for (i = 1; i < *pargc; i++)/* free the old ones */
- free (argv[i]);
- /* FIXME: Normally one has to realloc argv to make sure
- argv[1] exists. But this argv does not points to the
- beginning of an allocated block. For now we allocate
- at least 4 entries for argv (in line2argv). */
- argv[1] = xstrdup (mfile); /* set up the new one */
- *pargc = 2;
-
- /* where gets mwhere if where isn't set */
- if (where == NULL)
- where = mwhere;
+ /* Third preference is the directory specified in argv[0]
+ which is this module'e directory in the repository. */
+
+ (void) strcpy (where, argv[0]);
}
- free (file);
}
-
- /*
- * if shorten is enabled and where isn't specified yet, we pluck the last
- * directory component of argv[0] and make it the where
- */
- if (shorten && where == NULL)
+ else
{
- if ((cp = strrchr (argv[0], '/')) != NULL)
+ /* Use the same preferences here, bug don't shorten -- that
+ is, tack on where_orig if it exists. */
+
+ *where = '\0';
+
+ if (where_orig != NULL)
{
- xwhere = xstrdup (cp + 1);
- where = xwhere;
+ (void) strcat (where, where_orig);
+ (void) strcat (where, "/");
}
+
+ if (mwhere != NULL)
+ (void) strcat (where, mwhere);
+ else
+ (void) strcat (where, argv[0]);
}
+ strip_trailing_slashes (where); /* necessary? */
+
- /* if where is still NULL, use mwhere if set or the argv[0] dir */
- if (where == NULL)
+ /* At this point, the user may have asked for a single file or
+ directory from within a module. In that case, we should modify
+ where, repository, and argv as appropriate. */
+
+ if (mfile != NULL)
{
- if (mwhere)
- where = mwhere;
+ /* The mfile variable can have one or more path elements. If
+ it has multiple elements, we want to tack those onto both
+ repository and where. The last element may refer to either
+ a file or directory. Here's what to do:
+
+ it refers to a directory
+ -> simply tack it on to where and repository
+ it refers to a file
+ -> munge argv to contain `basename mfile` */
+
+ char *cp;
+ char *path;
+
+
+ /* Paranoia check. */
+
+ if (mfile[strlen (mfile) - 1] == '/')
+ {
+ error (0, 0, "checkout_proc: trailing slash on mfile (%s)!",
+ mfile);
+ }
+
+
+ /* Does mfile have multiple path elements? */
+
+ cp = strrchr (mfile, '/');
+ if (cp != NULL)
+ {
+ *cp = '\0';
+ (void) strcat (repository, "/");
+ (void) strcat (repository, mfile);
+ (void) strcat (where, "/");
+ (void) strcat (where, mfile);
+ mfile = cp + 1;
+ }
+
+
+ /* Now mfile is a single path element. */
+
+ path = xmalloc (strlen (repository) + strlen (mfile) + 5);
+ (void) sprintf (path, "%s/%s", repository, mfile);
+ if (isdir (path))
+ {
+ /* It's a directory, so tack it on to repository and
+ where, as we did above. */
+
+ (void) strcat (repository, "/");
+ (void) strcat (repository, mfile);
+ (void) strcat (where, "/");
+ (void) strcat (where, mfile);
+ }
else
{
- xwhere = xstrdup (argv[0]);
- where = xwhere;
+ /* It's a file, which means we have to screw around with
+ argv. */
+
+ int i;
+
+
+ /* Paranoia check. */
+
+ if (*pargc > 1)
+ {
+ error (0, 0, "checkout_proc: trashing argv elements!");
+ for (i = 1; i < *pargc; i++)
+ {
+ error (0, 0, "checkout_proc: argv[%d] `%s'",
+ i, argv[i]);
+ }
+ }
+
+ for (i = 1; i < *pargc; i++)
+ free (argv[i]);
+ argv[1] = xstrdup (mfile);
+ (*pargc) = 2;
}
+ free (path);
}
if (preload_update_dir != NULL)
@@ -725,6 +687,12 @@ checkout_proc (pargc, argv, where, mwhere, mfile, shorten,
/*
* At this point, where is the directory we want to build, repository is
* the repository for the lowest level of the path.
+ *
+ * We need to tell build_dirs not only the path we want it to
+ * build, but also the repositories we want it to populate the
+ * path with. To accomplish this, we walk the path backwards, one
+ * pathname component at a time, constucting a linked list of
+ * struct dir_to_build.
*/
/*
@@ -733,20 +701,11 @@ checkout_proc (pargc, argv, where, mwhere, mfile, shorten,
*/
if (!pipeout)
{
- size_t root_len;
struct dir_to_build *head;
+ char *reposcopy;
- /* We need to tell build_dirs not only the path we want it to
- build, but also the repositories we want it to populate the
- path with. To accomplish this, we walk the path backwards,
- one pathname component at a time, constucting a linked
- list of struct dir_to_build. */
- prepath = xstrdup (repository);
-
- /* We don't want to start stripping elements off prepath after we
- get to CVSROOT. */
- root_len = strlen (CVSroot_directory);
- if (strncmp (repository, CVSroot_directory, root_len) != 0)
+ if (strncmp (repository, CVSroot_directory,
+ strlen (CVSroot_directory)) != 0)
error (1, 0, "\
internal error: %s doesn't start with %s in checkout_proc",
repository, CVSroot_directory);
@@ -760,9 +719,14 @@ internal error: %s doesn't start with %s in checkout_proc",
head->dirpath = xstrdup (where);
head->next = NULL;
- cp = strrchr (where, '/');
- cp2 = strrchr (prepath, '/');
+ /* Make a copy of the repository name to play with. */
+ reposcopy = xstrdup (repository);
+
+ /* FIXME: this should be written in terms of last_component instead
+ of hardcoding '/'. This presumably affects OS/2, NT, &c, if
+ the user specifies '\'. Likewise for the call to findslash. */
+ cp = strrchr (where, '/');
while (cp != NULL)
{
struct dir_to_build *new;
@@ -771,42 +735,97 @@ internal error: %s doesn't start with %s in checkout_proc",
new->dirpath = xmalloc (strlen (where));
strncpy (new->dirpath, where, cp - where);
new->dirpath[cp - where] = '\0';
- if (cp2 == NULL || cp2 < prepath + root_len)
+
+ /* Now figure out what repository directory to generate.
+ The most complete case would be something like this:
+
+ The modules file contains
+ foo -d bar/baz quux
+
+ The command issued was:
+ cvs co -d what/ever -N foo
+
+ The results in the CVS/Repository files should be:
+ . -> . (this is where we executed the cmd)
+ what -> Emptydir (generated dir -- not in repos)
+ ever -> . (same as "cd what/ever; cvs co -N foo")
+ bar -> Emptydir (generated dir -- not in repos)
+ baz -> quux (finally!) */
+
+ if (strcmp (reposcopy, CVSroot_directory) == 0)
{
- /* Don't walk up past CVSROOT; instead put in CVSNULLREPOS. */
- new->repository =
- xmalloc (strlen (CVSroot_directory) + 80);
- (void) sprintf (new->repository, "%s/%s/%s",
- CVSroot_directory,
- CVSROOTADM, CVSNULLREPOS);
- if (!isfile (new->repository))
- {
- mode_t omask;
- omask = umask (cvsumask);
- if (CVS_MKDIR (new->repository, 0777) < 0)
- error (0, errno, "cannot create %s",
- new->repository);
- (void) umask (omask);
- }
+ /* We can't walk up past CVSROOT. Instead, the
+ repository should be Emptydir. */
+ new->repository = emptydir_name ();
}
else
{
- new->repository = xmalloc (strlen (prepath));
- strncpy (new->repository, prepath, cp2 - prepath);
- new->repository[cp2 - prepath] = '\0';
+ if ((where_orig != NULL)
+ && (strcmp (new->dirpath, where_orig) == 0))
+ {
+ /* It's the case that the user specified a
+ * destination directory with the "-d" flag. The
+ * repository in this directory should be "."
+ * since the user's command is equivalent to:
+ *
+ * cd <dir>; cvs co blah */
+
+ strcpy (reposcopy, CVSroot_directory);
+ goto allocate_repos;
+ }
+ else if (mwhere != NULL)
+ {
+ /* This is a generated directory, so point to
+ CVSNULLREPOS. */
+
+ new->repository = emptydir_name ();
+ }
+ else
+ {
+ /* It's a directory in the repository! */
+
+ char *rp = strrchr (reposcopy, '/');
+
+ /* We'll always be below CVSROOT, but check for
+ paranoia's sake. */
+ if (rp == NULL)
+ error (1, 0,
+ "internal error: %s doesn't contain a slash",
+ reposcopy);
+
+ *rp = '\0';
+
+ allocate_repos:
+ new->repository = xmalloc (strlen (reposcopy) + 5);
+ (void) strcpy (new->repository, reposcopy);
+
+ if (strcmp (reposcopy, CVSroot_directory) == 0)
+ {
+ /* Special case -- the repository name needs
+ to be "/path/to/repos/." (the trailing dot
+ is important). We might be able to get rid
+ of this after the we check out the other
+ code that handles repository names. */
+ (void) strcat (new->repository, "/.");
+ }
+ }
}
+
new->next = head;
head = new;
cp = findslash (where, cp - 1);
- cp2 = findslash (prepath, cp2 - 1);
}
- /* First build the top-level CVSADM directory. The value we
- pass in here for repository is probably wrong; see modules3-7f
- in the testsuite. */
- build_one_dir (head->repository != NULL ? head->repository : prepath,
- ".", *pargc <= 1);
+ /* clean up */
+ free (reposcopy);
+
+ /* The top-level CVSADM directory should always be
+ CVSroot_directory. Create it.
+
+ It may be argued that we shouldn't set any sticky bits for
+ the top-level repository. FIXME? */
+ build_one_dir (CVSroot_directory, ".", *pargc <= 1);
/*
* build dirs on the path if necessary and leave us in the bottom
@@ -817,14 +836,10 @@ internal error: %s doesn't start with %s in checkout_proc",
if (build_dirs_and_chdir (head, *pargc <= 1) != 0)
{
error (0, 0, "ignoring module %s", omodule);
- free (prepath);
err = 1;
goto out;
}
- /* clean up */
- free (prepath);
-
/* set up the repository (or make sure the old one matches) */
if (!isfile (CVSADM))
{
@@ -837,7 +852,7 @@ internal error: %s doesn't start with %s in checkout_proc",
error (1, 0, "there is no repository %s", repository);
Create_Admin (".", preload_update_dir, repository,
- (char *) NULL, (char *) NULL, 0);
+ (char *) NULL, (char *) NULL, 0, 0);
fp = open_file (CVSADM_ENTSTAT, "w+");
if (fclose(fp) == EOF)
error(1, errno, "cannot close %s", CVSADM_ENTSTAT);
@@ -860,7 +875,7 @@ internal error: %s doesn't start with %s in checkout_proc",
then rewrite it later via WriteTag, once
we've had a chance to call RCS_nodeisbranch
on each file. */
- 0);
+ 0, 0);
}
}
else
@@ -1004,8 +1019,7 @@ internal error: %s doesn't start with %s in checkout_proc",
out:
free (preload_update_dir);
preload_update_dir = oldupdate;
- if (xwhere != NULL)
- free (xwhere);
+ free (where);
free (repository);
return (err);
}
@@ -1026,6 +1040,32 @@ findslash (start, p)
return (p);
}
+/* Return a newly malloc'd string containing a pathname for CVSNULLREPOS,
+ and make sure that it exists. If there is an error creating the
+ directory, give a fatal error. Otherwise, the directory is guaranteed
+ to exist when we return. */
+char *
+emptydir_name ()
+{
+ char *repository;
+
+ repository = xmalloc (strlen (CVSroot_directory)
+ + sizeof (CVSROOTADM)
+ + sizeof (CVSNULLREPOS)
+ + 10);
+ (void) sprintf (repository, "%s/%s/%s", CVSroot_directory,
+ CVSROOTADM, CVSNULLREPOS);
+ if (!isfile (repository))
+ {
+ mode_t omask;
+ omask = umask (cvsumask);
+ if (CVS_MKDIR (repository, 0777) < 0)
+ error (1, errno, "cannot create %s", repository);
+ (void) umask (omask);
+ }
+ return repository;
+}
+
/* Build all the dirs along the path to DIRS with CVS subdirs with appropriate
repositories. If ->repository is NULL, do not create a CVSADM directory
for that subdirectory; just CVS_CHDIR into it. */
diff --git a/contrib/cvs/src/classify.c b/contrib/cvs/src/classify.c
index 55851f7..57c23cd 100644
--- a/contrib/cvs/src/classify.c
+++ b/contrib/cvs/src/classify.c
@@ -3,19 +3,14 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
*/
#include "cvs.h"
-#ifdef SERVER_SUPPORT
-static void sticky_ck PROTO((char *file, int aflag, Vers_TS * vers,
- List * entries,
- char *repository, char *update_dir));
-#else
-static void sticky_ck PROTO((char *file, int aflag, Vers_TS * vers, List * entries));
-#endif
+static void sticky_ck PROTO ((struct file_info *finfo, int aflag,
+ Vers_TS * vers));
/*
* Classify the state of a file
@@ -26,7 +21,11 @@ Classify_File (finfo, tag, date, options, force_tag_match, aflag, versp,
struct file_info *finfo;
char *tag;
char *date;
+
+ /* Keyword expansion options. Can be either NULL or "" to
+ indicate none are specified here. */
char *options;
+
int force_tag_match;
int aflag;
Vers_TS **versp;
@@ -68,8 +67,8 @@ Classify_File (finfo, tag, date, options, force_tag_match, aflag, versp,
is what I would expect. */
if (!force_tag_match || !(vers->tag || vers->date))
if (!really_quiet)
- error (0, 0, "use `cvs add' to create an entry for %s",
- finfo->fullname);
+ error (0, 0, "use `%s add' to create an entry for %s",
+ program_name, finfo->fullname);
ret = T_UNKNOWN;
}
}
@@ -79,8 +78,8 @@ Classify_File (finfo, tag, date, options, force_tag_match, aflag, versp,
ret = T_UPTODATE;
else
{
- error (0, 0, "use `cvs add' to create an entry for %s",
- finfo->fullname);
+ error (0, 0, "use `%s add' to create an entry for %s",
+ program_name, finfo->fullname);
ret = T_UNKNOWN;
}
}
@@ -308,12 +307,7 @@ conflict: %s created independently by second party",
ret = T_CHECKOUT;
else
{
-#ifdef SERVER_SUPPORT
- sticky_ck (finfo->file, aflag, vers, finfo->entries,
- finfo->repository, finfo->update_dir);
-#else
- sticky_ck (finfo->file, aflag, vers, finfo->entries);
-#endif
+ sticky_ck (finfo, aflag, vers);
ret = T_UPTODATE;
}
}
@@ -339,12 +333,7 @@ conflict: %s created independently by second party",
ret = T_NEEDS_MERGE;
#else
ret = T_MODIFIED;
-#ifdef SERVER_SUPPORT
- sticky_ck (finfo->file, aflag, vers, finfo->entries,
- finfo->repository, finfo->update_dir);
-#else
- sticky_ck (finfo->file, aflag, vers, finfo->entries);
-#endif /* SERVER_SUPPORT */
+ sticky_ck (finfo, aflag, vers);
#endif
}
else
@@ -434,19 +423,10 @@ conflict: %s created independently by second party",
}
static void
-#ifdef SERVER_SUPPORT
-sticky_ck (file, aflag, vers, entries, repository, update_dir)
-#else
-sticky_ck (file, aflag, vers, entries)
-#endif
- char *file;
+sticky_ck (finfo, aflag, vers)
+ struct file_info *finfo;
int aflag;
Vers_TS *vers;
- List *entries;
-#ifdef SERVER_SUPPORT
- char *repository;
- char *update_dir;
-#endif
{
if (aflag || vers->tag || vers->date)
{
@@ -458,7 +438,7 @@ sticky_ck (file, aflag, vers, entries)
(entdate && vers->date && strcmp (entdate, vers->date)) ||
((entdate && !vers->date) || (!entdate && vers->date)))
{
- Register (entries, file, vers->vn_user, vers->ts_rcs,
+ Register (finfo->entries, finfo->file, vers->vn_user, vers->ts_rcs,
vers->options, vers->tag, vers->date, vers->ts_conflict);
#ifdef SERVER_SUPPORT
@@ -468,7 +448,7 @@ sticky_ck (file, aflag, vers, entries)
It is possible we will later update it again via
server_updated or some such, but that is OK. */
server_update_entries
- (file, update_dir, repository,
+ (finfo->file, finfo->update_dir, finfo->repository,
strcmp (vers->ts_rcs, vers->ts_user) == 0 ?
SERVER_UPDATED : SERVER_MERGED);
}
diff --git a/contrib/cvs/src/client.c b/contrib/cvs/src/client.c
index a1ed876..e0239bb 100644
--- a/contrib/cvs/src/client.c
+++ b/contrib/cvs/src/client.c
@@ -75,6 +75,18 @@ static Key_schedule sched;
#endif /* HAVE_KERBEROS */
#endif /* HAVE_KERBEROS */
+
+#ifdef HAVE_GSSAPI
+
+#include <gssapi/gssapi.h>
+#include <gssapi/gssapi_generic.h>
+
+/* This is needed for GSSAPI encryption. */
+static gss_ctx_id_t gcontext;
+
+static int connect_to_gserver PROTO((int, struct hostent *));
+
+#endif /* HAVE_GSSAPI */
static void add_prune_candidate PROTO((char *));
@@ -450,8 +462,12 @@ log_buffer_shutdown (closure)
void *closure;
{
struct log_buffer *lb = (struct log_buffer *) closure;
+ int retval;
- return buf_shutdown (lb->buf);
+ retval = buf_shutdown (lb->buf);
+ if (fclose (lb->log) < 0)
+ error (0, errno, "closing log file");
+ return retval;
}
#ifdef NO_SOCKET_TO_FD
@@ -538,6 +554,17 @@ socket_buffer_input (closure, data, need, size, got)
do
{
+
+ /* Note that for certain (broken?) networking stacks, like
+ VMS's UCX (not sure what version, problem reported with
+ recv() in 1997), and (according to windows-NT/config.h)
+ Windows NT 3.51, we must call recv or send with a
+ moderately sized buffer (say, less than 200K or something),
+ or else there may be network errors (somewhat hard to
+ produce, e.g. WAN not LAN or some such). buf_read_data
+ makes sure that we only recv() BUFFER_DATA_SIZE bytes at
+ a time. */
+
nbytes = recv (sb->socket, data, size, 0);
if (nbytes < 0)
error (1, 0, "reading from server: %s", SOCK_STRERROR (SOCK_ERRNO));
@@ -575,6 +602,9 @@ socket_buffer_output (closure, data, have, wrote)
*wrote = have;
+ /* See comment in socket_buffer_input regarding buffer size we pass
+ to send and recv. */
+
#ifdef SEND_NEVER_PARTIAL
/* If send() never will produce a partial write, then just do it. This
is needed for systems where its return value is something other than
@@ -941,7 +971,7 @@ call_in_directory (pathname, func, data)
strcpy (r, "/.");
Create_Admin (".", ".", repo, (char *) NULL,
- (char *) NULL, 0);
+ (char *) NULL, 0, 1);
free (repo);
}
@@ -1078,7 +1108,7 @@ warning: server is not creating directories one at a time");
strcpy (r, reposdirname);
Create_Admin (dir, dir, repo,
- (char *)NULL, (char *)NULL, 0);
+ (char *)NULL, (char *)NULL, 0, 0);
free (repo);
b = strrchr (dir, '/');
@@ -1251,6 +1281,25 @@ protocol error: compressed files not supported for that operation");
error (1, errno, "cannot close %s", fullname);
}
+/* OK, we want to swallow the "U foo.c" response and then output it only
+ if we can update the file. In the future we probably want some more
+ systematic approach to parsing tagged text, but for now we keep it
+ ad hoc. "Why," I hear you cry, "do we not just look at the
+ Update-existing and Created responses?" That is an excellent question,
+ and the answer is roughly conservatism/laziness--I haven't read through
+ update.c enough to figure out the exact correspondence or lack thereof
+ between those responses and a "U foo.c" line (note that Merged, from
+ join_file, can be either "C foo" or "U foo" depending on the context). */
+/* Nonzero if we have seen +updated and not -updated. */
+static int updated_seen;
+/* Filename from an "fname" tagged response within +updated/-updated. */
+static char *updated_fname;
+
+
+/* Nonzero if we should arrange to return with a failure exit status. */
+static int failure_exit;
+
+
/*
* The time stamp of the last file we registered.
*/
@@ -1398,61 +1447,55 @@ update_entries (data_arg, ent_list, short_pathname, filename)
char *vn;
/* Timestamp field. Always empty according to the protocol. */
char *ts;
- char *options;
+ char *options = NULL;
char *tag = NULL;
char *date = NULL;
char *tag_or_date;
char *scratch_entries = NULL;
int bin;
+#ifdef UTIME_EXPECTS_WRITABLE
+ int change_it_back = 0;
+#endif
+
read_line (&entries_line);
/*
* Parse the entries line.
*/
- if (strcmp (command_name, "export") != 0)
- {
- scratch_entries = xstrdup (entries_line);
-
- if (scratch_entries[0] != '/')
- error (1, 0, "bad entries line `%s' from server", entries_line);
- user = scratch_entries + 1;
- if ((cp = strchr (user, '/')) == NULL)
- error (1, 0, "bad entries line `%s' from server", entries_line);
- *cp++ = '\0';
- vn = cp;
- if ((cp = strchr (vn, '/')) == NULL)
- error (1, 0, "bad entries line `%s' from server", entries_line);
- *cp++ = '\0';
-
- ts = cp;
- if ((cp = strchr (ts, '/')) == NULL)
- error (1, 0, "bad entries line `%s' from server", entries_line);
- *cp++ = '\0';
- options = cp;
- if ((cp = strchr (options, '/')) == NULL)
- error (1, 0, "bad entries line `%s' from server", entries_line);
- *cp++ = '\0';
- tag_or_date = cp;
-
- /* If a slash ends the tag_or_date, ignore everything after it. */
- cp = strchr (tag_or_date, '/');
- if (cp != NULL)
- *cp = '\0';
- if (*tag_or_date == 'T')
- tag = tag_or_date + 1;
- else if (*tag_or_date == 'D')
- date = tag_or_date + 1;
- }
- else
- /* For cvs export, assume it is a text file. FIXME: This is
- broken behavior--we should be having the server tell us
- whether it is text or binary and dealing accordingly. I
- think maybe we can parse the entries line, get the options,
- and then ignore the entries line otherwise, but I haven't
- checked to see whether the server sends the entries line
- correctly in this case. */
- options = NULL;
+ scratch_entries = xstrdup (entries_line);
+
+ if (scratch_entries[0] != '/')
+ error (1, 0, "bad entries line `%s' from server", entries_line);
+ user = scratch_entries + 1;
+ if ((cp = strchr (user, '/')) == NULL)
+ error (1, 0, "bad entries line `%s' from server", entries_line);
+ *cp++ = '\0';
+ vn = cp;
+ if ((cp = strchr (vn, '/')) == NULL)
+ error (1, 0, "bad entries line `%s' from server", entries_line);
+ *cp++ = '\0';
+
+ ts = cp;
+ if ((cp = strchr (ts, '/')) == NULL)
+ error (1, 0, "bad entries line `%s' from server", entries_line);
+ *cp++ = '\0';
+ options = cp;
+ if ((cp = strchr (options, '/')) == NULL)
+ error (1, 0, "bad entries line `%s' from server", entries_line);
+ *cp++ = '\0';
+ tag_or_date = cp;
+
+ /* If a slash ends the tag_or_date, ignore everything after it. */
+ cp = strchr (tag_or_date, '/');
+ if (cp != NULL)
+ *cp = '\0';
+ if (*tag_or_date == 'T')
+ tag = tag_or_date + 1;
+ else if (*tag_or_date == 'D')
+ date = tag_or_date + 1;
+
+ /* Done parsing the entries line. */
if (data->contents == UPDATE_ENTRIES_UPDATE
|| data->contents == UPDATE_ENTRIES_PATCH
@@ -1528,6 +1571,13 @@ update_entries (data_arg, ent_list, short_pathname, filename)
I hope the above paragraph makes it clear that making this
clearer is not a one-line fix. */
error (0, 0, "move away %s; it is in the way", short_pathname);
+ if (updated_fname != NULL)
+ {
+ cvs_output ("C ", 0);
+ cvs_output (updated_fname, 0);
+ cvs_output ("\n", 1);
+ }
+ failure_exit = 1;
discard_file_and_return:
/* Now read and discard the file contents. */
@@ -1546,6 +1596,21 @@ update_entries (data_arg, ent_list, short_pathname, filename)
free (mode_string);
free (entries_line);
+
+ /* The Mode, Mod-time, and Checksum responses should not carry
+ over to a subsequent Created (or whatever) response, even
+ in the error case. */
+ stored_mode_valid = 0;
+ if (stored_mode != NULL)
+ free (stored_mode);
+ stored_modtime_valid = 0;
+ stored_checksum_valid = 0;
+
+ if (updated_fname != NULL)
+ {
+ free (updated_fname);
+ updated_fname = NULL;
+ }
return;
}
@@ -1590,7 +1655,6 @@ update_entries (data_arg, ent_list, short_pathname, filename)
else
{
int fd;
- pid_t gzip_pid = 0;
fd = CVS_OPEN (temp_filename,
(O_WRONLY | O_CREAT | O_TRUNC
@@ -1610,84 +1674,50 @@ update_entries (data_arg, ent_list, short_pathname, filename)
goto discard_file_and_return;
}
- if (use_gzip)
- fd = filter_through_gunzip (fd, 0, &gzip_pid);
-
if (size > 0)
{
read_from_server (buf, size);
- if (write (fd, buf, size) != size)
+ if (use_gzip)
+ gunzip_and_write (fd, short_pathname, buf, size);
+ else if (write (fd, buf, size) != size)
error (1, errno, "writing %s", short_pathname);
}
if (close (fd) < 0)
error (1, errno, "writing %s", short_pathname);
- if (gzip_pid > 0)
- {
- int gzip_status;
-
- if (waitpid (gzip_pid, &gzip_status, 0) == -1)
- error (1, errno, "waiting for gzip process %ld",
- (long) gzip_pid);
- else if (gzip_status != 0)
- error (1, 0, "gzip process exited %d", gzip_status);
- }
-
- gzip_pid = -1;
}
- /* Since gunzip writes files without converting LF to CRLF
- (a reasonable behavior), we now have a patch file in LF
- format. Leave the file as is if we're just going to feed
- it to patch; patch can handle it. However, if it's the
- final source file, convert it. */
+ /* This is after we have read the file from the net (a change
+ from previous versions, where the server would send us
+ "M U foo.c" before Update-existing or whatever), but before
+ we finish writing the file (arguably a bug). The timing
+ affects a user who wants status info about how far we have
+ gotten, and also affects whether "U foo.c" appears in addition
+ to various error messages. */
+ if (updated_fname != NULL)
+ {
+ cvs_output ("U ", 0);
+ cvs_output (updated_fname, 0);
+ cvs_output ("\n", 1);
+ free (updated_fname);
+ updated_fname = 0;
+ }
patch_failed = 0;
if (data->contents == UPDATE_ENTRIES_UPDATE)
{
-#ifdef LINES_CRLF_TERMINATED
-
- /* `bin' is non-zero iff `options' contains "-kb", meaning
- treat this file as binary. */
-
- if (use_gzip && (! bin))
- {
- convert_file (temp_filename, O_RDONLY | OPEN_BINARY,
- filename, O_WRONLY | O_CREAT | O_TRUNC);
- if ( CVS_UNLINK (temp_filename) < 0)
- error (0, errno, "warning: couldn't delete %s",
- temp_filename);
- }
- else
-#ifdef BROKEN_READWRITE_CONVERSION
- {
- /* If only stdio, not open/write/etc., do text/binary
- conversion, use convert_file which can compensate
- (FIXME: we could just use stdio instead which would
- avoid the whole problem). */
- if (!bin)
- {
- convert_file (temp_filename, O_RDONLY | OPEN_BINARY,
- filename, O_WRONLY | O_CREAT | O_TRUNC);
- if (CVS_UNLINK (temp_filename) < 0)
- error (0, errno, "warning: couldn't delete %s",
- temp_filename);
- }
- else
- rename_file (temp_filename, filename);
- }
-#else
- rename_file (temp_filename, filename);
-#endif
-
-#else /* ! LINES_CRLF_TERMINATED */
rename_file (temp_filename, filename);
-#endif /* LINES_CRLF_TERMINATED */
}
else if (data->contents == UPDATE_ENTRIES_PATCH)
{
+#ifdef DONT_USE_PATCH
+ /* Hmm. We support only Rcs-diff, and the server supports
+ only Patched (or else it would have sent Rcs-diff instead).
+ Fall back to transmitting entire files. */
+ patch_failed = 1;
+#else /* Use patch. */
int retcode;
char *backup;
struct stat s;
@@ -1705,8 +1735,26 @@ update_entries (data_arg, ent_list, short_pathname, filename)
retcode = 0;
else
{
- run_setup ("%s -f -s -b ~ %s %s", PATCH_PROGRAM,
- filename, temp_filename);
+ /* This behavior (in which -b takes an argument) is
+ supported by GNU patch 2.1. Apparently POSIX.2
+ specifies a -b option without an argument. GNU
+ patch 2.1.5 implements this and therefore won't
+ work here. GNU patch versions after 2.1.5 are said
+ to have a kludge which checks if the last 4 args
+ are `-b SUFFIX ORIGFILE PATCHFILE' and if so emit a
+ warning (I think -s suppresses it), and then behave
+ as CVS expects.
+
+ Of course this is yet one more reason why in the long
+ run we want Rcs-diff to replace Patched. */
+
+ run_setup (PATCH_PROGRAM);
+ run_arg ("-f");
+ run_arg ("-s");
+ run_arg ("-b");
+ run_arg ("~");
+ run_arg (filename);
+ run_arg (temp_filename);
retcode = run_exec (DEVNULL, RUN_TTY, RUN_TTY, RUN_NORMAL);
}
/* FIXME: should we really be silently ignoring errors? */
@@ -1739,13 +1787,12 @@ update_entries (data_arg, ent_list, short_pathname, filename)
patch_failed = 1;
}
free (backup);
+#endif /* Use patch. */
}
else
{
- struct stat s;
- char *filebuf, *tobuf;
+ char *filebuf;
size_t filebufsize;
- FILE *e;
size_t nread;
char *patchedbuf;
size_t patchedlen;
@@ -1755,50 +1802,12 @@ update_entries (data_arg, ent_list, short_pathname, filename)
if (!isfile (filename))
error (1, 0, "patch original file %s does not exist",
short_pathname);
- if (CVS_STAT (filename, &s) < 0)
- error (1, errno, "can't stat %s", short_pathname);
-
- filebufsize = s.st_size;
- filebuf = xmalloc (filebufsize);
-
- e = open_file (filename, bin ? FOPEN_BINARY_READ : "r");
-
- tobuf = filebuf;
+ filebuf = NULL;
+ filebufsize = 0;
nread = 0;
- while (1)
- {
- size_t got;
-
- got = fread (tobuf, 1, filebufsize - (tobuf - filebuf), e);
- if (ferror (e))
- error (1, errno, "can't read %s", short_pathname);
- nread += got;
- tobuf += got;
-
- if (feof (e))
- break;
-
- /* It's probably paranoid to think S.ST_SIZE might be
- too small to hold the entire file contents, but we
- handle it just in case. */
- if (tobuf == filebuf + filebufsize)
- {
- int c;
- long off;
-
- c = getc (e);
- if (c == EOF)
- break;
- off = tobuf - filebuf;
- expand_string (&filebuf, &filebufsize, filebufsize + 100);
- tobuf = filebuf + off;
- *tobuf++ = c;
- ++nread;
- }
- }
-
- fclose (e);
+ get_file (filename, short_pathname, bin ? FOPEN_BINARY_READ : "r",
+ &filebuf, &filebufsize, &nread);
/* At this point the contents of the existing file are in
FILEBUF, and the length of the contents is in NREAD.
The contents of the patch from the network are in BUF,
@@ -1834,6 +1843,8 @@ update_entries (data_arg, ent_list, short_pathname, filename)
if (! patch_failed)
{
+ FILE *e;
+
e = open_file (temp_filename,
bin ? FOPEN_BINARY_WRITE : "w");
if (fwrite (patchedbuf, 1, patchedlen, e) != patchedlen)
@@ -1938,8 +1949,26 @@ update_entries (data_arg, ent_list, short_pathname, filename)
/* There is probably little point in trying to preserved the
actime (or is there? What about Checked-in?). */
t.modtime = t.actime = stored_modtime;
+
+#ifdef UTIME_EXPECTS_WRITABLE
+ if (!iswritable (filename))
+ {
+ xchmod (filename, 1);
+ change_it_back = 1;
+ }
+#endif /* UTIME_EXPECTS_WRITABLE */
+
if (utime (filename, &t) < 0)
error (0, errno, "cannot set time on %s", filename);
+
+#ifdef UTIME_EXPECTS_WRITABLE
+ if (change_it_back == 1)
+ {
+ xchmod (filename, 0);
+ change_it_back = 0;
+ }
+#endif /* UTIME_EXPECTS_WRITABLE */
+
stored_modtime_valid = 0;
}
@@ -2674,9 +2703,8 @@ send_repository (dir, repos, update_dir)
}
/* Send a Repository line and set toplevel_repos. */
-static void send_a_repository PROTO((char *, char *, char *));
-static void
+void
send_a_repository (dir, repository, update_dir)
char *dir;
char *repository;
@@ -2722,6 +2750,14 @@ send_a_repository (dir, repository, update_dir)
int slashes_skipped;
char *p;
+ /*
+ * Strip trailing slashes from the name of the update directory.
+ * Otherwise, running `cvs update dir/' provokes the failure
+ * `protocol error: illegal directory syntax in dir/' when
+ * running in client/server mode.
+ */
+ strip_trailing_slashes (update_dir);
+
slashes_in_update_dir = 0;
for (p = update_dir; *p != '\0'; ++p)
if (*p == '/')
@@ -2857,12 +2893,52 @@ handle_m (args, len)
/* In the case where stdout and stderr point to the same place,
fflushing stderr will make output happen in the correct order.
Often stderr will be line-buffered and this won't be needed,
- but not always. */
+ but not always (is that true? I think the comment is probably
+ based on being confused between default buffering between
+ stdout and stderr. But I'm not sure). */
fflush (stderr);
fwrite (args, len, sizeof (*args), stdout);
putc ('\n', stdout);
}
+static void handle_mbinary PROTO ((char *, int));
+
+static void
+handle_mbinary (args, len)
+ char *args;
+ int len;
+{
+ char *size_string;
+ size_t size;
+ size_t totalread;
+ size_t nread;
+ size_t toread;
+ char buf[8192];
+
+ /* See comment at handle_m about (non)flush of stderr. */
+
+ /* Get the size. */
+ read_line (&size_string);
+ size = atoi (size_string);
+ free (size_string);
+
+ /* OK, now get all the data. The algorithm here is that we read
+ as much as the network wants to give us in
+ try_read_from_server, and then we output it all, and then
+ repeat, until we get all the data. */
+ totalread = 0;
+ while (totalread < size)
+ {
+ toread = size - totalread;
+ if (toread > sizeof buf)
+ toread = sizeof buf;
+
+ nread = try_read_from_server (buf, toread);
+ cvs_output_binary (buf, nread);
+ totalread += nread;
+ }
+}
+
static void
handle_e (args, len)
char *args;
@@ -2884,6 +2960,67 @@ handle_f (args, len)
fflush (stderr);
}
+static void handle_mt PROTO ((char *, int));
+
+static void
+handle_mt (args, len)
+ char *args;
+ int len;
+{
+ char *p;
+ char *tag = args;
+ char *text;
+
+ /* See comment at handle_m for more details. */
+ fflush (stderr);
+
+ p = strchr (args, ' ');
+ if (p == NULL)
+ text = NULL;
+ else
+ {
+ *p++ = '\0';
+ text = p;
+ }
+
+ switch (tag[0])
+ {
+ case '+':
+ if (strcmp (tag, "+updated") == 0)
+ updated_seen = 1;
+ break;
+ case '-':
+ if (strcmp (tag, "-updated") == 0)
+ updated_seen = 0;
+ break;
+ default:
+ if (updated_seen)
+ {
+ if (strcmp (tag, "fname") == 0)
+ {
+ if (updated_fname != NULL)
+ {
+ /* Output the previous message now. This can happen
+ if there was no Update-existing or other such
+ response, due to the -n global option. */
+ cvs_output ("U ", 0);
+ cvs_output (updated_fname, 0);
+ cvs_output ("\n", 1);
+ free (updated_fname);
+ }
+ updated_fname = xstrdup (text);
+ }
+ /* Swallow all other tags. Either they are extraneous
+ or they reflect future extensions that we can
+ safely ignore. */
+ }
+ else if (strcmp (tag, "newline") == 0)
+ printf ("\n");
+ else if (text != NULL)
+ printf ("%s", text);
+ }
+}
+
#endif /* CLIENT_SUPPORT */
#if defined(CLIENT_SUPPORT) || defined(SERVER_SUPPORT)
@@ -2937,8 +3074,10 @@ struct response responses[] =
RSP_LINE("Module-expansion", handle_module_expansion, response_type_normal,
rs_optional),
RSP_LINE("M", handle_m, response_type_normal, rs_essential),
+ RSP_LINE("Mbinary", handle_mbinary, response_type_normal, rs_optional),
RSP_LINE("E", handle_e, response_type_normal, rs_essential),
RSP_LINE("F", handle_f, response_type_normal, rs_optional),
+ RSP_LINE("MT", handle_mt, response_type_normal, rs_optional),
/* Possibly should be response_type_error. */
RSP_LINE(NULL, NULL, response_type_normal, rs_essential)
@@ -3059,12 +3198,39 @@ get_server_responses ()
}
if (rs->name == NULL)
/* It's OK to print just to the first '\0'. */
+ /* We might want to handle control characters and the like
+ in some other way other than just sending them to stdout.
+ One common reason for this error is if people use :ext:
+ with a version of rsh which is doing CRLF translation or
+ something, and so the client gets "ok^M" instead of "ok".
+ Right now that will tend to print part of this error
+ message over the other part of it. It seems like we could
+ do better (either in general, by quoting or omitting all
+ control characters, and/or specifically, by detecting the CRLF
+ case and printing a specific error message). */
error (0, 0,
"warning: unrecognized response `%s' from cvs server",
cmd);
free (cmd);
} while (rs->type == response_type_normal);
- return rs->type == response_type_error ? 1 : 0;
+
+ if (updated_fname != NULL)
+ {
+ /* Output the previous message now. This can happen
+ if there was no Update-existing or other such
+ response, due to the -n global option. */
+ cvs_output ("U ", 0);
+ cvs_output (updated_fname, 0);
+ cvs_output ("\n", 1);
+ free (updated_fname);
+ updated_fname = NULL;
+ }
+
+ if (rs->type == response_type_error)
+ return 1;
+ if (failure_exit)
+ return 1;
+ return 0;
}
/* Get the responses and then close the connection. */
@@ -3184,7 +3350,9 @@ get_responses_and_close ()
return errs;
}
+#ifndef NO_EXT_METHOD
static void start_rsh_server PROTO((int *, int *));
+#endif
int
supported_request (name)
@@ -3201,18 +3369,18 @@ supported_request (name)
}
-#ifdef AUTH_CLIENT_SUPPORT
-static void init_sockaddr PROTO ((struct sockaddr_in *, char *,
- unsigned int));
+#if defined (AUTH_CLIENT_SUPPORT) || defined (HAVE_KERBEROS)
+static struct hostent *init_sockaddr PROTO ((struct sockaddr_in *, char *,
+ unsigned int));
-static void
+static struct hostent *
init_sockaddr (name, hostname, port)
struct sockaddr_in *name;
char *hostname;
unsigned int port;
{
struct hostent *hostinfo;
- unsigned short shortport = port;
+ unsigned short shortport = port;
memset (name, 0, sizeof (*name));
name->sin_family = AF_INET;
@@ -3224,8 +3392,12 @@ init_sockaddr (name, hostname, port)
error_exit ();
}
name->sin_addr = *(struct in_addr *) hostinfo->h_addr;
+ return hostinfo;
}
+#endif /* defined (AUTH_CLIENT_SUPPORT) || defined (HAVE_KERBEROS) */
+
+#ifdef AUTH_CLIENT_SUPPORT
static int auth_server_port_number PROTO ((void));
@@ -3241,21 +3413,83 @@ auth_server_port_number ()
}
-/*
- * Connect to the authenticating server.
- *
- * If VERIFY_ONLY is non-zero, then just verify that the password is
- * correct and then shutdown the connection. In this case, the return
- * values is 1 if the password was correct, 0 if not.
- *
- * If VERIFY_ONLY is 0, then really connect to the server. In this
- * case the return value is 1 on succees, but is probably ignored. If
- * fail to connect, then die with error.
- */
-int
-connect_to_pserver (tofdp, fromfdp, verify_only)
+/* Read a line from socket SOCK. Result does not include the
+ terminating linefeed. This is only used by the authentication
+ protocol, which we call before we set up all the buffering stuff.
+ It is possible it should use the buffers too, which would be faster
+ (unlike the server, there isn't really a security issue in terms of
+ separating authentication from the rest of the code).
+
+ Space for the result is malloc'd and should be freed by the caller.
+
+ Returns number of bytes read. */
+static int
+recv_line (sock, resultp)
+ int sock;
+ char **resultp;
+{
+ int c;
+ char *result;
+ size_t input_index = 0;
+ size_t result_size = 80;
+
+ result = (char *) xmalloc (result_size);
+
+ while (1)
+ {
+ char ch;
+ if (recv (sock, &ch, 1, 0) < 0)
+ error (1, 0, "recv() from server %s: %s", CVSroot_hostname,
+ SOCK_STRERROR (SOCK_ERRNO));
+ c = ch;
+
+ if (c == EOF)
+ {
+ free (result);
+
+ /* It's end of file. */
+ error (1, 0, "end of file from server");
+ }
+
+ if (c == '\012')
+ break;
+
+ result[input_index++] = c;
+ while (input_index + 1 >= result_size)
+ {
+ result_size *= 2;
+ result = (char *) xrealloc (result, result_size);
+ }
+ }
+
+ if (resultp)
+ *resultp = result;
+
+ /* Terminate it just for kicks, but we *can* deal with embedded NULs. */
+ result[input_index] = '\0';
+
+ if (resultp == NULL)
+ free (result);
+ return input_index;
+}
+
+/* Connect to the authenticating server.
+
+ If VERIFY_ONLY is non-zero, then just verify that the password is
+ correct and then shutdown the connection.
+
+ If VERIFY_ONLY is 0, then really connect to the server.
+
+ If DO_GSSAPI is non-zero, then we use GSSAPI authentication rather
+ than the pserver password authentication.
+
+ If we fail to connect or if access is denied, then die with fatal
+ error. */
+void
+connect_to_pserver (tofdp, fromfdp, verify_only, do_gssapi)
int *tofdp, *fromfdp;
int verify_only;
+ int do_gssapi;
{
int sock;
#ifndef NO_SOCKET_TO_FD
@@ -3263,32 +3497,32 @@ connect_to_pserver (tofdp, fromfdp, verify_only)
#endif
int port_number;
struct sockaddr_in client_sai;
+ struct hostent *hostinfo;
sock = socket (AF_INET, SOCK_STREAM, 0);
if (sock == -1)
{
- fprintf (stderr, "socket() failed\n");
- error_exit ();
+ error (1, 0, "cannot create socket: %s", SOCK_STRERROR (SOCK_ERRNO));
}
port_number = auth_server_port_number ();
- init_sockaddr (&client_sai, CVSroot_hostname, port_number);
+ hostinfo = init_sockaddr (&client_sai, CVSroot_hostname, port_number);
if (connect (sock, (struct sockaddr *) &client_sai, sizeof (client_sai))
< 0)
error (1, 0, "connect to %s:%d failed: %s", CVSroot_hostname,
port_number, SOCK_STRERROR (SOCK_ERRNO));
/* Run the authorization mini-protocol before anything else. */
+ if (do_gssapi)
+ {
+#ifdef HAVE_GSSAPI
+ if (! connect_to_gserver (sock, hostinfo))
+ goto rejected;
+#else
+ error (1, 0, "This client does not support GSSAPI authentication");
+#endif
+ }
+ else
{
- int i;
- char ch;
-
- /* Long enough to hold I LOVE YOU or I HATE YOU. Using a fixed-size
- buffer seems better than letting an apeshit server chew up our
- memory with illegal responses, and the value comes from
- the protocol itself; it is not an arbitrary limit on data sent. */
-#define LARGEST_RESPONSE 80
- char read_buf[LARGEST_RESPONSE];
-
char *begin = NULL;
char *repository = CVSroot_directory;
char *username = CVSroot_username;
@@ -3297,91 +3531,103 @@ connect_to_pserver (tofdp, fromfdp, verify_only)
if (verify_only)
{
- begin = "BEGIN VERIFICATION REQUEST\n";
- end = "END VERIFICATION REQUEST\n";
+ begin = "BEGIN VERIFICATION REQUEST\012";
+ end = "END VERIFICATION REQUEST\012";
}
else
{
- begin = "BEGIN AUTH REQUEST\n";
- end = "END AUTH REQUEST\n";
+ begin = "BEGIN AUTH REQUEST\012";
+ end = "END AUTH REQUEST\012";
}
/* Get the password, probably from ~/.cvspass. */
password = get_cvs_password ();
/* Announce that we're starting the authorization protocol. */
- send (sock, begin, strlen (begin), 0);
+ if (send (sock, begin, strlen (begin), 0) < 0)
+ error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
/* Send the data the server needs. */
- send (sock, repository, strlen (repository), 0);
- send (sock, "\n", 1, 0);
- send (sock, username, strlen (username), 0);
- send (sock, "\n", 1, 0);
- send (sock, password, strlen (password), 0);
- send (sock, "\n", 1, 0);
+ if (send (sock, repository, strlen (repository), 0) < 0)
+ error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
+ if (send (sock, "\012", 1, 0) < 0)
+ error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
+ if (send (sock, username, strlen (username), 0) < 0)
+ error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
+ if (send (sock, "\012", 1, 0) < 0)
+ error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
+ if (send (sock, password, strlen (password), 0) < 0)
+ error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
+ if (send (sock, "\012", 1, 0) < 0)
+ error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
/* Announce that we're ending the authorization protocol. */
- send (sock, end, strlen (end), 0);
+ if (send (sock, end, strlen (end), 0) < 0)
+ error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
/* Paranoia. */
memset (password, 0, strlen (password));
+ }
- /* Get ACK or NACK from the server.
- *
- * We could avoid this careful read-char loop by having the ACK
- * and NACK cookies be of the same length, so we'd simply read
- * that length and see what we got. But then there'd be Yet
- * Another Protocol Requirement floating around, and someday
- * someone would make a change that breaks it and spend a hellish
- * day tracking it down. Therefore, we use "\n" to mark off the
- * end of both ACK and NACK, and we loop, reading until "\n".
- */
- ch = 0;
- memset (read_buf, 0, LARGEST_RESPONSE);
- for (i = 0; (i < (LARGEST_RESPONSE - 1)) && (ch != '\n'); i++)
- {
- if (recv (sock, &ch, 1, 0) < 0)
- error (1, 0, "recv() from server %s: %s", CVSroot_hostname,
- SOCK_STRERROR (SOCK_ERRNO));
-
- read_buf[i] = ch;
- }
+ {
+ char *read_buf;
- if (strcmp (read_buf, "I HATE YOU\n") == 0)
+ /* Loop, getting responses from the server. */
+ while (1)
{
- /* Authorization not granted. */
- if (shutdown (sock, 2) < 0)
+ recv_line (sock, &read_buf);
+
+ if (strcmp (read_buf, "I HATE YOU") == 0)
{
- error (0, 0,
- "authorization failed: server %s rejected access",
- CVSroot_hostname);
- error (1, 0,
- "shutdown() failed (server %s): %s", CVSroot_hostname,
- SOCK_STRERROR (SOCK_ERRNO));
+ /* Authorization not granted. */
+ goto rejected;
}
+ else if (strncmp (read_buf, "E ", 2) == 0)
+ {
+ fprintf (stderr, "%s\n", read_buf + 2);
- if (verify_only)
- return 0;
+ /* Continue with the authentication protocol. */
+ }
+ else if (strncmp (read_buf, "error ", 6) == 0)
+ {
+ char *p;
+
+ /* First skip the code. */
+ p = read_buf + 6;
+ while (*p != ' ' && *p != '\0')
+ ++p;
+
+ /* Skip the space that follows the code. */
+ if (*p == ' ')
+ ++p;
+
+ /* Now output the text. */
+ fprintf (stderr, "%s\n", p);
+ goto rejected;
+ }
+ else if (strcmp (read_buf, "I LOVE YOU") == 0)
+ {
+ free (read_buf);
+ break;
+ }
else
- error (1, 0,
- "authorization failed: server %s rejected access",
- CVSroot_hostname);
- }
- else if (strcmp (read_buf, "I LOVE YOU\n") != 0)
- {
- /* Unrecognized response from server. */
- if (shutdown (sock, 2) < 0)
{
- error (0, 0,
+ /* Unrecognized response from server. */
+ if (shutdown (sock, 2) < 0)
+ {
+ error (0, 0,
+ "unrecognized auth response from %s: %s",
+ CVSroot_hostname, read_buf);
+ error (1, 0,
+ "shutdown() failed, server %s: %s",
+ CVSroot_hostname,
+ SOCK_STRERROR (SOCK_ERRNO));
+ }
+ error (1, 0,
"unrecognized auth response from %s: %s",
CVSroot_hostname, read_buf);
- error (1, 0,
- "shutdown() failed, server %s: %s", CVSroot_hostname,
- SOCK_STRERROR (SOCK_ERRNO));
}
- error (1, 0,
- "unrecognized auth response from %s: %s",
- CVSroot_hostname, read_buf);
+ free (read_buf);
}
}
@@ -3390,7 +3636,7 @@ connect_to_pserver (tofdp, fromfdp, verify_only)
if (shutdown (sock, 2) < 0)
error (0, 0, "shutdown() failed, server %s: %s", CVSroot_hostname,
SOCK_STRERROR (SOCK_ERRNO));
- return 1;
+ return;
}
else
{
@@ -3410,57 +3656,48 @@ connect_to_pserver (tofdp, fromfdp, verify_only)
#endif /* NO_SOCKET_TO_FD */
}
- return 1;
+ return;
+
+ rejected:
+ if (shutdown (sock, 2) < 0)
+ {
+ error (0, 0,
+ "authorization failed: server %s rejected access",
+ CVSroot_hostname);
+ error (1, 0,
+ "shutdown() failed (server %s): %s",
+ CVSroot_hostname,
+ SOCK_STRERROR (SOCK_ERRNO));
+ }
+
+ error (1, 0,
+ "authorization failed: server %s rejected access",
+ CVSroot_hostname);
}
#endif /* AUTH_CLIENT_SUPPORT */
#if HAVE_KERBEROS
-/*
- * FIXME: this function has not been changed to deal with
- * NO_SOCKET_TO_FD (i.e., systems on which sockets cannot be converted
- * to file descriptors) or with SOCK_ERRNO/SOCK_STRERROR. The first
- * person to try building a kerberos client on such a system (OS/2,
- * Windows 95, and maybe others) will have to make take care of this.
- */
+/* This function has not been changed to deal with NO_SOCKET_TO_FD
+ (i.e., systems on which sockets cannot be converted to file
+ descriptors). The first person to try building a kerberos client
+ on such a system (OS/2, Windows 95, and maybe others) will have to
+ make take care of this. */
void
start_tcp_server (tofdp, fromfdp)
int *tofdp, *fromfdp;
{
- int tofd = -1, fromfd;
-
- struct hostent *hp;
- char *hname;
+ int s;
const char *portenv;
int port;
+ struct hostent *hp;
struct sockaddr_in sin;
- int s;
-
-#if HAVE_KERBEROS
- KTEXT_ST ticket;
- const char *realm;
-#endif /* HAVE_KERBEROS */
-
- int status;
+ char *hname;
- /*
- * We look up the host to give a better error message if it
- * does not exist. However, we then pass CVSroot_hostname to
- * krb_sendauth, rather than the canonical name, because
- * krb_sendauth is going to do its own canonicalization anyhow
- * and that lets us not worry about the static storage used by
- * gethostbyname.
- */
- hp = gethostbyname (CVSroot_hostname);
- if (hp == NULL)
- error (1, 0, "%s: unknown host", CVSroot_hostname);
- hname = xmalloc (strlen (hp->h_name) + 1);
- strcpy (hname, hp->h_name);
-
-#if HAVE_KERBEROS
- realm = krb_realmofhost (hname);
-#endif /* HAVE_KERBEROS */
+ s = socket (AF_INET, SOCK_STREAM, 0);
+ if (s < 0)
+ error (1, 0, "cannot create socket: %s", SOCK_STRERROR (SOCK_ERRNO));
/* Get CVS_CLIENT_PORT or look up cvs/tcp with CVS_PORT as default */
portenv = getenv ("CVS_CLIENT_PORT");
@@ -3476,7 +3713,6 @@ start_tcp_server (tofdp, fromfdp)
}
if (trace)
fprintf(stderr, "Using TCP port %d to contact server.\n", port);
- port = htons (port);
}
else
{
@@ -3484,85 +3720,160 @@ start_tcp_server (tofdp, fromfdp)
sp = getservbyname ("cvs", "tcp");
if (sp == NULL)
- port = htons (CVS_PORT);
+ port = CVS_PORT;
else
- port = sp->s_port;
+ port = ntohs (sp->s_port);
}
- s = socket (AF_INET, SOCK_STREAM, 0);
- if (s < 0)
- error (1, errno, "socket");
-
- memset (&sin, 0, sizeof sin);
- sin.sin_family = AF_INET;
- sin.sin_addr.s_addr = INADDR_ANY;
- sin.sin_port = 0;
-
- if (bind (s, (struct sockaddr *) &sin, sizeof sin) < 0)
- error (1, errno, "bind");
-
- memcpy (&sin.sin_addr, hp->h_addr, hp->h_length);
- sin.sin_port = port;
+ hp = init_sockaddr (&sin, CVSroot_hostname, port);
+ hname = xmalloc (strlen (hp->h_name) + 1);
+ strcpy (hname, hp->h_name);
+
if (connect (s, (struct sockaddr *) &sin, sizeof sin) < 0)
- {
- error (0, errno, "connect");
- close (s);
- }
- else
- {
+ error (1, 0, "connect to %s:%d failed: %s", CVSroot_hostname,
+ port, SOCK_STRERROR (SOCK_ERRNO));
+
#ifdef HAVE_KERBEROS
+ {
+ const char *realm;
struct sockaddr_in laddr;
int laddrlen;
+ KTEXT_ST ticket;
MSG_DAT msg_data;
CREDENTIALS cred;
+ int status;
+
+ realm = krb_realmofhost (hname);
laddrlen = sizeof (laddr);
if (getsockname (s, (struct sockaddr *) &laddr, &laddrlen) < 0)
- error (1, errno, "getsockname");
+ error (1, 0, "getsockname failed: %s", SOCK_STRERROR (SOCK_ERRNO));
/* We don't care about the checksum, and pass it as zero. */
status = krb_sendauth (KOPT_DO_MUTUAL, s, &ticket, "rcmd",
hname, realm, (unsigned long) 0, &msg_data,
&cred, sched, &laddr, &sin, "KCVSV1.0");
if (status != KSUCCESS)
- {
- error (0, 0, "kerberos: %s", krb_get_err_text(status));
- close (s);
- }
- else
- {
- memcpy (kblock, cred.session, sizeof (C_Block));
-
+ error (1, 0, "kerberos authentication failed: %s",
+ krb_get_err_text (status));
+ memcpy (kblock, cred.session, sizeof (C_Block));
+ }
#endif /* HAVE_KERBEROS */
- server_fd = s;
- close_on_exec (server_fd);
- tofd = fromfd = s;
+ server_fd = s;
+ close_on_exec (server_fd);
+
+ free (hname);
+
+ /* Give caller the values it wants. */
+ *tofdp = s;
+ *fromfdp = s;
+}
-#ifdef HAVE_KERBEROS
- }
#endif /* HAVE_KERBEROS */
- }
-
- if (tofd == -1)
+
+#ifdef HAVE_GSSAPI
+
+/* Receive a given number of bytes. */
+
+static void
+recv_bytes (sock, buf, need)
+ int sock;
+ char *buf;
+ int need;
+{
+ while (need > 0)
{
-#ifdef HAVE_KERBEROS
- error (0, 0, "Kerberos connect failed");
-#else
- error (0, 0, "Direct TCP connect failed");
-#endif
- error (1, 0, "couldn't connect to remote host %s", CVSroot_hostname);
+ int got;
+
+ got = recv (sock, buf, need, 0);
+ if (got < 0)
+ error (1, 0, "recv() from server %s: %s", CVSroot_hostname,
+ SOCK_STRERROR (SOCK_ERRNO));
+ buf += got;
+ need -= got;
}
+}
- free (hname);
+/* Connect to the server using GSSAPI authentication. */
- /* Give caller the values it wants. */
- *tofdp = tofd;
- *fromfdp = fromfd;
+static int
+connect_to_gserver (sock, hostinfo)
+ int sock;
+ struct hostent *hostinfo;
+{
+ char *str;
+ char buf[1024];
+ gss_buffer_desc *tok_in_ptr, tok_in, tok_out;
+ OM_uint32 stat_min, stat_maj;
+ gss_name_t server_name;
+
+ str = "BEGIN GSSAPI REQUEST\012";
+
+ if (send (sock, str, strlen (str), 0) < 0)
+ error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
+
+ sprintf (buf, "cvs@%s", hostinfo->h_name);
+ tok_in.length = strlen (buf);
+ tok_in.value = buf;
+ gss_import_name (&stat_min, &tok_in, gss_nt_service_name, &server_name);
+
+ tok_in_ptr = GSS_C_NO_BUFFER;
+ gcontext = GSS_C_NO_CONTEXT;
+
+ do
+ {
+ stat_maj = gss_init_sec_context (&stat_min, GSS_C_NO_CREDENTIAL,
+ &gcontext, server_name,
+ GSS_C_NULL_OID,
+ (GSS_C_MUTUAL_FLAG
+ | GSS_C_REPLAY_FLAG),
+ 0, NULL, tok_in_ptr, NULL, &tok_out,
+ NULL, NULL);
+ if (stat_maj != GSS_S_COMPLETE && stat_maj != GSS_S_CONTINUE_NEEDED)
+ {
+ OM_uint32 message_context;
+
+ message_context = 0;
+ gss_display_status (&stat_min, stat_maj, GSS_C_GSS_CODE,
+ GSS_C_NULL_OID, &message_context, &tok_out);
+ error (1, 0, "GSSAPI authentication failed: %s",
+ (char *) tok_out.value);
+ }
+
+ if (tok_out.length == 0)
+ {
+ tok_in.length = 0;
+ }
+ else
+ {
+ char cbuf[2];
+ int need;
+
+ cbuf[0] = (tok_out.length >> 8) & 0xff;
+ cbuf[1] = tok_out.length & 0xff;
+ if (send (sock, cbuf, 2, 0) < 0)
+ error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
+ if (send (sock, tok_out.value, tok_out.length, 0) < 0)
+ error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO));
+
+ recv_bytes (sock, cbuf, 2);
+ need = ((cbuf[0] & 0xff) << 8) | (cbuf[1] & 0xff);
+ assert (need <= sizeof buf);
+ recv_bytes (sock, buf, need);
+ tok_in.length = need;
+ }
+
+ tok_in.value = buf;
+ tok_in_ptr = &tok_in;
+ }
+ while (stat_maj == GSS_S_CONTINUE_NEEDED);
+
+ return 1;
}
-#endif /* HAVE_KERBEROS */
+#endif /* HAVE_GSSAPI */
static int send_variable_proc PROTO ((Node *, void *));
@@ -3598,7 +3909,7 @@ start_server ()
case pserver_method:
/* Toss the return value. It will die with error if anything
goes wrong anyway. */
- connect_to_pserver (&tofd, &fromfd, 0);
+ connect_to_pserver (&tofd, &fromfd, 0, 0);
break;
#endif
@@ -3608,6 +3919,13 @@ start_server ()
break;
#endif
+#if HAVE_GSSAPI
+ case gserver_method:
+ /* GSSAPI authentication is handled by the pserver. */
+ connect_to_pserver (&tofd, &fromfd, 0, 1);
+ break;
+#endif
+
case ext_method:
#if defined (NO_EXT_METHOD)
error (0, 0, ":ext: method not supported by this port of CVS");
@@ -3702,6 +4020,9 @@ the :server: access method is not supported by this port of CVS");
exactly what was transmitted and received (that is
more important than that they be maximally
convenient to view). */
+ /* Note that if we create several connections in a single CVS client
+ (currently used by update.c), then the last set of logfiles will
+ overwrite the others. There is currently no way around this. */
strcpy (p, ".in");
fp = open_file (buf, "wb");
if (fp == NULL)
@@ -3839,6 +4160,7 @@ the :server: access method is not supported by this port of CVS");
"This server does not support the global -l option.");
}
}
+
if (cvsencrypt)
{
#ifdef ENCRYPTION
@@ -3862,11 +4184,28 @@ the :server: access method is not supported by this port of CVS");
}
else
#endif /* HAVE_KERBEROS */
- error (1, 0, "Encryption is only supported when using Kerberos");
+#ifdef HAVE_GSSAPI
+ if (CVSroot_method == gserver_method)
+ {
+ if (! supported_request ("Gssapi-encrypt"))
+ error (1, 0, "This server does not support encryption");
+ send_to_server ("Gssapi-encrypt\012", 0);
+ to_server = cvs_gssapi_wrap_buffer_initialize (to_server, 0,
+ gcontext,
+ buf_memory_error);
+ from_server = cvs_gssapi_wrap_buffer_initialize (from_server, 1,
+ gcontext,
+ buf_memory_error);
+ cvs_gssapi_encrypt = 1;
+ }
+ else
+#endif /* HAVE_GSSAPI */
+ error (1, 0, "Encryption is only supported when using GSSAPI or Kerberos");
#else /* ! ENCRYPTION */
error (1, 0, "This client does not support encryption");
#endif /* ! ENCRYPTION */
}
+
if (gzip_level)
{
if (supported_request ("Gzip-stream"))
@@ -3909,6 +4248,34 @@ the :server: access method is not supported by this port of CVS");
}
}
+ if (cvsauthenticate && ! cvsencrypt)
+ {
+ /* Turn on authentication after turning on compression, so
+ that we can compress the authentication information. We
+ assume that encrypted data is always authenticated--the
+ ability to decrypt the data stream is itself a form of
+ authentication. */
+#ifdef HAVE_GSSAPI
+ if (CVSroot_method == gserver_method)
+ {
+ if (! supported_request ("Gssapi-authenticate"))
+ error (1, 0,
+ "This server does not support stream authentication");
+ send_to_server ("Gssapi-authenticate\012", 0);
+ to_server = cvs_gssapi_wrap_buffer_initialize (to_server, 0,
+ gcontext,
+ buf_memory_error);
+ from_server = cvs_gssapi_wrap_buffer_initialize (from_server, 1,
+ gcontext,
+ buf_memory_error);
+ }
+ else
+ error (1, 0, "Stream authentication is only supported when using GSSAPI");
+#else /* ! HAVE_GSSAPI */
+ error (1, 0, "This client does not support stream authentication");
+#endif /* ! HAVE_GSSAPI */
+ }
+
#ifdef FILENAMES_CASE_INSENSITIVE
if (supported_request ("Case"))
send_to_server ("Case\012", 0);
@@ -4138,7 +4505,7 @@ send_modified (file, short_pathname, vers)
int fd;
char *buf;
char *mode_string;
- int bufsize;
+ size_t bufsize;
int bin;
if (trace)
@@ -4191,106 +4558,15 @@ send_modified (file, short_pathname, vers)
if (file_gzip_level && sb.st_size > 100)
{
- int nread, newsize = 0, gzip_status;
- pid_t gzip_pid;
- char *bufp = buf;
- int readsize = 8192;
-#ifdef LINES_CRLF_TERMINATED
- char *tempfile;
- int converting;
-#endif /* LINES_CRLF_TERMINATED */
-
-#ifdef LINES_CRLF_TERMINATED
- if (vers == NULL)
- /* "Can't happen". */
- converting = 1;
- else
- /* Otherwise, we convert things unless they're binary. */
- converting = (! bin);
-
- if (converting)
- {
- /* gzip reads and writes files without munging CRLF
- sequences, as it should, but files should be
- transmitted in LF form. Convert CRLF to LF before
- gzipping, on systems where this is necessary.
-
- If Windows NT supported fork, we could do this by
- pushing another filter on in front of gzip. But it
- doesn't. I'd have to write a trivial little program to
- do the conversion and have CVS spawn it off. But
- little executables like that always get lost.
-
- Alternatively, this cruft could go away if we switched
- to a gzip library instead of a subprocess; then we
- could tell gzip to open the file with CRLF translation
- enabled. */
- if (close (fd) < 0)
- error (0, errno, "warning: can't close %s", short_pathname);
-
- tempfile = cvs_temp_name ();
- convert_file (file, O_RDONLY,
- tempfile,
- O_WRONLY | O_CREAT | O_TRUNC | OPEN_BINARY);
-
- /* This OPEN_BINARY doesn't make any difference, I think, because
- gzip will deal with the inherited handle as it pleases. But I
- do remember something obscure in the manuals about propagating
- the translation mode to created processes via environment
- variables, ick. */
- fd = CVS_OPEN (tempfile, O_RDONLY | OPEN_BINARY);
- if (fd < 0)
- error (1, errno, "reading %s", short_pathname);
- }
-#endif /* LINES_CRLF_TERMINATED */
+ size_t newsize = 0;
- fd = filter_through_gzip (fd, 1, file_gzip_level, &gzip_pid);
+ read_and_gzip (fd, short_pathname, (unsigned char **)&buf,
+ &bufsize, &newsize,
+ file_gzip_level);
- /* FIXME: is there any reason to go through all this realloc'ing
- when we could just be writing the data to the network as we read
- it from gzip? */
- while (1)
- {
- if ((bufp - buf) + readsize >= bufsize)
- {
- /*
- * We need to expand the buffer if gzip ends up expanding
- * the file.
- */
- newsize = bufp - buf;
- while (newsize + readsize >= bufsize)
- bufsize *= 2;
- buf = xrealloc (buf, bufsize);
- bufp = buf + newsize;
- }
- nread = read (fd, bufp, readsize);
- if (nread < 0)
- error (1, errno, "reading from gzip pipe");
- else if (nread == 0)
- /* eof */
- break;
- bufp += nread;
- }
- newsize = bufp - buf;
if (close (fd) < 0)
error (0, errno, "warning: can't close %s", short_pathname);
- if (waitpid (gzip_pid, &gzip_status, 0) != gzip_pid)
- error (1, errno, "waiting for gzip proc %ld", (long) gzip_pid);
- else if (gzip_status != 0)
- error (1, errno, "gzip exited %d", gzip_status);
-
-#if LINES_CRLF_TERMINATED
- if (converting)
- {
- if ( CVS_UNLINK (tempfile) < 0)
- error (0, errno,
- "warning: can't remove temp file %s", tempfile);
- free (tempfile);
- tempfile = NULL;
- }
-#endif /* LINES_CRLF_TERMINATED */
-
{
char tmp[80];
@@ -4401,24 +4677,26 @@ send_fileproc (callerdat, finfo)
if (vers->vn_user != NULL)
{
- char *tmp;
-
- tmp = xmalloc (strlen (filename) + strlen (vers->vn_user)
- + strlen (vers->options) + 200);
- sprintf (tmp, "Entry /%s/%s/%s%s/%s/",
- filename, vers->vn_user,
- vers->ts_conflict == NULL ? "" : "+",
- (vers->ts_conflict == NULL ? ""
- : (vers->ts_user != NULL &&
- strcmp (vers->ts_conflict, vers->ts_user) == 0
- ? "="
- : "modified")),
- vers->options);
-
/* The Entries request. */
- /* Not sure about whether this deals with -k and stuff right. */
- send_to_server (tmp, 0);
- free (tmp);
+ send_to_server ("Entry /", 0);
+ send_to_server (filename, 0);
+ send_to_server ("/", 0);
+ send_to_server (vers->vn_user, 0);
+ send_to_server ("/", 0);
+ if (vers->ts_conflict != NULL)
+ {
+ if (vers->ts_user != NULL &&
+ strcmp (vers->ts_conflict, vers->ts_user) == 0)
+ send_to_server ("+=", 0);
+ else
+ send_to_server ("+modified", 0);
+ }
+ send_to_server ("/", 0);
+ send_to_server (vers->entdata != NULL
+ ? vers->entdata->options
+ : vers->options,
+ 0);
+ send_to_server ("/", 0);
if (vers->entdata != NULL && vers->entdata->tag)
{
send_to_server ("T", 0);
@@ -4431,6 +4709,41 @@ send_fileproc (callerdat, finfo)
}
send_to_server ("\012", 1);
}
+ else
+ {
+ /* It seems a little silly to re-read this on each file, but
+ send_dirent_proc doesn't get called if filenames are specified
+ explicitly on the command line. */
+ wrap_add_file (CVSDOTWRAPPER, 1);
+
+ if (wrap_name_has (filename, WRAP_RCSOPTION))
+ {
+ /* No "Entry", but the wrappers did give us a kopt so we better
+ send it with "Kopt". As far as I know this only happens
+ for "cvs add". Question: is there any reason why checking
+ for options from wrappers isn't done in Version_TS?
+
+ Note: it might have been better to just remember all the
+ kopts on the client side, rather than send them to the server,
+ and have it send us back the same kopts. But that seemed like
+ a bigger change than I had in mind making now. */
+
+ if (supported_request ("Kopt"))
+ {
+ char *opt;
+
+ send_to_server ("Kopt ", 0);
+ opt = wrap_rcsoption (filename, 1);
+ send_to_server (opt, 0);
+ send_to_server ("\012", 1);
+ free (opt);
+ }
+ else
+ error (0, 0,
+ "\
+warning: ignoring -k options due to server limitations");
+ }
+ }
if (vers->ts_user == NULL)
{
@@ -4540,7 +4853,6 @@ send_dirent_proc (callerdat, dir, repository, update_dir, entries)
struct send_data *args = (struct send_data *) callerdat;
int dir_exists;
char *cvsadm_name;
- char *cvsadm_repos_name;
if (ignore_directory (update_dir))
{
@@ -4571,9 +4883,7 @@ send_dirent_proc (callerdat, dir, repository, update_dir, entries)
* newly-created directory), the server still needs to know about it.
*/
- cvsadm_repos_name = xmalloc (strlen (dir) + sizeof (CVSADM_REP) + 80);
- sprintf (cvsadm_repos_name, "%s/%s", dir, CVSADM_REP);
- if (dir_exists && isreadable (cvsadm_repos_name))
+ if (dir_exists)
{
/*
* Get the repository from a CVS/Repository file whenever possible.
@@ -4586,14 +4896,23 @@ send_dirent_proc (callerdat, dir, repository, update_dir, entries)
}
else
{
+ /* It doesn't make sense to send a non-existent directory,
+ because there is no way to get the correct value for
+ the repository (I suppose maybe via the expand-modules
+ request). In the case where the "obvious" choice for
+ repository is correct, the server can figure out whether
+ to recreate the directory; in the case where it is wrong
+ (that is, does not match what modules give us), we might as
+ well just fail to recreate it.
+
+ Checking for noexec is a kludge for "cvs -n add dir". */
/* Don't send a non-existent directory unless we are building
new directories (build_dirs is true). Otherwise, CVS may
see a D line in an Entries file, and recreate a directory
which the user removed by hand. */
- if (dir_exists || args->build_dirs)
+ if (args->build_dirs && noexec)
send_a_repository (dir, repository, update_dir);
}
- free (cvsadm_repos_name);
return (dir_exists ? R_PROCESS : R_SKIP_ALL);
}
@@ -4862,6 +5181,18 @@ client_process_import_file (message, vfile, vtag, targc, targv, repository,
{
vers.options = wrap_rcsoption (vfile, 1);
}
+ if (vers.options != NULL)
+ {
+ if (supported_request ("Kopt"))
+ {
+ send_to_server ("Kopt ", 0);
+ send_to_server (vers.options, 0);
+ send_to_server ("\012", 1);
+ }
+ else
+ error (0, 0,
+ "warning: ignoring -k options due to server limitations");
+ }
send_modified (vfile, fullname, &vers);
if (vers.options != NULL)
free (vers.options);
@@ -4905,7 +5236,10 @@ notified_a_file (data, ent_list, short_pathname, filename)
fp = open_file (CVSADM_NOTIFY, "r");
if (getline (&line, &line_len, fp) < 0)
{
- error (0, errno, "cannot read %s", CVSADM_NOTIFY);
+ if (feof (fp))
+ error (0, 0, "cannot read %s: end of file", CVSADM_NOTIFY);
+ else
+ error (0, errno, "cannot read %s", CVSADM_NOTIFY);
goto error_exit;
}
cp = strchr (line, '\t');
@@ -5060,11 +5394,6 @@ client_senddate (date)
error (1, 0, "diff_client_senddate: sscanf failed on date");
}
-#ifndef HAVE_RCS5
- /* We need to fix the timezone in this case; see Make_Date. */
- abort ();
-#endif /* HAVE_RCS5 */
-
sprintf (buf, "%d/%d/%d %d:%d:%d GMT", month, day, year,
hour, minute, second);
option_with_arg ("-D", buf);
diff --git a/contrib/cvs/src/client.h b/contrib/cvs/src/client.h
index 1f9c27f..7097ea8 100644
--- a/contrib/cvs/src/client.h
+++ b/contrib/cvs/src/client.h
@@ -11,9 +11,14 @@ extern int filter_through_gunzip PROTO((int, int, pid_t *));
#if defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT)
+/* Whether the connection should be encrypted. */
extern int cvsencrypt;
+/* Whether the connection should use per-packet authentication. */
+extern int cvsauthenticate;
+
#ifdef ENCRYPTION
+
#ifdef HAVE_KERBEROS
/* We can't declare the arguments without including krb.h, and I don't
@@ -21,8 +26,24 @@ extern int cvsencrypt;
extern struct buffer *krb_encrypt_buffer_initialize ();
#endif /* HAVE_KERBEROS */
+
+#ifdef HAVE_GSSAPI
+
+/* Set this to turn on GSSAPI encryption. */
+extern int cvs_gssapi_encrypt;
+
+#endif /* HAVE_GSSAPI */
+
#endif /* ENCRYPTION */
+#ifdef HAVE_GSSAPI
+
+/* We can't declare the arguments without including gssapi.h, and I
+ don't want to do that in every file. */
+extern struct buffer *cvs_gssapi_wrap_buffer_initialize ();
+
+#endif /* HAVE_GSSAPI */
+
#endif /* defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT) */
#ifdef CLIENT_SUPPORT
@@ -37,13 +58,14 @@ extern int client_prune_dirs;
#ifdef AUTH_CLIENT_SUPPORT
extern int use_authenticating_server;
-int connect_to_pserver PROTO((int *tofdp, int* fromfdp, int verify_only));
+void connect_to_pserver PROTO ((int *tofdp, int* fromfdp, int verify_only,
+ int do_gssapi));
# ifndef CVS_AUTH_PORT
# define CVS_AUTH_PORT 2401
# endif /* CVS_AUTH_PORT */
#endif /* AUTH_CLIENT_SUPPORT */
-#ifdef AUTH_SERVER_SUPPORT
+#if defined (AUTH_SERVER_SUPPORT) || (defined (SERVER_SUPPORT) && defined (HAVE_GSSAPI))
extern void pserver_authenticate_connection PROTO ((void));
#endif
@@ -98,6 +120,8 @@ send_arg PROTO((char *string));
void
send_option_string PROTO((char *string));
+extern void send_a_repository PROTO ((char *, char *, char *));
+
#endif /* CLIENT_SUPPORT */
/*
diff --git a/contrib/cvs/src/commit.c b/contrib/cvs/src/commit.c
index c43e35f..a7fec5f 100644
--- a/contrib/cvs/src/commit.c
+++ b/contrib/cvs/src/commit.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Commit Files
*
@@ -92,6 +92,7 @@ static const char *const commit_usage[] =
"\t-F file\tRead the log message from file.\n",
"\t-m msg\tLog message.\n",
"\t-r rev\tCommit to this branch or trunk revision.\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -144,8 +145,22 @@ find_dirent_proc (callerdat, dir, repository, update_dir, entries)
{
struct find_data *find_data = (struct find_data *)callerdat;
+ /* This check seems to slowly be creeping throughout CVS (update
+ and send_dirent_proc by CVS 1.5, diff in 31 Oct 1995. My guess
+ is that it (or some variant thereof) should go in all the
+ dirent procs. Unless someone has some better idea... */
+ if (!isdir (dir))
+ return (R_SKIP_ALL);
+
/* initialize the ignore list for this directory */
find_data->ignlist = getlist ();
+
+ /* Print the same warm fuzzy as in check_direntproc, since that
+ code will never be run during client/server operation and we
+ want the messages to match. */
+ if (!quiet)
+ error (0, 0, "Examining %s", update_dir);
+
return R_PROCESS;
}
@@ -232,7 +247,7 @@ find_fileproc (callerdat, finfo)
xfinfo.repository = NULL;
xfinfo.rcs = NULL;
- vers = Version_TS (&xfinfo, NULL, NULL, NULL, 0, 0);
+ vers = Version_TS (&xfinfo, NULL, tag, NULL, 0, 0);
if (vers->ts_user == NULL
&& vers->vn_user != NULL
&& vers->vn_user[0] == '-')
@@ -246,8 +261,8 @@ find_fileproc (callerdat, finfo)
if (vers->ts_user == NULL)
error (0, 0, "nothing known about `%s'", finfo->fullname);
else
- error (0, 0, "use `cvs add' to create an entry for %s",
- finfo->fullname);
+ error (0, 0, "use `%s add' to create an entry for %s",
+ program_name, finfo->fullname);
return 1;
}
else if (vers->ts_user != NULL
@@ -321,6 +336,9 @@ commit (argc, argv)
* For log purposes, do not allow "root" to commit files. If you look
* like root, but are really logged in as a non-root user, it's OK.
*/
+ /* FIXME: Shouldn't this check be much more closely related to the
+ readonly user stuff (CVSROOT/readers, &c). That is, why should
+ root be able to "cvs init", "cvs import", &c, but not "cvs ci"? */
if (geteuid () == (uid_t) 0)
{
struct passwd *pw;
@@ -342,9 +360,9 @@ commit (argc, argv)
break;
case 'm':
#ifdef FORCE_USE_EDITOR
- use_editor = TRUE;
+ use_editor = 1;
#else
- use_editor = FALSE;
+ use_editor = 0;
#endif
if (message)
{
@@ -371,9 +389,9 @@ commit (argc, argv)
break;
case 'F':
#ifdef FORCE_USE_EDITOR
- use_editor = TRUE;
+ use_editor = 1;
#else
- use_editor = FALSE;
+ use_editor = 0;
#endif
logfile = optarg;
break;
@@ -425,6 +443,7 @@ commit (argc, argv)
#ifdef CLIENT_SUPPORT
if (client_active)
{
+ int err;
struct find_data find_args;
ign_setup ();
@@ -489,6 +508,8 @@ commit (argc, argv)
do_verify (message, (char *)NULL);
/* We always send some sort of message, even if empty. */
+ /* FIXME: is that true? There seems to be some code in do_editor
+ which can leave the message NULL. */
option_with_arg ("-m", message);
/* OK, now process all the questionable files we have been saving
@@ -553,14 +574,39 @@ commit (argc, argv)
"cvs commit -r 2" across a whole bunch of files a very slow
operation (and it isn't documented in cvsclient.texi). I
haven't looked at the server code carefully enough to be
- _sure_ why this is needed, but if it is because RCS_CI
- wants the file to exist, then it would be relatively simple
- (but not trivial) to fix in the server. */
+ _sure_ why this is needed, but if it is because the "ci"
+ program, which we used to call, wanted the file to exist,
+ then it would be relatively simple to fix in the server. */
send_files (find_args.argc, find_args.argv, local, 0,
find_args.force ? SEND_FORCE : 0);
send_to_server ("ci\012", 0);
- return get_responses_and_close ();
+ err = get_responses_and_close ();
+ if (err != 0 && use_editor && message != NULL)
+ {
+ /* If there was an error, don't nuke the user's carefully
+ constructed prose. This is something of a kludge; a better
+ solution is probably more along the lines of #150 in TODO
+ (doing a second up-to-date check before accepting the
+ log message has also been suggested, but that seems kind of
+ iffy because the real up-to-date check could still fail,
+ another error could occur, &c. Also, a second check would
+ slow things down). */
+
+ char *fname;
+ FILE *fp;
+
+ fname = cvs_temp_name ();
+ fp = CVS_FOPEN (fname, "w+");
+ if (fp == NULL)
+ error (1, 0, "cannot create temporary file %s", fname);
+ if (fwrite (message, 1, strlen (message), fp) != strlen (message))
+ error (1, errno, "cannot write temporary file %s", fname);
+ if (fclose (fp) < 0)
+ error (0, errno, "cannot close temporary file %s", fname);
+ error (0, 0, "saving log message in %s", fname);
+ }
+ return err;
}
#endif
@@ -633,7 +679,10 @@ classify_file_internal (finfo, vers)
{
int save_noexec, save_quiet, save_really_quiet;
Ctype status;
-
+
+ /* FIXME: Do we need to save quiet as well as really_quiet? Last
+ time I glanced at Classify_File I only saw it looking at really_quiet
+ not quiet. */
save_noexec = noexec;
save_quiet = quiet;
save_really_quiet = really_quiet;
@@ -817,16 +866,30 @@ check_fileproc (callerdat, finfo)
if (file_has_markers (finfo))
{
+ /* Make this a warning, not an error, because we have
+ no way of knowing whether the "conflict indicators"
+ are really from a conflict or whether they are part
+ of the document itself (cvs.texinfo and sanity.sh in
+ CVS itself, for example, tend to want to have strings
+ like ">>>>>>>" at the start of a line). Making people
+ kludge this the way they need to kludge keyword
+ expansion seems undesirable. And it is worse than
+ keyword expansion, because there is no -ko
+ analogue. */
error (0, 0,
- "file `%s' still contains conflict indicators",
+ "\
+warning: file `%s' seems to still contain conflict indicators",
finfo->fullname);
- freevers_ts (&vers);
- return (1);
}
}
if (status == T_REMOVED && vers->tag && isdigit (*vers->tag))
{
+ /* Remove also tries to forbid this, but we should check
+ here. I'm only _sure_ about somewhat obscure cases
+ (hacking the Entries file, using an old version of
+ CVS for the remove and a new one for the commit), but
+ there might be other cases. */
error (0, 0,
"cannot remove file `%s' which has a numeric sticky tag of `%s'",
finfo->fullname, vers->tag);
@@ -946,7 +1009,8 @@ check_fileproc (callerdat, finfo)
}
/*
- * Print warm fuzzies while examining the dirs
+ * By default, return the code that tells do_recursion to examine all
+ * directories
*/
/* ARGSUSED */
static Dtype
@@ -957,6 +1021,9 @@ check_direntproc (callerdat, dir, repos, update_dir, entries)
char *update_dir;
List *entries;
{
+ if (!isdir (dir))
+ return (R_SKIP_ALL);
+
if (!quiet)
error (0, 0, "Examining %s", update_dir);
@@ -1013,7 +1080,8 @@ precommit_proc (repository, filter)
free (s);
}
- run_setup ("%s %s", filter, repository);
+ run_setup (filter);
+ run_arg (repository);
(void) walklist (ulist, precommit_list_proc, NULL);
return (run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY));
}
@@ -1333,7 +1401,8 @@ commit_filesdoneproc (callerdat, err, repository, update_dir, entries)
if (line[line_length - 1] == '\n')
line[--line_length] = '\0';
repository = Name_Repository ((char *) NULL, update_dir);
- run_setup ("%s %s", line, repository);
+ run_setup (line);
+ run_arg (repository);
cvs_output (program_name, 0);
cvs_output (" ", 1);
cvs_output (command_name, 0);
@@ -1365,7 +1434,7 @@ commit_filesdoneproc (callerdat, err, repository, update_dir, entries)
}
/*
- * Get the log message for a dir and print a warm fuzzy
+ * Get the log message for a dir
*/
/* ARGSUSED */
static Dtype
@@ -1380,6 +1449,9 @@ commit_direntproc (callerdat, dir, repos, update_dir, entries)
List *ulist;
char *real_repos;
+ if (!isdir (dir))
+ return (R_SKIP_ALL);
+
/* find the update list for this dir */
p = findnode (mulist, update_dir);
if (p != NULL)
@@ -1391,10 +1463,6 @@ commit_direntproc (callerdat, dir, repos, update_dir, entries)
if (ulist == NULL || ulist->list->next == ulist->list)
return (R_SKIP_FILES);
- /* print the warm fuzzy */
- if (!quiet)
- error (0, 0, "Committing %s", update_dir);
-
/* get commit message */
real_repos = Name_Repository (dir, update_dir);
got_message = 1;
@@ -1489,10 +1557,10 @@ remove_file (finfo, tag, message)
error (1, 0, "internal error: no parsed RCS file");
branch = 0;
- if (tag && !(branch = RCS_isbranch (finfo->rcs, tag)))
+ if (tag && !(branch = RCS_nodeisbranch (finfo->rcs, tag)))
{
/* a symbolic tag is specified; just remove the tag from the file */
- if ((retcode = RCS_deltag (finfo->rcs, tag, 1)) != 0)
+ if ((retcode = RCS_deltag (finfo->rcs, tag)) != 0)
{
if (!quiet)
error (0, retcode == -1 ? errno : 0,
@@ -1500,6 +1568,7 @@ remove_file (finfo, tag, message)
finfo->fullname);
return (1);
}
+ RCS_rewrite (finfo->rcs, NULL, NULL);
Scratch_Entry (finfo->entries, finfo->file);
return (0);
}
@@ -1556,6 +1625,7 @@ remove_file (finfo, tag, message)
finfo->fullname);
return (1);
}
+ RCS_rewrite (finfo->rcs, NULL, NULL);
}
#ifdef SERVER_SUPPORT
@@ -1584,12 +1654,15 @@ remove_file (finfo, tag, message)
/* Except when we are creating a branch, lock the revision so that
we can check in the new revision. */
if (lockflag)
- RCS_lock (finfo->rcs, rev ? corev : NULL, 0);
+ {
+ if (RCS_lock (finfo->rcs, rev ? corev : NULL, 1) == 0)
+ RCS_rewrite (finfo->rcs, NULL, NULL);
+ }
if (corev != NULL)
free (corev);
- retcode = RCS_checkin (finfo->rcs->path, finfo->file, message, rev,
+ retcode = RCS_checkin (finfo->rcs, finfo->file, message, rev,
RCS_FLAGS_DEAD | RCS_FLAGS_QUIET);
if (retcode != 0)
{
@@ -1690,6 +1763,8 @@ unlockrcs (rcs)
if ((retcode = RCS_unlock (rcs, NULL, 0)) != 0)
error (retcode == -1 ? 1 : 0, retcode == -1 ? errno : 0,
"could not unlock %s", rcs->path);
+ else
+ RCS_rewrite (rcs, NULL, NULL);
}
/*
@@ -1730,6 +1805,7 @@ fixbranch (rcs, branch)
if ((retcode = RCS_setbranch (rcs, branch)) != 0)
error (retcode == -1 ? 1 : 0, retcode == -1 ? errno : 0,
"cannot restore branch to %s for %s", branch, rcs->path);
+ RCS_rewrite (rcs, NULL, NULL);
}
}
@@ -1841,29 +1917,63 @@ internal error: `%s' didn't move out of the attic",
{
/* this is the first time we have ever seen this file; create
an rcs file. */
- run_setup ("%s%s -x,v/ -i", Rcsbin, RCS);
+ char *desc;
+ size_t descalloc;
+ size_t desclen;
+
+ char *opt;
+
+ desc = NULL;
+ descalloc = 0;
+ desclen = 0;
fname = xmalloc (strlen (file) + sizeof (CVSADM)
+ sizeof (CVSEXT_LOG) + 10);
(void) sprintf (fname, "%s/%s%s", CVSADM, file, CVSEXT_LOG);
/* If the file does not exist, no big deal. In particular, the
server does not (yet at least) create CVSEXT_LOG files. */
if (isfile (fname))
- run_args ("-t%s/%s%s", CVSADM, file, CVSEXT_LOG);
+ /* FIXME: Should be including update_dir in the appropriate
+ place here. */
+ get_file (fname, fname, "r", &desc, &descalloc, &desclen);
free (fname);
+ /* From reading the RCS 5.7 source, "rcs -i" adds a newline to the
+ end of the log message if the message is nonempty.
+ Do it. RCS also deletes certain whitespace, in cleanlogmsg,
+ which we don't try to do here. */
+ if (desclen > 0)
+ {
+ expand_string (&desc, &descalloc, desclen + 1);
+ desc[desclen++] = '\012';
+ }
+
/* Set RCS keyword expansion options. */
if (options && options[0] == '-' && options[1] == 'k')
- run_arg (options);
- run_arg (rcs);
- if ((retcode = run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL)) != 0)
+ opt = options + 2;
+ else
+ opt = NULL;
+
+ /* This message is an artifact of the time when this
+ was implemented via "rcs -i". It should be revised at
+ some point (does the "initial revision" in the message from
+ RCS_checkin indicate that this is a new file? Or does the
+ "RCS file" message serve some function?). */
+ cvs_output ("RCS file: ", 0);
+ cvs_output (rcs, 0);
+ cvs_output ("\ndone\n", 0);
+
+ if (add_rcs_file (NULL, rcs, file, NULL, opt,
+ NULL, NULL, 0, NULL,
+ desc, desclen, NULL) != 0)
{
- error (retcode == -1 ? 1 : 0, retcode == -1 ? errno : 0,
- "could not create %s", rcs);
retval = 1;
goto out;
}
+ rcsfile = RCS_parsercsfile (rcs);
newfile = 1;
+ if (desc != NULL)
+ free (desc);
}
/* when adding a file for the first time, and using a tag, we need
@@ -1883,7 +1993,7 @@ internal error: `%s' didn't move out of the attic",
/* commit a dead revision. */
(void) sprintf (tmp, "file %s was initially added on branch %s.",
file, tag);
- retcode = RCS_checkin (rcs, NULL, tmp, NULL,
+ retcode = RCS_checkin (rcsfile, NULL, tmp, NULL,
RCS_FLAGS_DEAD | RCS_FLAGS_QUIET);
free (tmp);
if (retcode != 0)
@@ -1898,7 +2008,8 @@ internal error: `%s' didn't move out of the attic",
rename_file (fname, file);
free (fname);
- assert (rcsfile == NULL);
+ /* double-check that the file was written correctly */
+ freercsnode (&rcsfile);
rcsfile = RCS_parse (file, repository);
if (rcsfile == NULL)
{
@@ -1952,6 +2063,7 @@ internal error: `%s' didn't move out of the attic",
magicrev = RCS_magicrev (rcsfile, head);
retcode = RCS_settag (rcsfile, tag, magicrev);
+ RCS_rewrite (rcsfile, NULL, NULL);
free (head);
free (magicrev);
@@ -1984,7 +2096,14 @@ internal error: `%s' didn't move out of the attic",
fileattr_newfile (file);
+ /* I don't think fix_rcs_modes is needed any more. In the
+ add_rcs_file case, the algorithms used by add_rcs_file and
+ fix_rcs_modes are the same, so there is no need to go through
+ it all twice. In the other cases, I think we want to just
+ preserve the mode that the file had before we started. That is
+ a behavior change, but I would think a desirable one. */
fix_rcs_modes (rcs, file);
+
retval = 0;
out:
@@ -2031,12 +2150,13 @@ lock_RCS (user, rcs, rev, repository)
return (1);
}
}
- err = RCS_lock(rcs, NULL, 0);
+ err = RCS_lock(rcs, NULL, 1);
}
else
{
(void) RCS_lock(rcs, rev, 1);
}
+ RCS_rewrite (rcs, NULL, NULL);
if (err == 0)
{
diff --git a/contrib/cvs/src/create_adm.c b/contrib/cvs/src/create_adm.c
index 0ef6e57..c1772b2 100644
--- a/contrib/cvs/src/create_adm.c
+++ b/contrib/cvs/src/create_adm.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Create Administration.
*
@@ -13,35 +13,41 @@
#include "cvs.h"
-/* update_dir includes dir as its last component. */
+/* update_dir includes dir as its last component.
-void
-Create_Admin (dir, update_dir, repository, tag, date, nonbranch)
+ Return value is 0 for success, or 1 if we printed a warning message.
+ Note that many errors are still fatal; particularly for unlikely errors
+ a fatal error is probably better than a warning which might be missed
+ or after which CVS might do something non-useful. If WARN is zero, then
+ don't print warnings; all errors are fatal then. */
+
+int
+Create_Admin (dir, update_dir, repository, tag, date, nonbranch, warn)
char *dir;
char *update_dir;
char *repository;
char *tag;
char *date;
int nonbranch;
+ int warn;
{
FILE *fout;
char *cp;
+ char *reposcopy;
char *tmp;
#ifdef SERVER_SUPPORT
if (trace)
{
- char *wd = xgetwd ();
- fprintf (stderr, "%c-> Create_Admin (%s, %s, %s, %s, %s) in %s\n",
+ fprintf (stderr, "%c-> Create_Admin (%s, %s, %s, %s, %s, %d, %d)\n",
(server_active) ? 'S' : ' ',
- dir, update_dir, repository, tag ? tag : "",
- date ? date : "", wd);
- free (wd);
+ dir, update_dir, repository, tag ? tag : "",
+ date ? date : "", nonbranch, warn);
}
#endif
if (noexec)
- return;
+ return 0;
tmp = xmalloc (strlen (dir) + 100);
if (dir != NULL)
@@ -51,7 +57,21 @@ Create_Admin (dir, update_dir, repository, tag, date, nonbranch)
if (isfile (tmp))
error (1, 0, "there is a version in %s already", update_dir);
- make_directory (tmp);
+ if (CVS_MKDIR (tmp, 0777) < 0)
+ {
+ if (warn)
+ {
+ /* The reason that this is a warning, rather than silently
+ just skipping creating the directory, is that we don't want
+ CVS's behavior to vary subtly based on factors (like directory
+ permissions) which are not made clear to the user. With
+ the warning at least we let them know what is going on. */
+ error (0, errno, "warning: cannot make directory %s", tmp);
+ return 1;
+ }
+ else
+ error (1, errno, "cannot make directory %s", tmp);
+ }
/* record the current cvs root for later use */
@@ -68,8 +88,22 @@ Create_Admin (dir, update_dir, repository, tag, date, nonbranch)
else
error (1, errno, "cannot open %s/%s", update_dir, CVSADM_REP);
}
- cp = repository;
- strip_trailing_slashes (cp);
+ reposcopy = xstrdup (repository);
+ Sanitize_Repository_Name (reposcopy);
+
+ /* The top level of the repository is a special case -- we need to
+ write it with an extra dot at the end. This trailing `.' stuff
+ rubs me the wrong way -- on the other hand, I don't want to
+ spend the time making sure all of the code can handle it if we
+ don't do it. */
+
+ if (strcmp (reposcopy, CVSroot_directory) == 0)
+ {
+ reposcopy = xrealloc (reposcopy, strlen (reposcopy) + 3);
+ strcat (reposcopy, "/.");
+ }
+
+ cp = reposcopy;
#ifdef RELATIVE_REPOS
/*
@@ -81,8 +115,8 @@ Create_Admin (dir, update_dir, repository, tag, date, nonbranch)
char *path = xmalloc (strlen (CVSroot_directory) + 10);
(void) sprintf (path, "%s/", CVSroot_directory);
- if (strncmp (repository, path, strlen (path)) == 0)
- cp = repository + strlen (path);
+ if (strncmp (cp, path, strlen (path)) == 0)
+ cp += strlen (path);
free (path);
}
#endif
@@ -139,5 +173,7 @@ Create_Admin (dir, update_dir, repository, tag, date, nonbranch)
}
#endif
+ free (reposcopy);
free (tmp);
+ return 0;
}
diff --git a/contrib/cvs/src/cvs.h b/contrib/cvs/src/cvs.h
index 80bb468..b243e88 100644
--- a/contrib/cvs/src/cvs.h
+++ b/contrib/cvs/src/cvs.h
@@ -127,6 +127,8 @@ extern int errno;
#define CVSADM_NOTIFY "CVS/Notify."
#define CVSADM_NOTIFYTMP "CVS/Notify.tmp"
#define CVSADM_BASE "CVS/Base"
+#define CVSADM_BASEREV "CVS/Baserev."
+#define CVSADM_BASEREVTMP "CVS/Baserev.tmp"
#define CVSADM_TEMPLATE "CVS/Template."
#else /* USE_VMS_FILENAMES */
#define CVSADM "CVS"
@@ -144,6 +146,8 @@ extern int errno;
/* A directory in which we store base versions of files we currently are
editing with "cvs edit". */
#define CVSADM_BASE "CVS/Base"
+#define CVSADM_BASEREV "CVS/Baserev"
+#define CVSADM_BASEREVTMP "CVS/Baserev.tmp"
/* File which contains the template for use in log messages. */
#define CVSADM_TEMPLATE "CVS/Template"
#endif /* USE_VMS_FILENAMES */
@@ -182,6 +186,7 @@ extern int errno;
#define CVSROOTADM_READERS "readers"
#define CVSROOTADM_WRITERS "writers"
#define CVSROOTADM_PASSWD "passwd"
+#define CVSROOTADM_CONFIG "config"
#define CVSNULLREPOS "Emptydir" /* an empty directory */
@@ -206,11 +211,10 @@ extern int errno;
/* Command attributes -- see function lookup_command_attribute(). */
#define CVS_CMD_IGNORE_ADMROOT 1
-/* Set if CVS does _not_ need to create a CVS/Root file upon
- completion of this command. The name is confusing, both because
- the meaning is closer to "does not use working directory" than
- "uses working directory" and because the flag isn't really as
- general purpose as it seems (cvs release sets it). */
+/* Set if CVS needs to create a CVS/Root file upon completion of this
+ command. The name may be slightly confusing, because the flag
+ isn't really as general purpose as it seems (it is not set for cvs
+ release). */
#define CVS_CMD_USES_WORK_DIR 2
@@ -240,9 +244,6 @@ extern int errno;
#endif
#endif /* USE_VMS_FILENAMES */
-#define FALSE 0
-#define TRUE 1
-
/*
* Special tags. -rHEAD refers to the head of an RCS file, regardless of any
* sticky tags. -rBASE refers to the current revision the user has checked
@@ -253,10 +254,7 @@ extern int errno;
/* Environment variable used by CVS */
#define CVSREAD_ENV "CVSREAD" /* make files read-only */
-#define CVSREAD_DFLT FALSE /* writable files by default */
-
-#define RCSBIN_ENV "RCSBIN" /* RCS binary directory */
-/* #define RCSBIN_DFLT Set by options.h */
+#define CVSREAD_DFLT 0 /* writable files by default */
#define TMPDIR_ENV "TMPDIR" /* Temporary directory */
/* #define TMPDIR_DFLT Set by options.h */
@@ -300,8 +298,13 @@ struct entnode
enum ent_type type;
char *user;
char *version;
+
+ /* Timestamp, or "" if none (never NULL). */
char *timestamp;
+
+ /* Keyword expansion options, or "" if none (never NULL). */
char *options;
+
char *tag;
char *date;
char *conflict;
@@ -353,7 +356,7 @@ typedef enum direnter_type Dtype;
#endif
extern char *program_name, *program_path, *command_name;
-extern char *Rcsbin, *Tmpdir, *Editor;
+extern char *Tmpdir, *Editor;
extern int cvsadmin_root;
extern char *CurDir;
extern int really_quiet, quiet;
@@ -363,7 +366,8 @@ extern mode_t cvsumask;
/* Access method specified in CVSroot. */
typedef enum {
- local_method, server_method, pserver_method, kserver_method, ext_method
+ local_method, server_method, pserver_method, kserver_method, gserver_method,
+ ext_method
} CVSmethod;
extern char *method_names[]; /* change this in root.c if you change
the enum above */
@@ -375,6 +379,8 @@ extern char *CVSroot_username; /* the username or NULL if method == local */
extern char *CVSroot_hostname; /* the hostname or NULL if method == local */
extern char *CVSroot_directory; /* the directory name */
+extern char *emptydir_name PROTO ((void));
+
extern int trace; /* Show all commands */
extern int noexec; /* Don't modify disk anywhere */
extern int logoff; /* Don't write history entry */
@@ -389,20 +395,24 @@ extern char hostname[];
/* Externs that are included directly in the CVS sources */
-int RCS_exec_settag PROTO((const char *, const char *, const char *));
-int RCS_exec_deltag PROTO((const char *, const char *, int));
-int RCS_exec_setbranch PROTO((const char *, const char *));
-int RCS_exec_lock PROTO((const char *, const char *, int));
-int RCS_exec_unlock PROTO((const char *, const char *, int));
-int RCS_merge PROTO((const char *, const char *, const char *, const char *));
+int RCS_merge PROTO((RCSNode *, char *, char *, char *, char *, char *));
/* Flags used by RCS_* functions. See the description of the individual
functions for which flags mean what for each function. */
#define RCS_FLAGS_FORCE 1
#define RCS_FLAGS_DEAD 2
#define RCS_FLAGS_QUIET 4
#define RCS_FLAGS_MODTIME 8
-int RCS_checkin PROTO ((char *rcsfile, char *workfile, char *message,
- char *rev, int flags));
+
+extern int RCS_exec_rcsdiff PROTO ((RCSNode *rcsfile,
+ char *opts, char *options,
+ char *rev1, char *rev2,
+ char *label1, char *label2,
+ char *workfile));
+extern int diff_exec PROTO ((char *file1, char *file2, char *options,
+ char *out));
+extern int diff_execv PROTO ((char *file1, char *file2,
+ char *label1, char *label2,
+ char *options, char *out));
@@ -416,9 +426,11 @@ List *Entries_Open PROTO((int aflag));
void Subdirs_Known PROTO((List *entries));
void Subdir_Register PROTO((List *, const char *, const char *));
void Subdir_Deregister PROTO((List *, const char *, const char *));
+
char *Make_Date PROTO((char *rawdate));
char *Name_Repository PROTO((char *dir, char *update_dir));
-
+char *Short_Repository PROTO((char *repository));
+void Sanitize_Repository_Name PROTO((char *repository));
char *Name_Root PROTO((char *dir, char *update_dir));
int parse_cvsroot PROTO((char *CVSroot));
@@ -428,9 +440,8 @@ void root_allow_add PROTO ((char *));
void root_allow_free PROTO ((void));
int root_allow_ok PROTO ((char *));
-int same_directories PROTO((char *dir1, char *dir2));
-char *Short_Repository PROTO((char *repository));
-char *gca PROTO((char *rev1, char *rev2));
+char *gca PROTO((const char *rev1, const char *rev2));
+extern void check_numeric PROTO ((const char *, int, char **));
char *getcaller PROTO((void));
char *time_stamp PROTO((char *file));
@@ -443,6 +454,8 @@ int pathname_levels PROTO ((char *path));
typedef int (*CALLPROC) PROTO((char *repository, char *value));
int Parse_Info PROTO((char *infofile, char *repository, CALLPROC callproc, int all));
+extern int parse_config PROTO ((char *));
+
typedef RETSIGTYPE (*SIGCLEANUPPROC) PROTO(());
int SIG_register PROTO((int sig, SIGCLEANUPPROC sigcleanup));
int isdir PROTO((const char *file));
@@ -457,6 +470,8 @@ char *get_homedir PROTO ((void));
char *cvs_temp_name PROTO ((void));
int numdots PROTO((const char *s));
+char *increment_revnum PROTO ((const char *));
+int compare_revnums PROTO ((const char *, const char *));
int unlink_file PROTO((const char *f));
int link_file PROTO ((const char *from, const char *to));
int unlink_file_dir PROTO((const char *f));
@@ -465,9 +480,10 @@ int xcmp PROTO((const char *file1, const char *file2));
int yesno PROTO((void));
void *valloc PROTO((size_t bytes));
time_t get_date PROTO((char *date, struct timeb *now));
-void Create_Admin PROTO((char *dir, char *update_dir,
- char *repository, char *tag, char *date,
- int nonbranch));
+extern int Create_Admin PROTO ((char *dir, char *update_dir,
+ char *repository, char *tag, char *date,
+ int nonbranch, int warn));
+extern int expand_at_signs PROTO ((char *, off_t, FILE *));
/* Locking subsystem (implemented in lock.c). */
@@ -505,7 +521,7 @@ extern int ign_case;
#include "update.h"
-void line2argv PROTO ((int *pargc, char ***argv, char *line));
+void line2argv PROTO ((int *pargc, char ***argv, char *line, char *sepchars));
void make_directories PROTO((const char *name));
void make_directory PROTO((const char *name));
extern int mkdir_if_needed PROTO ((char *name));
@@ -542,7 +558,7 @@ void do_editor PROTO((char *dir, char **messagep,
void do_verify PROTO((char *message, char *repository));
typedef int (*CALLBACKPROC) PROTO((int *pargc, char *argv[], char *where,
- char *mwhere, char *mfile, int horten, int local_specified,
+ char *mwhere, char *mfile, int shorten, int local_specified,
char *omodule, char *msg));
/* This is the structure that the recursion processor passes to the
@@ -603,7 +619,9 @@ void SIG_endCrSect PROTO((void));
void read_cvsrc PROTO((int *argc, char ***argv, char *cmdname));
char *make_message_rcslegal PROTO((char *message));
-extern int file_has_markers PROTO ((struct file_info *));
+extern int file_has_markers PROTO ((const struct file_info *));
+extern void get_file PROTO ((const char *, const char *, const char *,
+ char **, size_t *, size_t *));
/* flags for run_exec(), the fast system() for CVS */
#define RUN_NORMAL 0x0000 /* no special behaviour */
@@ -616,14 +634,9 @@ extern int file_has_markers PROTO ((struct file_info *));
void run_arg PROTO((const char *s));
void run_print PROTO((FILE * fp));
-#ifdef HAVE_VPRINTF
-void run_setup PROTO((const char *fmt,...));
-void run_args PROTO((const char *fmt,...));
-#else
-void run_setup ();
-void run_args ();
-#endif
-int run_exec PROTO((char *stin, char *stout, char *sterr, int flags));
+void run_setup PROTO ((const char *prog));
+int run_exec PROTO((const char *stin, const char *stout, const char *sterr,
+ int flags));
/* other similar-minded stuff from run.c. */
FILE *run_popen PROTO((const char *, const char *));
@@ -643,10 +656,16 @@ pid_t waitpid PROTO((pid_t, int *, int));
struct vers_ts
{
/* rcs version user file derives from, from CVS/Entries.
- * it can have the following special values:
- * empty = no user file
- * 0 = user file is new
- * -vers = user file to be removed. */
+ It can have the following special values:
+
+ NULL = file is not mentioned in Entries (this is also used for a
+ directory).
+ "" = ILLEGAL! The comment used to say that it meant "no user file"
+ but as far as I know CVS didn't actually use it that way.
+ Note that according to cvs.texinfo, "" is not legal in the
+ Entries file.
+ 0 = user file is new
+ -vers = user file to be removed. */
char *vn_user;
/* Numeric revision number corresponding to ->vn_tag (->vn_tag
@@ -669,7 +688,8 @@ struct vers_ts
and if they differ it is modified. */
char *ts_rcs;
- /* Options from CVS/Entries (keyword expansion). */
+ /* Options from CVS/Entries (keyword expansion), malloc'd. If none,
+ then it is an empty string (never NULL). */
char *options;
/* If non-NULL, there was a conflict (or merely a merge? See merge_file)
@@ -708,6 +728,11 @@ int Checkin PROTO ((int type, struct file_info *finfo, char *rcs, char *rev,
char *tag, char *options, char *message));
int No_Difference PROTO ((struct file_info *finfo, Vers_TS *vers));
+/* CVSADM_BASEREV stuff, from entries.c. */
+extern char *base_get PROTO ((struct file_info *));
+extern void base_register PROTO ((struct file_info *, char *));
+extern void base_deregister PROTO ((struct file_info *));
+
/*
* defines for Classify_File() to determine the current state of a file.
* These are also used as types in the data field for the list we make for
@@ -818,10 +843,13 @@ extern void tag_check_valid PROTO ((char *, int, char **, int, int, char *));
extern void tag_check_valid_join PROTO ((char *, int, char **, int, int,
char *));
+/* From server.c and documented there. */
extern void cvs_output PROTO ((const char *, size_t));
+extern void cvs_output_binary PROTO ((char *, size_t));
extern void cvs_outerr PROTO ((const char *, size_t));
extern void cvs_flusherr PROTO ((void));
extern void cvs_flushout PROTO ((void));
+extern void cvs_output_tagged PROTO ((char *, char *));
#if defined(SERVER_SUPPORT) || defined(CLIENT_SUPPORT)
#include "server.h"
diff --git a/contrib/cvs/src/cvsbug.sh b/contrib/cvs/src/cvsbug.sh
index fd6ae7c..ee3b7bb 100755
--- a/contrib/cvs/src/cvsbug.sh
+++ b/contrib/cvs/src/cvsbug.sh
@@ -28,7 +28,7 @@ SUBMITTER=net
## GNATS_ROOT=/usr/local/lib/gnats/gnats-db
# The default mail address for PR submissions.
-GNATS_ADDR=bug-cvs@prep.ai.mit.edu
+GNATS_ADDR=bug-cvs@gnu.org
## # Where the gnats category tree lives.
## DATADIR=/usr/local/lib
diff --git a/contrib/cvs/src/cvsrc.c b/contrib/cvs/src/cvsrc.c
index 5e9cfa5..e35ec21 100644
--- a/contrib/cvs/src/cvsrc.c
+++ b/contrib/cvs/src/cvsrc.c
@@ -1,10 +1,10 @@
/*
- * Copyright (c) 1993 david d zuhn
- *
- * written by david d `zoo' zuhn while at Cygnus Support
- *
- * You may distribute under the terms of the GNU General Public License
- * as specified in the README file that comes with the CVS 1.4 kit.
+ * Copyright (c) 1993 david d zuhn
+ *
+ * Written by david d `zoo' zuhn while at Cygnus Support
+ *
+ * You may distribute under the terms of the GNU General Public License as
+ * specified in the README file that comes with the CVS source distribution.
*
*/
@@ -103,6 +103,9 @@ read_cvsrc (argc, argv, cmdname)
}
}
+ if (line_length < 0 && !feof (cvsrcfile))
+ error (0, errno, "cannot read %s", homeinit);
+
fclose (cvsrcfile);
/* setup the new options list */
diff --git a/contrib/cvs/src/diff.c b/contrib/cvs/src/diff.c
index 608a00f..a894c5b 100644
--- a/contrib/cvs/src/diff.c
+++ b/contrib/cvs/src/diff.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Difference
*
@@ -43,6 +43,7 @@ static void diff_mark_errors PROTO((int err));
static char *diff_rev1, *diff_rev2;
static char *diff_date1, *diff_date2;
static char *use_rev1, *use_rev2;
+static int have_rev1_label, have_rev2_label;
/* Revision of the user file, if it is unchanged from something in the
repository and we want to use that fact. */
@@ -71,6 +72,7 @@ static const char *const diff_usage[] =
"\t--ifdef=arg\tOutput diffs in ifdef format.\n",
"(consult the documentation for your diff program for rcsdiff-options.\n",
"The most popular is -c for context diffs but there are many more).\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -103,13 +105,13 @@ static struct option const longopts[] =
{
{"ignore-blank-lines", 0, 0, 'B'},
{"context", 2, 0, 143},
- {"ifdef", 1, 0, 147},
+ {"ifdef", 1, 0, 131},
{"show-function-line", 1, 0, 'F'},
{"speed-large-files", 0, 0, 'H'},
{"ignore-matching-lines", 1, 0, 'I'},
{"label", 1, 0, 'L'},
{"new-file", 0, 0, 'N'},
- {"initial-tab", 0, 0, 'T'},
+ {"initial-tab", 0, 0, 148},
{"width", 1, 0, 'W'},
{"text", 0, 0, 'a'},
{"ignore-space-change", 0, 0, 'b'},
@@ -130,7 +132,7 @@ static struct option const longopts[] =
{"report-identical-files", 0, 0, 's'},
{"expand-tabs", 0, 0, 't'},
{"ignore-all-space", 0, 0, 'w'},
- {"side-by-side", 0, 0, 'y'},
+ {"side-by-side", 0, 0, 147},
{"unified", 2, 0, 146},
{"left-column", 0, 0, 129},
{"suppress-common-lines", 0, 0, 130},
@@ -147,6 +149,37 @@ static struct option const longopts[] =
{0, 0, 0, 0}
};
+/* CVS 1.9 and similar versions seemed to have pretty weird handling
+ of -y and -T. In the cases where it called rcsdiff,
+ they would have the meanings mentioned below. In the cases where it
+ called diff, they would have the meanings mentioned in "longopts".
+ Noone seems to have missed them, so I think the right thing to do is
+ just to remove the options altogether (which I have done).
+
+ In the case of -z and -q, "cvs diff" did not accept them even back
+ when we called rcsdiff (at least, it hasn't accepted them
+ recently).
+
+ In comparing rcsdiff to the new CVS implementation, I noticed that
+ the following rcsdiff flags are not handled by CVS diff:
+
+ -y: perform diff even when the requested revisions are the
+ same revision number
+ -q: run quietly
+ -T: preserve modification time on the RCS file
+ -z: specify timezone for use in file labels
+
+ I think these are not really relevant. -y is undocumented even in
+ RCS 5.7, and seems like a minor change at best. According to RCS
+ documentation, -T only applies when a RCS file has been modified
+ because of lock changes; doesn't CVS sidestep RCS's entire lock
+ structure? -z seems to be unsupported by CVS diff, and has a
+ different meaning as a global option anyway. (Adding it could be
+ a feature, but if it is left out for now, it should not break
+ anything.) For the purposes of producing output, CVS diff appears
+ mostly to ignore -q. Maybe this should be fixed, but I think it's
+ a larger issue than the changes included here. */
+
static void strcat_and_allocate PROTO ((char **, size_t *, const char *));
/* *STR is a pointer to a malloc'd string. *LENP is its allocated
@@ -183,6 +216,8 @@ diff (argc, argv)
if (argc == -1)
usage (diff_usage);
+ have_rev1_label = have_rev2_label = 0;
+
/*
* Note that we catch all the valid arguments here, so that we can
* intercept the -r arguments for doing revision diffs; and -l/-R for a
@@ -201,33 +236,44 @@ diff (argc, argv)
optind = 0;
while ((c = getopt_long (argc, argv,
- "+abcdefhilnpstuwy0123456789BHNRTC:D:F:I:L:U:V:W:k:r:",
+ "+abcdefhilnpstuw0123456789BHNRC:D:F:I:L:U:V:W:k:r:",
longopts, &option_index)) != -1)
{
switch (c)
{
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'h': case 'i': case 'n': case 'p': case 's': case 't':
- case 'u': case 'w': case 'y': case '0': case '1': case '2':
+ case 'u': case 'w': case '0': case '1': case '2':
case '3': case '4': case '5': case '6': case '7': case '8':
- case '9': case 'B': case 'H': case 'T':
+ case '9': case 'B': case 'H':
(void) sprintf (tmp, " -%c", (char) c);
strcat_and_allocate (&opts, &opts_allocated, tmp);
break;
- case 'C': case 'F': case 'I': case 'L': case 'U': case 'V':
- case 'W':
+ case 'L':
+ if (have_rev1_label++)
+ if (have_rev2_label++)
+ {
+ error (0, 0, "extra -L arguments ignored");
+ break;
+ }
+
+ strcat_and_allocate (&opts, &opts_allocated, " -L");
+ strcat_and_allocate (&opts, &opts_allocated, optarg);
+ break;
+ case 'C': case 'F': case 'I': case 'U': case 'V': case 'W':
(void) sprintf (tmp, " -%c", (char) c);
strcat_and_allocate (&opts, &opts_allocated, tmp);
strcat_and_allocate (&opts, &opts_allocated, optarg);
break;
- case 147:
+ case 131:
/* --ifdef. */
strcat_and_allocate (&opts, &opts_allocated, " -D");
strcat_and_allocate (&opts, &opts_allocated, optarg);
break;
- case 129: case 130: case 131: case 132: case 133: case 134:
+ case 129: case 130: case 132: case 133: case 134:
case 135: case 136: case 137: case 138: case 139: case 140:
case 141: case 142: case 143: case 144: case 145: case 146:
+ case 147: case 148:
strcat_and_allocate (&opts, &opts_allocated, " --");
strcat_and_allocate (&opts, &opts_allocated,
longopts[option_index].name);
@@ -359,6 +405,11 @@ diff_fileproc (callerdat, finfo)
char *tocvsPath;
char *fname;
+ /* Initialize these solely to avoid warnings from gcc -Wall about
+ variables that might be used uninitialized. */
+ tmp = NULL;
+ fname = NULL;
+
user_file_rev = 0;
vers = Version_TS (finfo, NULL, NULL, NULL, 1, 0);
@@ -534,9 +585,9 @@ diff_fileproc (callerdat, finfo)
}
/* Output an "Index:" line for patch to use */
- (void) fflush (stdout);
- (void) printf ("Index: %s\n", finfo->fullname);
- (void) fflush (stdout);
+ cvs_output ("Index: ", 0);
+ cvs_output (finfo->fullname, 0);
+ cvs_output ("\n", 1);
tocvsPath = wrap_tocvs_process_file(finfo->file);
if (tocvsPath)
@@ -559,14 +610,20 @@ diff_fileproc (callerdat, finfo)
{
/* This is file, not fullname, because it is the "Index:" line which
is supposed to contain the directory. */
- (void) printf ("===================================================================\nRCS file: %s\n",
- finfo->file);
- (void) printf ("diff -N %s\n", finfo->file);
+ cvs_output ("\
+===================================================================\n\
+RCS file: ", 0);
+ cvs_output (finfo->file, 0);
+ cvs_output ("\n", 1);
+
+ cvs_output ("diff -N ", 0);
+ cvs_output (finfo->file, 0);
+ cvs_output ("\n", 1);
if (empty_file == DIFF_ADDED)
{
if (use_rev2 == NULL)
- run_setup ("%s %s %s %s", DIFF, opts, DEVNULL, finfo->file);
+ status = diff_exec (DEVNULL, finfo->file, opts, RUN_TTY);
else
{
int retcode;
@@ -587,7 +644,7 @@ diff_fileproc (callerdat, finfo)
}
/* FIXME: what if retcode > 0? */
- run_setup ("%s %s %s %s", DIFF, opts, DEVNULL, tmp);
+ status = diff_exec (DEVNULL, tmp, opts, RUN_TTY);
}
}
else
@@ -608,30 +665,36 @@ diff_fileproc (callerdat, finfo)
}
/* FIXME: what if retcode > 0? */
- run_setup ("%s %s %s %s", DIFF, opts, tmp, DEVNULL);
+ status = diff_exec (tmp, DEVNULL, opts, RUN_TTY);
}
}
else
{
- if (use_rev2)
- {
- run_setup ("%s%s -x,v/ %s %s -r%s -r%s", Rcsbin, RCS_DIFF,
- opts, *options ? options : vers->options,
- use_rev1, use_rev2);
- }
- else
- {
- run_setup ("%s%s -x,v/ %s %s -r%s", Rcsbin, RCS_DIFF, opts,
- *options ? options : vers->options, use_rev1);
- }
- run_arg (vers->srcfile->path);
+ char *label1 = NULL;
+ char *label2 = NULL;
+
+ if (!have_rev1_label)
+ label1 =
+ make_file_label (finfo->fullname, use_rev1, vers->srcfile);
+
+ if (!have_rev2_label)
+ label2 =
+ make_file_label (finfo->fullname, use_rev2, vers->srcfile);
+
+ status = RCS_exec_rcsdiff (vers->srcfile, opts,
+ *options ? options : vers->options,
+ use_rev1, use_rev2,
+ label1, label2,
+ finfo->file);
+
+ if (label1) free (label1);
+ if (label2) free (label2);
}
- switch ((status = run_exec (RUN_TTY, RUN_TTY, RUN_TTY,
- RUN_REALLY|RUN_COMBINED)))
+ switch (status)
{
case -1: /* fork failed */
- error (1, errno, "fork failed during rcsdiff of %s",
+ error (1, errno, "fork failed while diffing %s",
vers->srcfile->path);
case 0: /* everything ok */
err = 0;
@@ -660,7 +723,6 @@ diff_fileproc (callerdat, finfo)
free (tmp);
}
- (void) fflush (stdout);
freevers_ts (&vers);
diff_mark_errors (err);
return (err);
@@ -694,9 +756,9 @@ diff_dirproc (callerdat, dir, pos_repos, update_dir, entries)
/* XXX - check for dirs we don't want to process??? */
/* YES ... for instance dirs that don't exist!!! -- DW */
- if (!isdir (dir) )
- return (R_SKIP_ALL);
-
+ if (!isdir (dir))
+ return (R_SKIP_ALL);
+
if (!quiet)
error (0, 0, "Diffing %s", update_dir);
return (R_PROCESS);
@@ -853,9 +915,9 @@ diff_file_nodiff (finfo, vers, empty_file)
{
/* drop user_file_rev into first unused use_rev */
if (!use_rev1)
- use_rev1 = xstrdup (user_file_rev);
+ use_rev1 = xstrdup (user_file_rev);
else if (!use_rev2)
- use_rev2 = xstrdup (user_file_rev);
+ use_rev2 = xstrdup (user_file_rev);
/* and if not, it wasn't needed anyhow */
user_file_rev = 0;
}
diff --git a/contrib/cvs/src/edit.c b/contrib/cvs/src/edit.c
index 33e9c61..6c6f040 100644
--- a/contrib/cvs/src/edit.c
+++ b/contrib/cvs/src/edit.c
@@ -284,6 +284,18 @@ edit_fileproc (callerdat, finfo)
if (noexec)
return 0;
+ /* This is a somewhat screwy way to check for this, because it
+ doesn't help errors other than the nonexistence of the file
+ (e.g. permissions problems). It might be better to rearrange
+ the code so that CVSADM_NOTIFY gets written only after the
+ various actions succeed (but what if only some of them
+ succeed). */
+ if (!isfile (finfo->file))
+ {
+ error (0, 0, "no such file %s; ignored", finfo->fullname);
+ return 0;
+ }
+
fp = open_file (CVSADM_NOTIFY, "a");
(void) time (&now);
@@ -326,6 +338,14 @@ edit_fileproc (callerdat, finfo)
copy_file (finfo->file, basefilename);
free (basefilename);
+ {
+ Node *node;
+
+ node = findnode_fn (finfo->entries, finfo->file);
+ if (node != NULL)
+ base_register (finfo, ((Entnode *) node->data)->version);
+ }
+
return 0;
}
@@ -336,6 +356,7 @@ static const char *const edit_usage[] =
"-R: Process directories recursively\n",
"-a: Specify what actions for temporary watch, one of\n",
" edit,unedit,commit,all,none\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -475,6 +496,39 @@ unedit_fileproc (callerdat, finfo)
CVSADM_NOTIFY);
}
+ /* Now update the revision number in CVS/Entries from CVS/Baserev.
+ The basic idea here is that we are reverting to the revision
+ that the user edited. If we wanted "cvs update" to update
+ CVS/Base as we go along (so that an unedit could revert to the
+ current repository revision), we would need:
+
+ update (or all send_files?) (client) needs to send revision in
+ new Entry-base request. update (server/local) needs to check
+ revision against repository and send new Update-base response
+ (like Update-existing in that the file already exists. While
+ we are at it, might try to clean up the syntax by having the
+ mode only in a "Mode" response, not in the Update-base itself). */
+ {
+ char *baserev;
+ Node *node;
+ Entnode *entdata;
+
+ baserev = base_get (finfo);
+ node = findnode_fn (finfo->entries, finfo->file);
+ /* The case where node is NULL probably should be an error or
+ something, but I don't want to think about it too hard right
+ now. */
+ if (node != NULL)
+ {
+ entdata = (Entnode *) node->data;
+ Register (finfo->entries, finfo->file, baserev, entdata->timestamp,
+ entdata->options, entdata->tag, entdata->date,
+ entdata->conflict);
+ }
+ free (baserev);
+ base_deregister (finfo);
+ }
+
xchmod (finfo->file, 0);
return 0;
}
@@ -552,14 +606,14 @@ editor_set (filename, editor, val)
edlist = fileattr_get0 (filename, "_editors");
newlist = fileattr_modify (edlist, editor, val, '>', ',');
- if (edlist != NULL)
- free (edlist);
/* If the attributes is unchanged, don't rewrite the attribute file. */
if (!((edlist == NULL && newlist == NULL)
|| (edlist != NULL
&& newlist != NULL
&& strcmp (edlist, newlist) == 0)))
fileattr_set (filename, "_editors", newlist);
+ if (edlist != NULL)
+ free (edlist);
if (newlist != NULL)
free (newlist);
}
@@ -916,6 +970,7 @@ static const char *const editors_usage[] =
"Usage: %s %s [-lR] [files...]\n",
"\t-l\tProcess this directory only (not recursive).\n",
"\t-R\tProcess directories recursively.\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
diff --git a/contrib/cvs/src/entries.c b/contrib/cvs/src/entries.c
index 03e29de..538cd21 100644
--- a/contrib/cvs/src/entries.c
+++ b/contrib/cvs/src/entries.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Entries file to Files file
*
@@ -117,7 +117,26 @@ write_entries (list)
/* open the new one and walk the list writing entries */
entfilename = CVSADM_ENTBAK;
- entfile = open_file (entfilename, "w+");
+ entfile = CVS_FOPEN (entfilename, "w+");
+ if (entfile == NULL)
+ {
+ /* Make this a warning, not an error. For example, one user might
+ have checked out a working directory which, for whatever reason,
+ contains an Entries.Log file. A second user, without write access
+ to that working directory, might want to do a "cvs log". The
+ problem rewriting Entries shouldn't affect the ability of "cvs log"
+ to work, although the warning is probably a good idea so that
+ whether Entries gets rewritten is not an inexplicable process. */
+ /* FIXME: should be including update_dir in message. */
+ error (0, errno, "cannot rewrite %s", entfilename);
+
+ /* Now just return. We leave the Entries.Log file around. As far
+ as I know, there is never any data lying around in 'list' that
+ is not in Entries.Log at this time (if there is an error writing
+ Entries.Log that is a separate problem). */
+ return;
+ }
+
(void) walklist (list, write_ent_proc, (void *) &sawdir);
if (! sawdir)
{
@@ -262,6 +281,9 @@ freesdt (p)
free ((char *) sdtp);
}
+/* Return the next real Entries line. On end of file, returns NULL.
+ On error, prints an error message and returns NULL. */
+
static Entnode *
fgetentent(fpin, cmd, sawdir)
FILE *fpin;
@@ -275,12 +297,13 @@ fgetentent(fpin, cmd, sawdir)
enum ent_type type;
char *l, *user, *vn, *ts, *options;
char *tag_or_date, *tag, *date, *ts_conflict;
+ int line_length;
line = NULL;
line_chars_allocated = 0;
ent = NULL;
- while (getline (&line, &line_chars_allocated, fpin) > 0)
+ while ((line_length = getline (&line, &line_chars_allocated, fpin)) > 0)
{
l = line;
@@ -375,6 +398,9 @@ fgetentent(fpin, cmd, sawdir)
break;
}
+ if (line_length < 0 && !feof (fpin))
+ error (0, errno, "cannot read entries file");
+
free (line);
return ent;
}
@@ -668,7 +694,10 @@ WriteTag (dir, tag, date, nonbranch, update_dir, repository)
If it does not exist, or contains something unrecognized by this
version of CVS, set *DATEP and *TAGP to NULL and *NONBRANCHP to
- an unspecified value. */
+ an unspecified value.
+
+ If there is an error, print an error message, set *DATEP and *TAGP
+ to NULL, and return. */
void
ParseTag (tagp, datep, nonbranchp)
char **tagp;
@@ -724,9 +753,25 @@ ParseTag (tagp, datep, nonbranchp)
break;
}
}
- (void) fclose (fp);
+
+ if (line_length < 0)
+ {
+ /* FIXME-update-dir: should include update_dir in messages. */
+ if (feof (fp))
+ error (0, 0, "cannot read %s: end of file", CVSADM_TAG);
+ else
+ error (0, errno, "cannot read %s", CVSADM_TAG);
+ }
+
+ if (fclose (fp) < 0)
+ /* FIXME-update-dir: should include update_dir in message. */
+ error (0, errno, "cannot close %s", CVSADM_TAG);
+
free (line);
}
+ else if (!existence_error (errno))
+ /* FIXME-update-dir: should include update_dir in message. */
+ error (0, errno, "cannot open %s", CVSADM_TAG);
}
/*
@@ -887,3 +932,230 @@ Subdir_Deregister (entries, parent, dir)
delnode (p);
}
}
+
+
+
+/* OK, the following base_* code tracks the revisions of the files in
+ CVS/Base. We do this in a file CVS/Baserev. Separate from
+ CVS/Entries because it needs to go in separate data structures
+ anyway (the name in Entries must be unique), so this seemed
+ cleaner. The business of rewriting the whole file in
+ base_deregister and base_register is the kind of thing we used to
+ do for Entries and which turned out to be slow, which is why there
+ is now the Entries.Log machinery. So maybe from that point of
+ view it is a mistake to do this separately from Entries, I dunno.
+
+ We also need something analogous for:
+
+ 1. CVS/Template (so we can update the Template file automagically
+ without the user needing to check out a new working directory).
+ Updating would probably print a message (that part might be
+ optional, although probably it should be visible because not all
+ cvs commands would make the update happen and so it is a
+ user-visible behavior). Constructing version number for template
+ is a bit hairy (base it on the timestamp on the server? Or see if
+ the template is in checkoutlist and if yes use its versioning and
+ if no don't version it?)....
+
+ 2. cvsignore (need to keep a copy in the working directory to do
+ "cvs release" on the client side; see comment at src/release.c
+ (release). Would also allow us to stop needing Questionable. */
+
+enum base_walk {
+ /* Set the revision for FILE to *REV. */
+ BASE_REGISTER,
+ /* Get the revision for FILE and put it in a newly malloc'd string
+ in *REV, or put NULL if not mentioned. */
+ BASE_GET,
+ /* Remove FILE. */
+ BASE_DEREGISTER
+};
+
+static void base_walk PROTO ((enum base_walk, struct file_info *, char **));
+
+/* Read through the lines in CVS/Baserev, taking the actions as documented
+ for CODE. */
+
+static void
+base_walk (code, finfo, rev)
+ enum base_walk code;
+ struct file_info *finfo;
+ char **rev;
+{
+ FILE *fp;
+ char *line;
+ size_t line_allocated;
+ FILE *newf;
+ char *baserev_fullname;
+ char *baserevtmp_fullname;
+
+ line = NULL;
+ line_allocated = 0;
+ newf = NULL;
+
+ /* First compute the fullnames for the error messages. This
+ computation probably should be broken out into a separate function,
+ as recurse.c does it too and places like Entries_Open should be
+ doing it. */
+ baserev_fullname = xmalloc (sizeof (CVSADM_BASEREV)
+ + strlen (finfo->update_dir)
+ + 2);
+ baserev_fullname[0] = '\0';
+ baserevtmp_fullname = xmalloc (sizeof (CVSADM_BASEREVTMP)
+ + strlen (finfo->update_dir)
+ + 2);
+ baserevtmp_fullname[0] = '\0';
+ if (finfo->update_dir[0] != '\0')
+ {
+ strcat (baserev_fullname, finfo->update_dir);
+ strcat (baserev_fullname, "/");
+ strcat (baserevtmp_fullname, finfo->update_dir);
+ strcat (baserevtmp_fullname, "/");
+ }
+ strcat (baserev_fullname, CVSADM_BASEREV);
+ strcat (baserevtmp_fullname, CVSADM_BASEREVTMP);
+
+ fp = CVS_FOPEN (CVSADM_BASEREV, "r");
+ if (fp == NULL)
+ {
+ if (!existence_error (errno))
+ {
+ error (0, errno, "cannot open %s for reading", baserev_fullname);
+ goto out;
+ }
+ }
+
+ switch (code)
+ {
+ case BASE_REGISTER:
+ case BASE_DEREGISTER:
+ newf = CVS_FOPEN (CVSADM_BASEREVTMP, "w");
+ if (newf == NULL)
+ {
+ error (0, errno, "cannot open %s for writing",
+ baserevtmp_fullname);
+ goto out;
+ }
+ break;
+ case BASE_GET:
+ *rev = NULL;
+ break;
+ }
+
+ if (fp != NULL)
+ {
+ while (getline (&line, &line_allocated, fp) >= 0)
+ {
+ char *linefile;
+ char *p;
+ char *linerev;
+
+ if (line[0] != 'B')
+ /* Ignore, for future expansion. */
+ continue;
+
+ linefile = line + 1;
+ p = strchr (linefile, '/');
+ if (p == NULL)
+ /* Syntax error, ignore. */
+ continue;
+ linerev = p + 1;
+ p = strchr (linerev, '/');
+ if (p == NULL)
+ continue;
+
+ linerev[-1] = '\0';
+ if (fncmp (linefile, finfo->file) == 0)
+ {
+ switch (code)
+ {
+ case BASE_REGISTER:
+ case BASE_DEREGISTER:
+ /* Don't copy over the old entry, we don't want it. */
+ break;
+ case BASE_GET:
+ *p = '\0';
+ *rev = xstrdup (linerev);
+ *p = '/';
+ goto got_it;
+ }
+ }
+ else
+ {
+ linerev[-1] = '/';
+ switch (code)
+ {
+ case BASE_REGISTER:
+ case BASE_DEREGISTER:
+ if (fprintf (newf, "%s\n", line) < 0)
+ error (0, errno, "error writing %s",
+ baserevtmp_fullname);
+ break;
+ case BASE_GET:
+ break;
+ }
+ }
+ }
+ if (ferror (fp))
+ error (0, errno, "cannot read %s", baserev_fullname);
+ }
+ got_it:
+
+ if (code == BASE_REGISTER)
+ {
+ if (fprintf (newf, "B%s/%s/\n", finfo->file, *rev) < 0)
+ error (0, errno, "error writing %s",
+ baserevtmp_fullname);
+ }
+
+ out:
+
+ if (line != NULL)
+ free (line);
+
+ if (fp != NULL)
+ {
+ if (fclose (fp) < 0)
+ error (0, errno, "cannot close %s", baserev_fullname);
+ }
+ if (newf != NULL)
+ {
+ if (fclose (newf) < 0)
+ error (0, errno, "cannot close %s", baserevtmp_fullname);
+ rename_file (CVSADM_BASEREVTMP, CVSADM_BASEREV);
+ }
+
+ free (baserev_fullname);
+ free (baserevtmp_fullname);
+}
+
+/* Return, in a newly malloc'd string, the revision for FILE in CVS/Baserev,
+ or NULL if not listed. */
+
+char *
+base_get (finfo)
+ struct file_info *finfo;
+{
+ char *rev;
+ base_walk (BASE_GET, finfo, &rev);
+ return rev;
+}
+
+/* Set the revision for FILE to REV. */
+
+void
+base_register (finfo, rev)
+ struct file_info *finfo;
+ char *rev;
+{
+ base_walk (BASE_REGISTER, finfo, &rev);
+}
+
+/* Remove FILE. */
+
+void
+base_deregister (finfo)
+ struct file_info *finfo;
+{
+ base_walk (BASE_DEREGISTER, finfo, NULL);
+}
diff --git a/contrib/cvs/src/error.c b/contrib/cvs/src/error.c
index 5c7eef5..cb69bde 100644
--- a/contrib/cvs/src/error.c
+++ b/contrib/cvs/src/error.c
@@ -83,7 +83,13 @@ error_exit PROTO ((void))
format string with optional args.
If ERRNUM is nonzero, print its corresponding system error message.
Exit with status EXIT_FAILURE if STATUS is nonzero. If MESSAGE is "",
- no need to print a message. */
+ no need to print a message.
+
+ I think this is largely cleaned up to the point where it does the right
+ thing for the server, whether the normal server_active (child process)
+ case or the error_use_protocol (parent process) case. The one exception
+ is that STATUS nonzero for error_use_protocol probably doesn't work yet;
+ in that case still need to use the pending_error machinery in server.c. */
/* VARARGS */
void
#if defined (HAVE_VPRINTF) && defined (__STDC__)
diff --git a/contrib/cvs/src/expand_path.c b/contrib/cvs/src/expand_path.c
index 7d0bc39..5cf414e 100644
--- a/contrib/cvs/src/expand_path.c
+++ b/contrib/cvs/src/expand_path.c
@@ -184,6 +184,19 @@ expand_path (name, file, line)
t = get_homedir ();
else
{
+#ifdef GETPWNAM_MISSING
+ for (; *p!='/' && *p; p++)
+ ;
+ *p = 0;
+ if (line != 0)
+ error (0, 0,
+ "%s:%d:tilde expansion not supported on this system",
+ file, line);
+ else
+ error (0, 0, "%s:tilde expansion not supported on this system",
+ file);
+ return NULL;
+#else
struct passwd *ps;
for (; *p!='/' && *p; p++)
;
@@ -199,6 +212,7 @@ expand_path (name, file, line)
return NULL;
}
t = ps->pw_dir;
+#endif
}
doff = d - buf;
expand_string (&buf, &buf_size, doff + 1);
@@ -256,8 +270,11 @@ expand_variable (name, file, line)
{
if (strcmp (name, CVSROOT_ENV) == 0)
return CVSroot_original;
- else if (strcmp (name, RCSBIN_ENV) == 0)
- return Rcsbin;
+ else if (strcmp (name, "RCSBIN") == 0)
+ {
+ error (0, 0, "RCSBIN internal variable is no longer supported");
+ return NULL;
+ }
else if (strcmp (name, EDITOR1_ENV) == 0)
return Editor;
else if (strcmp (name, EDITOR2_ENV) == 0)
diff --git a/contrib/cvs/src/fileattr.c b/contrib/cvs/src/fileattr.c
index eda7753..a5abea0 100644
--- a/contrib/cvs/src/fileattr.c
+++ b/contrib/cvs/src/fileattr.c
@@ -376,6 +376,86 @@ fileattr_set (filename, attrname, attrval)
attrs_modified = 1;
}
+char *
+fileattr_getall (filename)
+ const char *filename;
+{
+ Node *node;
+ char *p;
+
+ if (attrlist == NULL)
+ fileattr_read ();
+ if (attrlist == NULL)
+ /* Either nothing has any attributes, or fileattr_read already printed
+ an error message. */
+ return NULL;
+
+ if (filename == NULL)
+ p = fileattr_default_attrs;
+ else
+ {
+ node = findnode (attrlist, filename);
+ if (node == NULL)
+ /* A file not mentioned has no attributes. */
+ return NULL;
+ p = node->data;
+ }
+ return xstrdup (p);
+}
+
+void
+fileattr_setall (filename, attrs)
+ const char *filename;
+ const char *attrs;
+{
+ Node *node;
+
+ if (filename == NULL)
+ {
+ if (fileattr_default_attrs != NULL)
+ free (fileattr_default_attrs);
+ fileattr_default_attrs = xstrdup (attrs);
+ attrs_modified = 1;
+ return;
+ }
+ if (attrlist == NULL)
+ fileattr_read ();
+ if (attrlist == NULL)
+ {
+ /* Not sure this is a graceful way to handle things
+ in the case where fileattr_read was unable to read the file. */
+ /* No attributes existed previously. */
+ attrlist = getlist ();
+ }
+
+ node = findnode (attrlist, filename);
+ if (node == NULL)
+ {
+ /* The file had no attributes. Add them if we have any to add. */
+ if (attrs != NULL)
+ {
+ node = getnode ();
+ node->type = FILEATTR;
+ node->delproc = fileattr_delproc;
+ node->key = xstrdup (filename);
+ node->data = xstrdup (attrs);
+ addnode (attrlist, node);
+ }
+ }
+ else
+ {
+ if (attrs == NULL)
+ delnode (node);
+ else
+ {
+ free (node->data);
+ node->data = xstrdup (attrs);
+ }
+ }
+
+ attrs_modified = 1;
+}
+
void
fileattr_newfile (filename)
const char *filename;
@@ -550,6 +630,10 @@ fileattr_write ()
void
fileattr_free ()
{
+ /* Note that attrs_modified will ordinarily be zero, but there are
+ a few cases in which fileattr_write will fail to zero it (if
+ noexec is set, or error conditions). This probably is the way
+ it should be. */
dellist (&attrlist);
if (fileattr_stored_repos != NULL)
free (fileattr_stored_repos);
diff --git a/contrib/cvs/src/fileattr.h b/contrib/cvs/src/fileattr.h
index c6362af..7e02b3a 100644
--- a/contrib/cvs/src/fileattr.h
+++ b/contrib/cvs/src/fileattr.h
@@ -115,6 +115,17 @@ extern char *fileattr_modify PROTO ((char *list, const char *attrname,
extern void fileattr_set PROTO ((const char *filename, const char *attrname,
const char *attrval));
+/* Get all the attributes for file FILENAME. They are returned as malloc'd
+ data in an unspecified format which is guaranteed only to be good for
+ passing to fileattr_setall, or NULL if no attributes. If FILENAME is
+ NULL, get default attributes. */
+extern char *fileattr_getall PROTO ((const char *filename));
+
+/* Set the attributes for file FILENAME to ATTRS, overwriting all previous
+ attributes for that file. ATTRS was obtained from a previous call to
+ fileattr_getall (malloc'd data or NULL). */
+extern void fileattr_setall PROTO ((const char *filename, const char *attrs));
+
/* Set the attributes for file FILENAME in whatever manner is appropriate
for a newly created file. */
extern void fileattr_newfile PROTO ((const char *filename));
diff --git a/contrib/cvs/src/filesubr.c b/contrib/cvs/src/filesubr.c
index 71df566..b5121a7 100644
--- a/contrib/cvs/src/filesubr.c
+++ b/contrib/cvs/src/filesubr.c
@@ -287,7 +287,8 @@ mkdir_if_needed (name)
{
if (mkdir (name, 0777) < 0)
{
- if (errno != EEXIST)
+ if (!(errno == EEXIST
+ || (errno == EACCES && isdir (name))))
error (1, errno, "cannot make directory %s", name);
return 1;
}
@@ -416,13 +417,16 @@ int
unlink_file_dir (f)
const char *f;
{
- if (trace)
+ if (trace
#ifdef SERVER_SUPPORT
- (void) fprintf (stderr, "%c-> unlink_file_dir(%s)\n",
- (server_active) ? 'S' : ' ', f);
-#else
- (void) fprintf (stderr, "-> unlink_file_dir(%s)\n", f);
+ /* This is called by the server parent process in contexts where
+ it is not OK to send output (e.g. after we sent "ok" to the
+ client). */
+ && !server_active
#endif
+ )
+ (void) fprintf (stderr, "-> unlink_file_dir(%s)\n", f);
+
if (noexec)
return (0);
@@ -690,7 +694,26 @@ last_component (path)
/* Return the home directory. Returns a pointer to storage
managed by this function or its callees (currently getenv).
This function will return the same thing every time it is
- called. */
+ called. Returns NULL if there is no home directory.
+
+ Note that for a pserver server, this may return root's home
+ directory. What typically happens is that upon being started from
+ inetd, before switching users, the code in cvsrc.c calls
+ get_homedir which remembers root's home directory in the static
+ variable. Then the switch happens and get_homedir might return a
+ directory that we don't even have read or execute permissions for
+ (which is bad, when various parts of CVS try to read there). One
+ fix would be to make the value returned by get_homedir only good
+ until the next call (which would free the old value). Another fix
+ would be to just always malloc our answer, and let the caller free
+ it (that is best, because some day we may need to be reentrant).
+
+ The workaround is to put -f in inetd.conf which means that
+ get_homedir won't get called until after the switch in user ID.
+
+ The whole concept of a "home directory" on the server is pretty
+ iffy, although I suppose some people probably are relying on it for
+ .cvsrc and such, in the cases where it works. */
char *
get_homedir ()
{
diff --git a/contrib/cvs/src/find_names.c b/contrib/cvs/src/find_names.c
index 5d2a79e..ed6c5c4 100644
--- a/contrib/cvs/src/find_names.c
+++ b/contrib/cvs/src/find_names.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Find Names
*
@@ -200,6 +200,15 @@ Find_Directories (repository, which, entries)
information is not recorded in the Entries file. Find
the subdirectories the hard way, and, if possible, add
it to the Entries file for next time. */
+
+ /* FIXME-maybe: find_dirs is bogus for this usage because
+ it skips CVSATTIC and CVSLCK directories--those names
+ should be special only in the repository. However, in
+ the interests of not perturbing this code, we probably
+ should leave well enough alone unless we want to write
+ a sanity.sh test case (which would operate by manually
+ hacking on the CVS/Entries file). */
+
if (find_dirs (".", dirlist, 1, tmpentries) != 0)
error (1, errno, "cannot open current directory");
if (tmpentries != NULL)
@@ -292,6 +301,16 @@ find_dirs (dir, list, checkadm, entries)
size_t tmp_size = 0;
struct dirent *dp;
DIR *dirp;
+ int skip_emptydir = 0;
+
+ /* First figure out whether we need to skip directories named
+ Emptydir. Except in the CVSNULLREPOS case, Emptydir is just
+ a normal directory name. */
+ if (isabsolute (dir)
+ && strncmp (dir, CVSroot_directory, strlen (CVSroot_directory)) == 0
+ && ISDIRSEP (dir[strlen (CVSroot_directory)])
+ && strcmp (dir + strlen (CVSroot_directory) + 1, CVSROOTADM) == 0)
+ skip_emptydir = 1;
/* set up to read the dir */
if ((dirp = CVS_OPENDIR (dir)) == NULL)
@@ -313,6 +332,10 @@ find_dirs (dir, list, checkadm, entries)
if (entries != NULL && findnode (entries, dp->d_name) != NULL)
continue;
+ if (skip_emptydir
+ && strcmp (dp->d_name, CVSNULLREPOS) == 0)
+ continue;
+
#ifdef DT_DIR
if (dp->d_type != DT_DIR)
{
diff --git a/contrib/cvs/src/hash.c b/contrib/cvs/src/hash.c
index a978d1f..ff3f122 100644
--- a/contrib/cvs/src/hash.c
+++ b/contrib/cvs/src/hash.c
@@ -2,7 +2,7 @@
* Copyright (c) 1992, Brian Berliner and Jeff Polk
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Polk's hash list manager. So cool.
*/
@@ -220,21 +220,23 @@ freenode (p)
}
/*
- * insert item p at end of list "list" (maybe hash it too) if hashing and it
- * already exists, return -1 and don't actually put it in the list
+ * Link item P into list LIST before item MARKER. If P->KEY is non-NULL and
+ * that key is already in the hash table, return -1 without modifying any
+ * parameter.
*
* return 0 on success
*/
int
-addnode (list, p)
+insert_before (list, marker, p)
List *list;
+ Node *marker;
Node *p;
{
- int hashval;
- Node *q;
-
if (p->key != NULL) /* hash it too? */
{
+ int hashval;
+ Node *q;
+
hashval = hashp (p->key);
if (list->hasharray[hashval] == NULL) /* make a header for list? */
{
@@ -257,15 +259,40 @@ addnode (list, p)
q->hashprev = p;
}
- /* put it into the regular list */
- p->prev = list->list->prev;
- p->next = list->list;
- list->list->prev->next = p;
- list->list->prev = p;
+ p->next = marker;
+ p->prev = marker->prev;
+ marker->prev->next = p;
+ marker->prev = p;
return (0);
}
+/*
+ * insert item p at end of list "list" (maybe hash it too) if hashing and it
+ * already exists, return -1 and don't actually put it in the list
+ *
+ * return 0 on success
+ */
+int
+addnode (list, p)
+ List *list;
+ Node *p;
+{
+ return insert_before (list, list->list, p);
+}
+
+/*
+ * Like addnode, but insert p at the front of `list'. This bogosity is
+ * necessary to preserve last-to-first output order for some RCS functions.
+ */
+int
+addnode_at_front (list, p)
+ List *list;
+ Node *p;
+{
+ return insert_before (list, list->list->next, p);
+}
+
/* Look up an entry in hash list table and return a pointer to the
node. Return NULL if not found. Abort with a fatal error for
errors. */
diff --git a/contrib/cvs/src/hash.h b/contrib/cvs/src/hash.h
index a22bc10..d29c757 100644
--- a/contrib/cvs/src/hash.h
+++ b/contrib/cvs/src/hash.h
@@ -2,7 +2,7 @@
* Copyright (c) 1992, Brian Berliner and Jeff Polk
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*/
/*
@@ -47,7 +47,9 @@ List *getlist PROTO((void));
Node *findnode PROTO((List * list, const char *key));
Node *findnode_fn PROTO((List * list, const char *key));
Node *getnode PROTO((void));
+int insert_before PROTO((List * list, Node * marker, Node * p));
int addnode PROTO((List * list, Node * p));
+int addnode_at_front PROTO((List * list, Node * p));
int walklist PROTO((List * list, int (*)(Node *n, void *closure), void *closure));
int list_isempty PROTO ((List *list));
void dellist PROTO((List ** listp));
diff --git a/contrib/cvs/src/history.c b/contrib/cvs/src/history.c
index ae13409..223e5a7 100644
--- a/contrib/cvs/src/history.c
+++ b/contrib/cvs/src/history.c
@@ -230,13 +230,9 @@ static short repos_sort;
static short file_sort;
static short module_sort;
-#ifdef HAVE_RCS5
static short tz_local;
static time_t tz_seconds_east_of_GMT;
static char *tz_name = "+0000";
-#else
-static char tz_name[] = "LT";
-#endif
/* -r, -t, or -b options, malloc'd. These are "" if the option in
question is not specified or is overridden by another option. The
@@ -497,9 +493,6 @@ history (argc, argv)
rec_types = xstrdup (optarg);
break;
case 'z':
-#ifndef HAVE_RCS5
- error (0, 0, "-z not supported with RCS 4");
-#else
tz_local =
(optarg[0] == 'l' || optarg[0] == 'L')
&& (optarg[1] == 't' || optarg[1] == 'T')
@@ -530,7 +523,6 @@ history (argc, argv)
tz_name = optarg;
}
}
-#endif
break;
case '?':
default:
@@ -1431,15 +1423,14 @@ report_hrecs ()
continue;
ty = *(lr->type);
-#ifdef HAVE_RCS5
if (!tz_local)
{
time_t t = lr->date + tz_seconds_east_of_GMT;
tm = gmtime (&t);
}
else
-#endif
- tm = localtime (&(lr->date));
+ tm = localtime (&(lr->date));
+
(void) printf ("%c %02d/%02d %02d:%02d %s %-*s", ty, tm->tm_mon + 1,
tm->tm_mday, tm->tm_hour, tm->tm_min, tz_name,
user_len, lr->user);
diff --git a/contrib/cvs/src/ignore.c b/contrib/cvs/src/ignore.c
index 908b5de..5d7ca61 100644
--- a/contrib/cvs/src/ignore.c
+++ b/contrib/cvs/src/ignore.c
@@ -304,49 +304,54 @@ ign_name (name)
}
}
-/* FIXME: This list of dirs to ignore stuff seems not to be used. */
+/* FIXME: This list of dirs to ignore stuff seems not to be used.
+ Really? send_dirent_proc and update_dirent_proc both call
+ ignore_directory and do_module calls ign_dir_add. No doubt could
+ use some documentation/testsuite work. */
static char **dir_ign_list = NULL;
static int dir_ign_max = 0;
static int dir_ign_current = 0;
-/* add a directory to list of dirs to ignore */
-void ign_dir_add (name)
- char *name;
+/* Add a directory to list of dirs to ignore. */
+void
+ign_dir_add (name)
+ char *name;
{
- /* make sure we've got the space for the entry */
- if (dir_ign_current <= dir_ign_max)
+ /* Make sure we've got the space for the entry. */
+ if (dir_ign_current <= dir_ign_max)
{
- dir_ign_max += IGN_GROW;
- dir_ign_list = (char **) xrealloc ((char *) dir_ign_list, (dir_ign_max+1) * sizeof(char*));
+ dir_ign_max += IGN_GROW;
+ dir_ign_list =
+ (char **) xrealloc (dir_ign_list,
+ (dir_ign_max + 1) * sizeof (char *));
}
- dir_ign_list[dir_ign_current] = name;
+ dir_ign_list[dir_ign_current] = name;
- dir_ign_current += 1 ;
+ dir_ign_current += 1 ;
}
-/* this function returns 1 (true) if the given directory name is part of
- * the list of directories to ignore
- */
+/* Return nonzero if NAME is part of the list of directories to ignore. */
-int ignore_directory (name)
- char *name;
+int
+ignore_directory (name)
+ char *name;
{
- int i;
+ int i;
- if (!dir_ign_list)
- return 0;
+ if (!dir_ign_list)
+ return 0;
- i = dir_ign_current;
- while (i--)
+ i = dir_ign_current;
+ while (i--)
{
- if (strncmp(name, dir_ign_list[i], strlen(dir_ign_list[i])) == 0)
- return 1;
+ if (strncmp (name, dir_ign_list[i], strlen (dir_ign_list[i])) == 0)
+ return 1;
}
- return 0;
+ return 0;
}
/*
diff --git a/contrib/cvs/src/import.c b/contrib/cvs/src/import.c
index 3243a96..0a2af7f 100644
--- a/contrib/cvs/src/import.c
+++ b/contrib/cvs/src/import.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* "import" checks in the vendor release located in the current directory into
* the CVS source repository. The CVS vendor branch support is utilized.
@@ -23,7 +23,6 @@
#define FILE_HOLDER ".#cvsxxx"
static char *get_comment PROTO((char *user));
-static int expand_at_signs PROTO((char *buf, off_t size, FILE *fp));
static int add_rev PROTO((char *message, RCSNode *rcs, char *vfile,
char *vers));
static int add_tags PROTO((RCSNode *rcs, char *vfile, char *vtag, int targc,
@@ -56,6 +55,7 @@ static const char *const import_usage[] =
"\t-b bra\tVendor branch id.\n",
"\t-m msg\tLog message.\n",
"\t-W spec\tWrappers specification line.\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -104,9 +104,9 @@ import (argc, argv)
break;
case 'm':
#ifdef FORCE_USE_EDITOR
- use_editor = TRUE;
+ use_editor = 1;
#else
- use_editor = FALSE;
+ use_editor = 0;
#endif
message = xstrdup(optarg);
break;
@@ -199,6 +199,7 @@ import (argc, argv)
if (msglen == 0 || message[msglen - 1] != '\n')
{
char *nm = xmalloc (msglen + 2);
+ *nm = '\0';
if (message != NULL)
{
(void) strcpy (nm, message);
@@ -467,6 +468,8 @@ process_import_file (message, vfile, vtag, targc, targv)
if (!isfile (attic_name))
{
int retval;
+ char *free_opt = NULL;
+ char *our_opt = keyword_opt;
free (attic_name);
/*
@@ -474,8 +477,42 @@ process_import_file (message, vfile, vtag, targc, targv)
* repository nor in the Attic -- create it anew.
*/
add_log ('N', vfile);
- retval = add_rcs_file (message, rcs, vfile, vhead, vbranch,
- vtag, targc, targv, logfp);
+
+#ifdef SERVER_SUPPORT
+ /* The most reliable information on whether the file is binary
+ is what the client told us. That is because if the client had
+ the wrong idea about binaryness, it corrupted the file, so
+ we might as well believe the client. */
+ if (server_active)
+ {
+ Node *node;
+ List *entries;
+
+ /* Reading all the entries for each file is fairly silly, and
+ probably slow. But I am too lazy at the moment to do
+ anything else. */
+ entries = Entries_Open (0);
+ node = findnode_fn (entries, vfile);
+ if (node != NULL)
+ {
+ Entnode *entdata = (Entnode *) node->data;
+ if (entdata->type == ENT_FILE)
+ {
+ assert (entdata->options[0] == '-'
+ && entdata->options[1] == 'k');
+ our_opt = xstrdup (entdata->options + 2);
+ free_opt = our_opt;
+ }
+ }
+ Entries_Close (entries);
+ }
+#endif
+
+ retval = add_rcs_file (message, rcs, vfile, vhead, our_opt,
+ vbranch, vtag, targc, targv,
+ NULL, 0, logfp);
+ if (free_opt != NULL)
+ free (free_opt);
free (rcs);
return retval;
}
@@ -602,12 +639,14 @@ add_rev (message, rcs, vfile, vers)
/* Before RCS_lock existed, we were directing stdout, as well as
stderr, from the RCS command, to DEVNULL. I wouldn't guess that
was necessary, but I don't know for sure. */
- if (RCS_lock (rcs, vbranch, 1) != 0)
- {
- error (0, errno, "fork failed");
- return (1);
- }
+ /* Earlier versions of this function printed a `fork failed' error
+ when RCS_lock returned an error code. That's not appropriate
+ now that RCS_lock is librarified, but should the error text be
+ preserved? */
+ if (RCS_lock (rcs, vbranch, 1) != 0)
+ return 1;
locked = 1;
+ RCS_rewrite (rcs, NULL, NULL);
}
tocvsPath = wrap_tocvs_process_file (vfile);
if (tocvsPath == NULL)
@@ -632,7 +671,7 @@ add_rev (message, rcs, vfile, vers)
}
}
- status = RCS_checkin (rcs->path, tocvsPath == NULL ? vfile : tocvsPath,
+ status = RCS_checkin (rcs, tocvsPath == NULL ? vfile : tocvsPath,
message, vbranch,
(RCS_FLAGS_QUIET
| (use_file_modtime ? RCS_FLAGS_MODTIME : 0)));
@@ -656,6 +695,7 @@ add_rev (message, rcs, vfile, vers)
if (locked)
{
(void) RCS_unlock(rcs, vbranch, 0);
+ RCS_rewrite (rcs, NULL, NULL);
}
return (1);
}
@@ -693,6 +733,7 @@ add_tags (rcs, vfile, vtag, targc, targv)
"ERROR: Failed to set tag %s in %s", vtag, rcs->path);
return (1);
}
+ RCS_rewrite (rcs, NULL, NULL);
memset (&finfo, 0, sizeof finfo);
finfo.file = vfile;
@@ -705,7 +746,9 @@ add_tags (rcs, vfile, vtag, targc, targv)
vers = Version_TS (&finfo, NULL, vtag, NULL, 1, 0);
for (i = 0; i < targc; i++)
{
- if ((retcode = RCS_settag (rcs, targv[i], vers->vn_rcs)) != 0)
+ if ((retcode = RCS_settag (rcs, targv[i], vers->vn_rcs)) == 0)
+ RCS_rewrite (rcs, NULL, NULL);
+ else
{
ierrno = errno;
fperror (logfp, 0, retcode == -1 ? ierrno : 0,
@@ -879,23 +922,33 @@ get_comment (user)
/* Create a new RCS file from scratch.
This probably should be moved to rcs.c now that it is called from
- places outside import.c. */
+ places outside import.c.
+
+ Return value is 0 for success, or nonzero for failure (in which
+ case an error message will have already been printed). */
int
-add_rcs_file (message, rcs, user, add_vhead, add_vbranch, vtag, targc, targv,
- add_logfp)
- /* Log message for the addition. */
+add_rcs_file (message, rcs, user, add_vhead, key_opt,
+ add_vbranch, vtag, targc, targv,
+ desctext, desclen, add_logfp)
+ /* Log message for the addition. Not used if add_vhead == NULL. */
char *message;
/* Filename of the RCS file to create. */
char *rcs;
/* Filename of the file to serve as the contents of the initial
- revision. */
+ revision. Even if add_vhead is NULL, we use this to determine
+ the modes to give the new RCS file. */
char *user;
/* Revision number of head that we are adding. Normally 1.1 but
could be another revision as long as ADD_VBRANCH is a branch
- from it. */
+ from it. If NULL, then just add an empty file without any
+ revisions (similar to the one created by "rcs -i"). */
char *add_vhead;
+ /* Keyword expansion mode, e.g., "b" for binary. NULL means the
+ default behavior. */
+ char *key_opt;
+
/* Vendor branch to import to, or NULL if none. If non-NULL, then
vtag should also be non-NULL. */
char *add_vbranch;
@@ -903,6 +956,11 @@ add_rcs_file (message, rcs, user, add_vhead, add_vbranch, vtag, targc, targv,
int targc;
char *targv[];
+ /* If non-NULL, description for the file. If NULL, the description
+ will be empty. */
+ char *desctext;
+ size_t desclen;
+
/* Write errors to here as well as via error (), or NULL if we should
use only error (). */
FILE *add_logfp;
@@ -912,20 +970,24 @@ add_rcs_file (message, rcs, user, add_vhead, add_vbranch, vtag, targc, targv,
struct tm *ftm;
time_t now;
char altdate1[MAXDATELEN];
-#ifndef HAVE_RCS5
- char altdate2[MAXDATELEN];
-#endif
char *author;
int i, ierrno, err = 0;
mode_t mode;
char *tocvsPath;
char *userfile;
- char *local_opt = keyword_opt;
+ char *local_opt = key_opt;
char *free_opt = NULL;
if (noexec)
return (0);
+ /* Note that as the code stands now, the -k option overrides any
+ settings in wrappers (whether CVSROOT/cvswrappers, -W, or
+ whatever). Some have suggested this should be the other way
+ around. As far as I know the documentation doesn't say one way
+ or the other. Before making a change of this sort, should think
+ about what is best, document it (in cvs.texinfo and NEWS), &c. */
+
if (local_opt == NULL)
{
if (wrap_name_has (user, WRAP_RCSOPTION))
@@ -936,7 +998,17 @@ add_rcs_file (message, rcs, user, add_vhead, add_vbranch, vtag, targc, targv,
tocvsPath = wrap_tocvs_process_file (user);
userfile = (tocvsPath == NULL ? user : tocvsPath);
- fpuser = CVS_FOPEN (userfile, "r");
+
+ /* Opening in text mode is probably never the right thing for the
+ server (because the protocol encodes text files in a fashion
+ which does not depend on what the client or server OS is, as
+ documented in cvsclient.texi), but as long as the server just
+ runs on unix it is a moot point. */
+ fpuser = CVS_FOPEN (userfile,
+ ((local_opt != NULL && strcmp (local_opt, "b") == 0)
+ ? "rb"
+ : "r")
+ );
if (fpuser == NULL)
{
/* not fatal, continue import */
@@ -954,8 +1026,17 @@ add_rcs_file (message, rcs, user, add_vhead, add_vbranch, vtag, targc, targv,
/*
* putadmin()
*/
- if (fprintf (fprcs, "head %s;\012", add_vhead) < 0)
- goto write_error;
+ if (add_vhead != NULL)
+ {
+ if (fprintf (fprcs, "head %s;\012", add_vhead) < 0)
+ goto write_error;
+ }
+ else
+ {
+ if (fprintf (fprcs, "head ;\012") < 0)
+ goto write_error;
+ }
+
if (add_vbranch != NULL)
{
if (fprintf (fprcs, "branch %s;\012", add_vbranch) < 0)
@@ -1001,125 +1082,125 @@ add_rcs_file (message, rcs, user, add_vhead, add_vbranch, vtag, targc, targv,
if (fprintf (fprcs, "\012") < 0)
goto write_error;
- /*
- * puttree()
- */
+ /* Get information on modtime and mode. */
if (fstat (fileno (fpuser), &sb) < 0)
error (1, errno, "cannot fstat %s", user);
- if (use_file_modtime)
- now = sb.st_mtime;
- else
- (void) time (&now);
-#ifdef HAVE_RCS5
- ftm = gmtime (&now);
-#else
- ftm = localtime (&now);
-#endif
- (void) sprintf (altdate1, DATEFORM,
- ftm->tm_year + (ftm->tm_year < 100 ? 0 : 1900),
- ftm->tm_mon + 1, ftm->tm_mday, ftm->tm_hour,
- ftm->tm_min, ftm->tm_sec);
-#ifdef HAVE_RCS5
-#define altdate2 altdate1
-#else
- /*
- * If you don't have RCS V5 or later, you need to lie about the ci
- * time, since RCS V4 and earlier insist that the times differ.
- */
- now++;
- ftm = localtime (&now);
- (void) sprintf (altdate2, DATEFORM,
- ftm->tm_year + (ftm->tm_year < 100 ? 0 : 1900),
- ftm->tm_mon + 1, ftm->tm_mday, ftm->tm_hour,
- ftm->tm_min, ftm->tm_sec);
-#endif
- author = getcaller ();
- if (fprintf (fprcs, "\012%s\012", add_vhead) < 0 ||
+ /* Write the revision(s), with the date and author and so on
+ (that is "delta" rather than "deltatext" from rcsfile(5)). */
+ if (add_vhead != NULL)
+ {
+ if (use_file_modtime)
+ now = sb.st_mtime;
+ else
+ (void) time (&now);
+ ftm = gmtime (&now);
+ (void) sprintf (altdate1, DATEFORM,
+ ftm->tm_year + (ftm->tm_year < 100 ? 0 : 1900),
+ ftm->tm_mon + 1, ftm->tm_mday, ftm->tm_hour,
+ ftm->tm_min, ftm->tm_sec);
+ author = getcaller ();
+
+ if (fprintf (fprcs, "\012%s\012", add_vhead) < 0 ||
fprintf (fprcs, "date %s; author %s; state Exp;\012",
altdate1, author) < 0)
goto write_error;
- if (fprintf (fprcs, "branches") < 0)
- goto write_error;
- if (add_vbranch != NULL)
- {
- if (fprintf (fprcs, " %s.1", add_vbranch) < 0)
+ if (fprintf (fprcs, "branches") < 0)
+ goto write_error;
+ if (add_vbranch != NULL)
+ {
+ if (fprintf (fprcs, " %s.1", add_vbranch) < 0)
+ goto write_error;
+ }
+ if (fprintf (fprcs, ";\012") < 0)
goto write_error;
- }
- if (fprintf (fprcs, ";\012") < 0)
- goto write_error;
- if (fprintf (fprcs, "next ;\012") < 0)
- goto write_error;
- if (add_vbranch != NULL)
- {
- if (fprintf (fprcs, "\012%s.1\012", add_vbranch) < 0 ||
- fprintf (fprcs, "date %s; author %s; state Exp;\012",
- altdate2, author) < 0 ||
- fprintf (fprcs, "branches ;\012") < 0 ||
- fprintf (fprcs, "next ;\012\012") < 0)
+ if (fprintf (fprcs, "next ;\012") < 0)
goto write_error;
+ if (add_vbranch != NULL)
+ {
+ if (fprintf (fprcs, "\012%s.1\012", add_vbranch) < 0 ||
+ fprintf (fprcs, "date %s; author %s; state Exp;\012",
+ altdate1, author) < 0 ||
+ fprintf (fprcs, "branches ;\012") < 0 ||
+ fprintf (fprcs, "next ;\012\012") < 0)
+ goto write_error;
+ }
}
- if (
- /*
- * putdesc()
- */
- fprintf (fprcs, "\012desc\012") < 0 ||
- fprintf (fprcs, "@@\012\012\012") < 0 ||
- /*
- * putdelta()
- */
- fprintf (fprcs, "\012%s\012", add_vhead) < 0 ||
- fprintf (fprcs, "log\012@") < 0)
+
+ /* Now write the description (possibly empty). */
+ if (fprintf (fprcs, "\012desc\012") < 0 ||
+ fprintf (fprcs, "@") < 0)
goto write_error;
- if (add_vbranch != NULL)
- {
- /* We are going to put the log message in the revision on the
- branch. So putting it here too seems kind of redundant, I
- guess (and that is what CVS has always done, anyway). */
- if (fprintf (fprcs, "Initial revision\012") < 0)
- goto write_error;
- }
- else
+ if (desctext != NULL)
{
- if (expand_at_signs (message, (off_t) strlen (message), fprcs) < 0)
+ /* The use of off_t not size_t for the second argument is very
+ strange, since we are dealing with something which definitely
+ fits in memory. */
+ if (expand_at_signs (desctext, (off_t) desclen, fprcs) < 0)
goto write_error;
}
- if (fprintf (fprcs, "@\012") < 0 ||
- fprintf (fprcs, "text\012@") < 0)
- {
+ if (fprintf (fprcs, "@\012\012\012") < 0)
goto write_error;
- }
- /* Now copy over the contents of the file, expanding at signs. */
+ /* Now write the log messages and contents for the revision(s) (that
+ is, "deltatext" rather than "delta" from rcsfile(5)). */
+ if (add_vhead != NULL)
{
- char buf[8192];
- unsigned int len;
+ if (fprintf (fprcs, "\012%s\012", add_vhead) < 0 ||
+ fprintf (fprcs, "log\012@") < 0)
+ goto write_error;
+ if (add_vbranch != NULL)
+ {
+ /* We are going to put the log message in the revision on the
+ branch. So putting it here too seems kind of redundant, I
+ guess (and that is what CVS has always done, anyway). */
+ if (fprintf (fprcs, "Initial revision\012") < 0)
+ goto write_error;
+ }
+ else
+ {
+ if (expand_at_signs (message, (off_t) strlen (message), fprcs) < 0)
+ goto write_error;
+ }
+ if (fprintf (fprcs, "@\012") < 0 ||
+ fprintf (fprcs, "text\012@") < 0)
+ {
+ goto write_error;
+ }
- while (1)
+ /* Now copy over the contents of the file, expanding at signs. */
{
- len = fread (buf, 1, sizeof buf, fpuser);
- if (len == 0)
+ char buf[8192];
+ unsigned int len;
+
+ while (1)
{
- if (ferror (fpuser))
- error (1, errno, "cannot read file %s for copying", user);
- break;
+ len = fread (buf, 1, sizeof buf, fpuser);
+ if (len == 0)
+ {
+ if (ferror (fpuser))
+ error (1, errno, "cannot read file %s for copying",
+ user);
+ break;
+ }
+ if (expand_at_signs (buf, len, fprcs) < 0)
+ goto write_error;
}
- if (expand_at_signs (buf, len, fprcs) < 0)
- goto write_error;
}
- }
- if (fprintf (fprcs, "@\012\012") < 0)
- goto write_error;
- if (add_vbranch != NULL)
- {
- if (fprintf (fprcs, "\012%s.1\012", add_vbranch) < 0 ||
- fprintf (fprcs, "log\012@") < 0 ||
- expand_at_signs (message, (off_t) strlen (message), fprcs) < 0 ||
- fprintf (fprcs, "@\012text\012") < 0 ||
- fprintf (fprcs, "@@\012") < 0)
+ if (fprintf (fprcs, "@\012\012") < 0)
goto write_error;
+ if (add_vbranch != NULL)
+ {
+ if (fprintf (fprcs, "\012%s.1\012", add_vbranch) < 0 ||
+ fprintf (fprcs, "log\012@") < 0 ||
+ expand_at_signs (message,
+ (off_t) strlen (message), fprcs) < 0 ||
+ fprintf (fprcs, "@\012text\012") < 0 ||
+ fprintf (fprcs, "@@\012") < 0)
+ goto write_error;
+ }
}
if (fclose (fprcs) == EOF)
@@ -1184,7 +1265,7 @@ read_error:
* signs. If an error occurs, return a negative value and set errno
* to indicate the error. If not, return a nonnegative value.
*/
-static int
+int
expand_at_signs (buf, size, fp)
char *buf;
off_t size;
diff --git a/contrib/cvs/src/lock.c b/contrib/cvs/src/lock.c
index babadef..be2dd1c 100644
--- a/contrib/cvs/src/lock.c
+++ b/contrib/cvs/src/lock.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Set Lock
*
@@ -39,9 +39,9 @@
be.
* Readlocks ensure that we won't find the file in the state in
- which it is in between the "rcs -i" and the RCS_checkin in commit.c
- (when a file is being added). This state is a state in which the
- RCS file parsing routines in rcs.c cannot parse the file.
+ which it is in between the calls to add_rcs_file and RCS_checkin in
+ commit.c (when a file is being added). This state is a state in
+ which the RCS file parsing routines in rcs.c cannot parse the file.
* Readlocks ensure that a reader won't try to look at a
half-written fileattr file (fileattr is not updated atomically).
diff --git a/contrib/cvs/src/log.c b/contrib/cvs/src/log.c
index 3fd37d4..4502e26 100644
--- a/contrib/cvs/src/log.c
+++ b/contrib/cvs/src/log.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Print Log Information
*
@@ -148,6 +148,7 @@ static const char *const log_usage[] =
"\t-d dates\tSpecify dates (D1<D2 for range, D for latest before).\n",
"\t-s states\tOnly list revisions with specified states.\n",
"\t-w[logins]\tOnly list revisions checked in by specified logins.\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -469,6 +470,20 @@ log_parse_list (plist, argstring)
}
}
+static int printlock_proc PROTO ((Node *, void *));
+
+static int
+printlock_proc (lock, foo)
+ Node *lock;
+ void *foo;
+{
+ cvs_output ("\n\t", 2);
+ cvs_output (lock->data, 0);
+ cvs_output (": ", 2);
+ cvs_output (lock->key, 0);
+ return 0;
+}
+
/*
* Do an rlog on a file
*/
@@ -493,7 +508,7 @@ log_fileproc (callerdat, finfo)
Entnode *e;
e = (Entnode *) p->data;
- if (e->version[0] == '0' || e->version[1] == '\0')
+ if (e->version[0] == '0' && e->version[1] == '\0')
{
if (!really_quiet)
error (0, 0, "%s has been added, but not committed",
@@ -560,98 +575,18 @@ log_fileproc (callerdat, finfo)
}
cvs_output ("\nlocks:", 0);
- if (rcsfile->other != NULL)
- {
- p = findnode (rcsfile->other, "strict");
- if (p != NULL)
- cvs_output (" strict", 0);
- p = findnode (rcsfile->other, "locks");
- if (p != NULL && p->data != NULL)
- {
- char *f, *cp;
-
- f = xstrdup (p->data);
- cp = f;
- while (*cp != '\0')
- {
- char *cp2, *locker, *version;
- RCSVers *vnode;
-
- locker = cp;
-
- cp2 = strchr (cp, ':');
- if (cp2 == NULL)
- {
- error (0, 0, "warning: bad locks field in RCS file `%s'",
- finfo->fullname);
- break;
- }
-
- *cp2 = '\0';
-
- cvs_output ("\n\t", 2);
- cvs_output (cp, cp2 - cp);
- cvs_output (": ", 2);
-
- cp = cp2 + 1;
- while (isspace (*cp) && *cp != '\0')
- ++cp;
-
- version = cp;
-
- cp2 = cp;
- while (! isspace (*cp2) && *cp2 != '\0')
- ++cp2;
-
- cvs_output (cp, cp2 - cp);
-
- if (*cp2 == '\0')
- cp = cp2;
- else
- {
- *cp2 = '\0';
- cp = cp2 + 1;
- while (isspace (*cp) && *cp != '\0')
- ++cp;
- }
-
- p = findnode (rcsfile->versions, version);
- if (p == NULL)
- error (0, 0,
- "warning: lock for missing version `%s' in `%s'",
- version, finfo->fullname);
- else
- {
- vnode = (RCSVers *) p->data;
- p = getnode ();
- p->type = RCSFIELD;
- p->key = xstrdup (";locker");
- p->data = xstrdup (locker);
- if (addnode (vnode->other, p) != 0)
- {
- error (0, 0,
- "warning: duplicate lock for `%s' in `%s'",
- version, finfo->fullname);
- freenode (p);
- }
- }
- }
-
- free (f);
- }
- }
+ if (rcsfile->strict_locks)
+ cvs_output (" strict", 0);
+ walklist (RCS_getlocks (rcsfile), printlock_proc, NULL);
cvs_output ("\naccess list:", 0);
- if (rcsfile->other != NULL)
+ if (rcsfile->access != NULL)
{
- p = findnode (rcsfile->other, "access");
- if (p != NULL && p->data != NULL)
- {
- const char *cp;
+ const char *cp;
- cp = p->data;
- while (*cp != '\0')
- {
+ cp = rcsfile->access;
+ while (*cp != '\0')
+ {
const char *cp2;
cvs_output ("\n\t", 2);
@@ -662,7 +597,6 @@ log_fileproc (callerdat, finfo)
cp = cp2;
while (isspace (*cp) && *cp != '\0')
++cp;
- }
}
}
@@ -712,12 +646,8 @@ log_fileproc (callerdat, finfo)
if (! log_data->header || log_data->long_header)
{
cvs_output ("description:\n", 0);
- if (rcsfile->other != NULL)
- {
- p = findnode (rcsfile->other, "desc");
- if (p != NULL && p->data != NULL)
- cvs_output (p->data, 0);
- }
+ if (rcsfile->desc != NULL)
+ cvs_output (rcsfile->desc, 0);
}
if (! log_data->header && ! log_data->long_header && rcsfile->head != NULL)
@@ -1276,7 +1206,7 @@ log_version (log_data, revlist, rcs, ver, trunk)
cvs_output ("----------------------------\nrevision ", 0);
cvs_output (ver->version, 0);
- p = findnode (ver->other, ";locker");
+ p = findnode (RCS_getlocks (rcs), ver->version);
if (p != NULL)
{
cvs_output ("\tlocked by: ", 0);
@@ -1341,7 +1271,14 @@ log_version (log_data, revlist, rcs, ver, trunk)
cvs_output ("\n", 1);
p = findnode (ver->other, "log");
- if (p == NULL || p->data[0] == '\0')
+ /* The p->date == NULL case is the normal one for an empty log
+ message (rcs-14 in sanity.sh). I don't think the case where
+ p->data is "" can happen (getrcskey in rcs.c checks for an
+ empty string and set the value to NULL in that case). My guess
+ would be the p == NULL case would mean an RCS file which was
+ missing the "log" keyword (which is illegal according to
+ rcsfile.5). */
+ if (p == NULL || p->data == NULL || p->data[0] == '\0')
cvs_output ("*** empty log message ***\n", 0);
else
{
diff --git a/contrib/cvs/src/login.c b/contrib/cvs/src/login.c
index cc277a6..4ffce36 100644
--- a/contrib/cvs/src/login.c
+++ b/contrib/cvs/src/login.c
@@ -75,6 +75,7 @@ construct_cvspass_filename ()
static const char *const login_usage[] =
{
"Usage: %s %s\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -112,6 +113,7 @@ login (argc, argv)
char *linebuf = (char *) NULL;
size_t linebuf_len;
int root_len, already_entered = 0;
+ int line_length;
if (argc < 0)
usage (login_usage);
@@ -121,7 +123,7 @@ login (argc, argv)
error (0, 0, "can only use pserver method with `login' command");
error (1, 0, "CVSROOT: %s", CVSroot_original);
}
-
+
if (! CVSroot_username)
{
error (0, 0, "CVSROOT \"%s\" is not fully-qualified.",
@@ -143,11 +145,7 @@ login (argc, argv)
cvs_password = xstrdup (typed_password);
- if (connect_to_pserver (NULL, NULL, 1) == 0)
- {
- /* The password is wrong, according to the server. */
- error (1, 0, "incorrect password");
- }
+ connect_to_pserver (NULL, NULL, 1, 0);
/* IF we have a password for this "[user@]host:/path" already
* THEN
@@ -171,7 +169,7 @@ login (argc, argv)
if (fp != NULL)
{
/* Check each line to see if we have this entry already. */
- while (getline (&linebuf, &linebuf_len, fp) >= 0)
+ while ((line_length = getline (&linebuf, &linebuf_len, fp)) >= 0)
{
if (strncmp (CVSroot_original, linebuf, root_len) == 0)
{
@@ -179,8 +177,11 @@ login (argc, argv)
break;
}
}
- fclose (fp);
+ if (fclose (fp) < 0)
+ error (0, errno, "cannot close %s", passfile);
}
+ else if (!existence_error (errno))
+ error (0, errno, "cannot open %s", passfile);
if (already_entered)
{
@@ -219,22 +220,35 @@ login (argc, argv)
/* I'm not paranoid, they really ARE out to get me: */
chmod (passfile, 0600);
- while (getline (&linebuf, &linebuf_len, fp) >= 0)
+ while ((line_length = getline (&linebuf, &linebuf_len, fp)) >= 0)
{
if (strncmp (CVSroot_original, linebuf, root_len))
- fprintf (tmp_fp, "%s", linebuf);
+ {
+ if (fprintf (tmp_fp, "%s", linebuf) == EOF)
+ error (0, errno, "cannot write %s", tmp_name);
+ }
else
- fprintf (tmp_fp, "%s %s\n", CVSroot_original,
- typed_password);
-
+ {
+ if (fprintf (tmp_fp, "%s %s\n", CVSroot_original,
+ typed_password) == EOF)
+ error (0, errno, "cannot write %s", tmp_name);
+ }
}
+ if (line_length < 0 && !feof (fp))
+ error (0, errno, "cannot read %s", passfile);
if (linebuf)
free (linebuf);
- fclose (tmp_fp);
- fclose (fp);
+ if (fclose (tmp_fp) < 0)
+ error (0, errno, "cannot close %s", tmp_name);
+ if (fclose (fp) < 0)
+ error (0, errno, "cannot close %s", passfile);
+
+ /* FIXME: rename_file would make more sense (e.g. almost
+ always faster). */
copy_file (tmp_name, passfile);
unlink_file (tmp_name);
chmod (passfile, 0600);
+
free (tmp_name);
}
}
@@ -249,8 +263,10 @@ login (argc, argv)
return 1;
}
- fprintf (fp, "%s %s\n", CVSroot_original, typed_password);
- fclose (fp);
+ if (fprintf (fp, "%s %s\n", CVSroot_original, typed_password) == EOF)
+ error (0, errno, "cannot write %s", passfile);
+ if (fclose (fp) < 0)
+ error (0, errno, "cannot close %s", passfile);
}
/* Utter, total, raving paranoia, I know. */
@@ -276,6 +292,7 @@ get_cvs_password ()
size_t linebuf_len;
FILE *fp;
char *passfile;
+ int line_length;
/* If someone (i.e., login()) is calling connect_to_pserver() out of
context, then assume they have supplied the correct, scrambled
@@ -324,7 +341,7 @@ get_cvs_password ()
root_len = strlen (CVSroot_original);
/* Check each line to see if we have this entry already. */
- while (getline (&linebuf, &linebuf_len, fp) >= 0)
+ while ((line_length = getline (&linebuf, &linebuf_len, fp)) >= 0)
{
if (strncmp (CVSroot_original, linebuf, root_len) == 0)
{
@@ -333,6 +350,10 @@ get_cvs_password ()
break;
}
}
+ if (line_length < 0 && !feof (fp))
+ error (0, errno, "cannot read %s", passfile);
+ if (fclose (fp) < 0)
+ error (0, errno, "cannot close %s", passfile);
if (found_it)
{
@@ -362,6 +383,7 @@ get_cvs_password ()
static const char *const logout_usage[] =
{
"Usage: %s %s\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -378,6 +400,7 @@ logout (argc, argv)
char *linebuf = (char *) NULL;
size_t linebuf_len;
int root_len, found = 0;
+ int line_length;
if (argc < 0)
usage (logout_usage);
@@ -430,17 +453,25 @@ logout (argc, argv)
/* Check each line to see if we have this entry. */
/* Copy only those lines that do not match this entry */
- while (getline (&linebuf, &linebuf_len, fp) >= 0)
+ while ((line_length = getline (&linebuf, &linebuf_len, fp)) >= 0)
{
- if (strncmp (CVSroot_original, linebuf, root_len))
- fprintf (tmp_fp, "%s", linebuf);
+ if (strncmp (CVSroot_original, linebuf, root_len))
+ {
+ if (fprintf (tmp_fp, "%s", linebuf) == EOF)
+ error (0, errno, "cannot write %s", tmp_name);
+ }
else
- found = TRUE;
+ found = 1;
}
+ if (line_length < 0 && !feof (fp))
+ error (0, errno, "cannot read %s", passfile);
+
if (linebuf)
free (linebuf);
- fclose (fp);
- fclose (tmp_fp);
+ if (fclose (fp) < 0)
+ error (0, errno, "cannot close %s", passfile);
+ if (fclose (tmp_fp) < 0)
+ error (0, errno, "cannot close %s", tmp_name);
if (! found)
{
@@ -449,6 +480,8 @@ logout (argc, argv)
}
else
{
+ /* FIXME: rename_file would make more sense (e.g. almost
+ always faster). */
copy_file (tmp_name, passfile);
unlink_file (tmp_name);
chmod (passfile, 0600);
diff --git a/contrib/cvs/src/logmsg.c b/contrib/cvs/src/logmsg.c
index 2655fd9..67194be 100644
--- a/contrib/cvs/src/logmsg.c
+++ b/contrib/cvs/src/logmsg.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*/
#include "cvs.h"
@@ -282,7 +282,7 @@ do_editor (dir, messagep, repository, changes)
(void) Parse_Info (CVSROOTADM_EDITINFO, repository, editinfo_proc, 0);
/* run the editor */
- run_setup ("%s", editinfo_editor ? editinfo_editor : Editor);
+ run_setup (editinfo_editor ? editinfo_editor : Editor);
run_arg (fname);
if ((retcode = run_exec (RUN_TTY, RUN_TTY, RUN_TTY,
RUN_NORMAL | RUN_SIGIGNORE)) != 0)
@@ -345,8 +345,16 @@ do_editor (dir, messagep, repository, changes)
(void) printf ("Action: (continue) ");
(void) fflush (stdout);
line_length = getline (&line, &line_chars_allocated, stdin);
- if (line_length <= 0
- || *line == '\n' || *line == 'c' || *line == 'C')
+ if (line_length < 0)
+ {
+ error (0, errno, "cannot read from stdin");
+ if (unlink_file (fname) < 0)
+ error (0, errno,
+ "warning: cannot remove temp file %s", fname);
+ error (1, 0, "aborting");
+ }
+ else if (line_length == 0
+ || *line == '\n' || *line == 'c' || *line == 'C')
break;
if (*line == 'a' || *line == 'A')
{
@@ -411,10 +419,7 @@ do_verify (message, repository)
fp = fopen (fname, "w");
if (fp == NULL)
- {
error (1, errno, "cannot create temporary file %s", fname);
- return;
- }
else
{
fprintf (fp, "%s", message);
@@ -434,15 +439,21 @@ do_verify (message, repository)
if (verifymsg_script)
{
- run_setup ("%s", verifymsg_script);
+ run_setup (verifymsg_script);
run_arg (fname);
if ((retcode = run_exec (RUN_TTY, RUN_TTY, RUN_TTY,
RUN_NORMAL | RUN_SIGIGNORE)) != 0)
+ {
+ /* Since following error() exits, delete the temp file
+ now. */
+ unlink_file (fname);
+
error (1, retcode == -1 ? errno : 0,
"Message verification failed");
+ }
}
- /* Close and delete the temp file */
+ /* Delete the temp file */
unlink_file (fname);
free (fname);
diff --git a/contrib/cvs/src/main.c b/contrib/cvs/src/main.c
index 3352f60..2397d7e 100644
--- a/contrib/cvs/src/main.c
+++ b/contrib/cvs/src/main.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License
- * as specified in the README file that comes with the CVS 1.4 kit.
+ * as specified in the README file that comes with the CVS source distribution.
*
* This is the main C driver for the CVS system.
*
@@ -33,14 +33,14 @@ char *command_name;
char hostname[MAXHOSTNAMELEN];
-int use_editor = TRUE;
-int use_cvsrc = TRUE;
+int use_editor = 1;
+int use_cvsrc = 1;
int cvswrite = !CVSREAD_DFLT;
-int really_quiet = FALSE;
-int quiet = FALSE;
-int trace = FALSE;
-int noexec = FALSE;
-int logoff = FALSE;
+int really_quiet = 0;
+int quiet = 0;
+int trace = 0;
+int noexec = 0;
+int logoff = 0;
mode_t cvsumask = UMASK_DFLT;
char *CurDir;
@@ -48,7 +48,6 @@ char *CurDir;
/*
* Defaults, for the environment variables that are not set
*/
-char *Rcsbin = RCSBIN_DFLT;
char *Tmpdir = TMPDIR_DFLT;
char *Editor = EDITOR_DFLT;
@@ -124,32 +123,47 @@ static const struct cmd
static const char *const usg[] =
{
- "Usage: %s [cvs-options] command [command-options] [files...]\n",
- " Where 'cvs-options' are:\n",
- " -H Displays Usage information for command\n",
- " -Q Cause CVS to be really quiet.\n",
- " -q Cause CVS to be somewhat quiet.\n",
- " -r Make checked-out files read-only\n",
- " -w Make checked-out files read-write (default)\n",
- " -l Turn History logging off\n",
- " -n Do not execute anything that will change the disk\n",
- " -t Show trace of program execution -- Try with -n\n",
- " -v CVS version and copyright\n",
- " -b bindir Find RCS programs in 'bindir'\n",
- " -T tmpdir Use 'tmpdir' for temporary files\n",
- " -e editor Use 'editor' for editing log information\n",
- " -d CVS_root Overrides $CVSROOT as the root of the CVS tree\n",
- " -f Do not use the ~/.cvsrc file\n",
-#ifdef CLIENT_SUPPORT
- " -z # Use compression level '#' for net traffic.\n",
-#ifdef ENCRYPTION
- " -x Encrypt all net traffic.\n",
-#endif
-#endif
- " -s VAR=VAL Set CVS user variable.\n",
+ /* CVS usage messages never have followed the GNU convention of
+ putting metavariables in uppercase. I don't know whether that
+ is a good convention or not, but if it changes it would have to
+ change in all the usage messages. For now, they consistently
+ use lowercase, as far as I know. Puncutation is pretty funky,
+ though. Sometimes they use none, as here. Sometimes they use
+ single quotes (not the TeX-ish `' stuff), as in --help-options.
+ Sometimes they use double quotes, as in cvs -H add.
+
+ Most (not all) of the usage messages seem to have periods at
+ the end of each line. I haven't tried to duplicate this style
+ in --help as it is a rather different format from the rest. */
+
+ "Usage: %s [cvs-options] command [command-options-and-arguments]\n",
+ " where cvs-options are -q, -n, etc.\n",
+ " (specify --help-options for a list of options)\n",
+ " where command is add, admin, etc.\n",
+ " (specify --help-commands for a list of commands\n",
+ " or --help-synonyms for a list of command synonyms)\n",
+ " where command-options-and-arguments depend on the specific command\n",
+ " (specify -H followed by a command name for command-specific help)\n",
+ " Specify --help to receive this message\n",
"\n",
- " and where 'command' is: add, admin, etc. (use the --help-commands\n",
- " option for a list of commands)\n",
+
+ /* Some people think that a bug-reporting address should go here. IMHO,
+ the web sites are better because anything else is very likely to go
+ obsolete in the years between a release and when someone might be
+ reading this help. Besides, we could never adequately discuss
+ bug reporting in a concise enough way to put in a help message. */
+
+ /* I was going to put this at the top, but usage() wants the %s to
+ be in the first line. */
+ "The Concurrent Versions System (CVS) is a tool for version control.\n",
+ /* I really don't think I want to try to define "version control"
+ in one line. I'm not sure one can get more concise than the
+ paragraph in ../cvs.spec without assuming the reader knows what
+ version control means. */
+
+ "For CVS updates and additional information, see\n",
+ " Cyclic Software at http://www.cyclic.com/ or\n",
+ " Pascal Molli's CVS site at http://www.loria.fr/~molli/cvs-index.html\n",
NULL,
};
@@ -183,17 +197,47 @@ static const char *const cmd_usage[] =
" update Bring work tree in sync with repository\n",
" watch Set watches\n",
" watchers See who is watching a file\n",
- "(Use the --help-synonyms option for a list of alternate command names)\n",
+ "(Specify the --help option for a list of other help options)\n",
NULL,
};
+static const char *const opt_usage[] =
+{
+ "CVS global options (specified before the command name) are:\n",
+ " -H Displays usage information for command.\n",
+ " -Q Cause CVS to be really quiet.\n",
+ " -q Cause CVS to be somewhat quiet.\n",
+ " -r Make checked-out files read-only.\n",
+ " -w Make checked-out files read-write (default).\n",
+ " -l Turn history logging off.\n",
+ " -n Do not execute anything that will change the disk.\n",
+ " -t Show trace of program execution -- try with -n.\n",
+ " -v CVS version and copyright.\n",
+ " -b bindir Find RCS programs in 'bindir'.\n",
+ " -T tmpdir Use 'tmpdir' for temporary files.\n",
+ " -e editor Use 'editor' for editing log information.\n",
+ " -d CVS_root Overrides $CVSROOT as the root of the CVS tree.\n",
+ " -f Do not use the ~/.cvsrc file.\n",
+#ifdef CLIENT_SUPPORT
+ " -z # Use compression level '#' for net traffic.\n",
+#ifdef ENCRYPTION
+ " -x Encrypt all net traffic.\n",
+#endif
+ " -a Authenticate all net traffic.\n",
+#endif
+ " -s VAR=VAL Set CVS user variable.\n",
+ "(Specify the --help option for a list of other help options)\n",
+ NULL
+};
+
static const char * const*
cmd_synonyms ()
{
char ** synonyms;
char ** line;
const struct cmd *c = &cmds[0];
- int numcmds = 2; /* two more for title and end */
+ /* Three more for title, "specify --help" line, and NULL. */
+ int numcmds = 3;
while (c->fullname != NULL)
{
@@ -218,6 +262,7 @@ cmd_synonyms ()
line++;
}
}
+ *line++ = "(Specify the --help option for a list of other help options)\n";
*line = NULL;
return (const char * const*) synonyms; /* will never be freed */
@@ -328,11 +373,10 @@ main (argc, argv)
char *cp, *end;
const struct cmd *cm;
int c, err = 0;
- int rcsbin_update_env, tmpdir_update_env, cvs_update_env;
+ int tmpdir_update_env, cvs_update_env;
int free_CVSroot = 0;
int free_Editor = 0;
int free_Tmpdir = 0;
- int free_Rcsbin = 0;
int help = 0; /* Has the user asked for help? This
lets us support the `cvs -H cmd'
@@ -343,6 +387,7 @@ main (argc, argv)
{"version", 0, NULL, 'v'},
{"help-commands", 0, NULL, 1},
{"help-synonyms", 0, NULL, 2},
+ {"help-options", 0, NULL, 4},
{"allow-root", required_argument, NULL, 3},
{0, 0, 0, 0}
};
@@ -380,12 +425,6 @@ main (argc, argv)
* they can be overridden by command line arguments
*/
cvs_update_env = 0;
- rcsbin_update_env = *Rcsbin; /* RCSBIN_DFLT must be set */
- if ((cp = getenv (RCSBIN_ENV)) != NULL)
- {
- Rcsbin = cp;
- rcsbin_update_env = 0; /* it's already there */
- }
tmpdir_update_env = *Tmpdir; /* TMPDIR_DFLT must be set */
if ((cp = getenv (TMPDIR_ENV)) != NULL)
{
@@ -404,7 +443,7 @@ main (argc, argv)
cvs_update_env = 0; /* it's already there */
}
if (getenv (CVSREAD_ENV) != NULL)
- cvswrite = FALSE;
+ cvswrite = 0;
/* Set this to 0 to force getopt initialization. getopt() sets
this to 1 internally. */
@@ -421,7 +460,7 @@ main (argc, argv)
!= EOF)
{
if (c == 'f')
- use_cvsrc = FALSE;
+ use_cvsrc = 0;
}
/*
@@ -434,7 +473,7 @@ main (argc, argv)
opterr = 1;
while ((c = getopt_long
- (argc, argv, "+Qqrwtnlvb:T:e:d:Hfz:s:x", long_options, &option_index))
+ (argc, argv, "+Qqrwtnlvb:T:e:d:Hfz:s:xa", long_options, &option_index))
!= EOF)
{
switch (c)
@@ -447,47 +486,59 @@ main (argc, argv)
/* --help-synonyms */
usage (cmd_synonyms());
break;
+ case 4:
+ /* --help-options */
+ usage (opt_usage);
+ break;
case 3:
/* --allow-root */
root_allow_add (optarg);
break;
case 'Q':
- really_quiet = TRUE;
+ really_quiet = 1;
/* FALL THROUGH */
case 'q':
- quiet = TRUE;
+ quiet = 1;
break;
case 'r':
- cvswrite = FALSE;
+ cvswrite = 0;
break;
case 'w':
- cvswrite = TRUE;
+ cvswrite = 1;
break;
case 't':
- trace = TRUE;
+ trace = 1;
break;
case 'n':
- noexec = TRUE;
+ noexec = 1;
case 'l': /* Fall through */
- logoff = TRUE;
+ logoff = 1;
break;
case 'v':
+ /* Having the year here is a good idea, so people have
+ some idea of how long ago their version of CVS was
+ released. */
(void) fputs (version_string, stdout);
(void) fputs (config_string, stdout);
(void) fputs ("\n", stdout);
- (void) fputs ("Copyright (c) 1993-1994 Brian Berliner\n", stdout);
- (void) fputs ("Copyright (c) 1993-1994 david d `zoo' zuhn\n", stdout);
- (void) fputs ("Copyright (c) 1992, Brian Berliner and Jeff Polk\n", stdout);
- (void) fputs ("Copyright (c) 1989-1992, Brian Berliner\n", stdout);
+ (void) fputs ("\
+Copyright (c) 1989-1997 Brian Berliner, david d `zoo' zuhn, \n\
+ Jeff Polk, and other authors\n", stdout);
(void) fputs ("\n", stdout);
(void) fputs ("CVS may be copied only under the terms of the GNU General Public License,\n", stdout);
(void) fputs ("a copy of which can be found with the CVS distribution kit.\n", stdout);
+ (void) fputs ("\n", stdout);
+
+ (void) fputs ("Specify the --help option for further information about CVS\n", stdout);
+
exit (0);
break;
case 'b':
- Rcsbin = xstrdup (optarg);
- free_Rcsbin = 1;
- rcsbin_update_env = 1; /* need to update environment */
+ /* This option used to specify the directory for RCS
+ executables. But since we don't run them any more,
+ this is a noop. Silently ignore it so that .cvsrc
+ and scripts and inetd.conf and such can work with
+ either new or old CVS. */
break;
case 'T':
Tmpdir = xstrdup (optarg);
@@ -507,7 +558,7 @@ main (argc, argv)
help = 1;
break;
case 'f':
- use_cvsrc = FALSE; /* unnecessary, since we've done it above */
+ use_cvsrc = 0; /* unnecessary, since we've done it above */
break;
case 'z':
#ifdef CLIENT_SUPPORT
@@ -532,6 +583,15 @@ main (argc, argv)
If no ENCRYPTION, we still accept -x, but issue an
error if we are being run as a client. */
break;
+ case 'a':
+#ifdef CLIENT_SUPPORT
+ cvsauthenticate = 1;
+#endif
+ /* If no CLIENT_SUPPORT, ignore -a, so that users can
+ have it in their .cvsrc and not cause any trouble.
+ We will issue an error later if stream
+ authentication is not supported. */
+ break;
case '?':
default:
usage (usg);
@@ -562,6 +622,9 @@ main (argc, argv)
else
command_name = cm->fullname; /* Global pointer for later use */
+ /* This should probably remain a warning, rather than an error,
+ for quite a while. For one thing the version of VC distributed
+ with GNU emacs 19.34 invokes 'cvs rlog' instead of 'cvs log'. */
if (strcmp (argv[0], "rlog") == 0)
{
error (0, 0, "warning: the rlog command is deprecated");
@@ -605,7 +668,7 @@ main (argc, argv)
#endif /* HAVE_KERBEROS */
-#if defined(AUTH_SERVER_SUPPORT) && defined(SERVER_SUPPORT)
+#if (defined(AUTH_SERVER_SUPPORT) || defined (HAVE_GSSAPI)) && defined(SERVER_SUPPORT)
if (strcmp (command_name, "pserver") == 0)
{
/* The reason that --allow-root is not a command option
@@ -622,15 +685,16 @@ main (argc, argv)
/* Pretend we were invoked as a plain server. */
command_name = "server";
}
-#endif /* AUTH_SERVER_SUPPORT && SERVER_SUPPORT */
+#endif /* (AUTH_SERVER_SUPPORT || HAVE_GSSAPI) && SERVER_SUPPORT */
+#ifdef SERVER_SUPPORT
+ server_active = strcmp (command_name, "server") == 0;
/* Fiddling with CVSROOT doesn't make sense if we're running
in server mode, since the client will send the repository
directory after the connection is made. */
-#ifdef SERVER_SUPPORT
- if (strcmp (command_name, "server") != 0)
+ if (!server_active)
#endif
{
char *CVSADM_Root;
@@ -777,7 +841,7 @@ main (argc, argv)
it is worth the trouble. */
#ifdef SERVER_SUPPORT
- if (strcmp (command_name, "server") == 0)
+ if (server_active)
CurDir = xstrdup ("<remote>");
else
#endif
@@ -791,16 +855,6 @@ main (argc, argv)
Tmpdir = "/tmp";
#ifdef HAVE_PUTENV
- /* Now, see if we should update the environment with the
- Rcsbin value */
- if (rcsbin_update_env)
- {
- char *env;
- env = xmalloc (strlen (RCSBIN_ENV) + strlen (Rcsbin) + 1 + 1);
- (void) sprintf (env, "%s=%s", RCSBIN_ENV, Rcsbin);
- (void) putenv (env);
- /* do not free env, as putenv has control of it */
- }
if (tmpdir_update_env)
{
char *env;
@@ -811,24 +865,6 @@ main (argc, argv)
}
#endif
- /*
- * If Rcsbin is set to something, make sure it is terminated with
- * a slash character. If not, add one.
- */
- if (*Rcsbin)
- {
- int len = strlen (Rcsbin);
- char *rcsbin;
-
- if (Rcsbin[len - 1] != '/')
- {
- rcsbin = Rcsbin;
- Rcsbin = xmalloc (len + 2); /* one for '/', one for NULL */
- (void) strcpy (Rcsbin, rcsbin);
- (void) strcat (Rcsbin, "/");
- }
- }
-
#ifndef DONT_USE_SIGNALS
/* make sure we clean up on error */
#ifdef SIGHUP
@@ -866,6 +902,28 @@ main (argc, argv)
if (use_cvsrc)
read_cvsrc (&argc, &argv, command_name);
+ /* Parse the CVSROOT/config file, but only for local. For the
+ server, we parse it after we know $CVSROOT. For the
+ client, it doesn't get parsed at all, obviously. The
+ presence of the parse_config call here is not mean to
+ predetermine whether CVSROOT/config overrides things from
+ read_cvsrc and other such places or vice versa. That sort
+ of thing probably needs more thought. */
+ if (1
+#ifdef SERVER_SUPPORT
+ && !server_active
+#endif
+#ifdef CLIENT_SUPPORT
+ && !client_active
+#endif
+ )
+ {
+ /* If there was an error parsing the config file, parse_config
+ already printed an error. We keep going. Why? Because
+ if we didn't, then there would be no way to check in a new
+ CVSROOT/config file to fix the broken one! */
+ parse_config (CVSroot_directory);
+ }
} /* end of stuff that gets done if the user DOESN'T ask for help */
err = (*(cm->func)) (argc, argv);
@@ -874,7 +932,10 @@ main (argc, argv)
{
/* Update the CVS/Root file. We might want to do this in
all directories that we recurse into, but currently we
- don't. */
+ don't. Note that if there is an error writing the file,
+ we give an error/warning. This is so if users try to rewrite
+ CVS/Root with the -d option (a documented feature), they will
+ either succeed, or be told why it didn't work. */
Create_Root (NULL, CVSroot);
}
@@ -887,8 +948,6 @@ main (argc, argv)
free (Editor);
if (free_Tmpdir)
free (Tmpdir);
- if (free_Rcsbin)
- free (Rcsbin);
root_allow_free ();
#ifdef SYSTEM_CLEANUP
@@ -900,6 +959,8 @@ main (argc, argv)
/* This is exit rather than return because apparently that keeps
some tools which check for memory leaks happier. */
exit (err ? EXIT_FAILURE : 0);
+ /* Keep picky/stupid compilers (e.g. Visual C++ 5.0) happy. */
+ return 0;
}
char *
@@ -914,11 +975,14 @@ Make_Date (rawdate)
unixtime = get_date (rawdate, (struct timeb *) NULL);
if (unixtime == (time_t) - 1)
error (1, 0, "Can't parse date/time: %s", rawdate);
-#ifdef HAVE_RCS5
+
ftm = gmtime (&unixtime);
-#else
- ftm = localtime (&unixtime);
-#endif
+ if (ftm == NULL)
+ /* This is a system, like VMS, where the system clock is in local
+ time. Hopefully using localtime here matches the "zero timezone"
+ hack I added to get_date. */
+ ftm = localtime (&unixtime);
+
(void) sprintf (date, DATEFORM,
ftm->tm_year + (ftm->tm_year < 100 ? 0 : 1900),
ftm->tm_mon + 1, ftm->tm_mday, ftm->tm_hour,
diff --git a/contrib/cvs/src/mkmodules.c b/contrib/cvs/src/mkmodules.c
index ec5d770..3c63433 100644
--- a/contrib/cvs/src/mkmodules.c
+++ b/contrib/cvs/src/mkmodules.c
@@ -275,6 +275,12 @@ static const char *const modules_contents[] = {
NULL
};
+static const char *const config_contents[] = {
+ "# Set this to \"no\" if pserver shouldn't check system users/passwords\n",
+ "#SystemAuth=no\n",
+ NULL
+};
+
static const struct admin_file filelist[] = {
{CVSROOTADM_LOGINFO,
"no logging of 'cvs commit' messages is done without a %s file",
@@ -316,14 +322,27 @@ static const struct admin_file filelist[] = {
{CVSROOTADM_WRITERS,
"a %s file specifies read/write users",
NULL},
- /* Some have suggested listing CVSROOTADM_PASSWD here too. The
- security implications of transmitting hashed passwords over the
- net are no worse than transmitting cleartext passwords which pserver
- does, so this isn't a problem. But I'm worried about the implications
- of storing old passwords--if someone used a password in the past
- they might be using it elsewhere, using a similar password, etc,
- and so it doesn't seem to me like we should be saving old passwords,
- even hashed. */
+
+ /* Some have suggested listing CVSROOTADM_PASSWD here too. This
+ would mean that CVS commands which operate on the
+ CVSROOTADM_PASSWD file would transmit hashed passwords over the
+ net. This might seem to be no big deal, as pserver normally
+ transmits cleartext passwords, but the difference is that
+ CVSROOTADM_PASSWD contains *all* passwords, not just the ones
+ currently being used. For example, it could be too easy to
+ accidentally give someone readonly access to CVSROOTADM_PASSWD
+ (e.g. via anonymous CVS or cvsweb), and then if there are any
+ guessable passwords for read/write access (usually there will be)
+ they get read/write access.
+
+ Another worry is the implications of storing old passwords--if
+ someone used a password in the past they might be using it
+ elsewhere, using a similar password, etc, and so saving old
+ passwords, even hashed, is probably not a good idea. */
+
+ {CVSROOTADM_CONFIG,
+ "a %s file configures various behaviors",
+ config_contents},
{NULL, NULL}
};
@@ -694,6 +713,7 @@ rename_rcsfile (temp, real)
const char *const init_usage[] = {
"Usage: %s %s\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -785,8 +805,12 @@ init (argc, argv)
"initial checkin" but I fail to see the point as we know what
file it is from the name. */
retcode = add_rcs_file ("initial checkin", info_v,
- fileptr->filename, "1.1", NULL, NULL,
- 0, NULL, NULL);
+ fileptr->filename, "1.1", NULL,
+
+ /* No vendor branch. */
+ NULL, NULL, 0, NULL,
+
+ NULL, 0, NULL);
if (retcode != 0)
/* add_rcs_file already printed an error message. */
err = 1;
diff --git a/contrib/cvs/src/modules.c b/contrib/cvs/src/modules.c
index e01f733..de95f7e 100644
--- a/contrib/cvs/src/modules.c
+++ b/contrib/cvs/src/modules.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License
- * as specified in the README file that comes with the CVS 1.4 kit.
+ * as specified in the README file that comes with the CVS source distribution.
*
* Modules
*
@@ -36,8 +36,15 @@
struct sortrec
{
+ /* Name of the module, malloc'd. */
char *modname;
+ /* If Status variable is set, this is either def_status or the malloc'd
+ name of the status. If Status is not set, the field is left
+ uninitialized. */
char *status;
+ /* Pointer to a malloc'd array which contains (1) the raw contents
+ of the options and arguments, excluding comments, (2) a '\0',
+ and (3) the storage for the "comment" field. */
char *rest;
char *comment;
};
@@ -127,7 +134,7 @@ do_module (db, mname, m_type, msg, callback_proc, where,
#ifdef SERVER_SUPPORT
int restore_server_dir = 0;
- char *server_dir_to_restore;
+ char *server_dir_to_restore = NULL;
if (trace)
{
char *buf;
@@ -268,6 +275,11 @@ do_module (db, mname, m_type, msg, callback_proc, where,
}
is_found = 1;
}
+ else
+ {
+ /* This initialization suppresses a warning from gcc -Wall. */
+ value = NULL;
+ }
}
free (attic_file);
free (file);
@@ -384,24 +396,10 @@ do_module (db, mname, m_type, msg, callback_proc, where,
{
char *nullrepos;
- nullrepos = xmalloc (strlen (CVSroot_directory)
- + sizeof (CVSROOTADM)
- + sizeof (CVSNULLREPOS)
- + 10);
- (void) sprintf (nullrepos, "%s/%s/%s", CVSroot_directory,
- CVSROOTADM, CVSNULLREPOS);
- if (!isfile (nullrepos))
- {
- mode_t omask;
- omask = umask (cvsumask);
- (void) CVS_MKDIR (nullrepos, 0777);
- (void) umask (omask);
- }
- if (!isdir (nullrepos))
- error (1, 0, "there is no repository %s", nullrepos);
+ nullrepos = emptydir_name ();
Create_Admin (".", dir,
- nullrepos, (char *) NULL, (char *) NULL, 0);
+ nullrepos, (char *) NULL, (char *) NULL, 0, 0);
if (!noexec)
{
FILE *fp;
@@ -439,7 +437,7 @@ do_module (db, mname, m_type, msg, callback_proc, where,
(void) sprintf (line, "%s %s", "XXX", value);
/* turn the line into an argv[] array */
- line2argv (&xmodargc, &xmodargv, line);
+ line2argv (&xmodargc, &xmodargv, line, " \t");
free (line);
modargc = xmodargc;
modargv = xmodargv;
@@ -541,6 +539,15 @@ do_module (db, mname, m_type, msg, callback_proc, where,
goto do_module_return;
}
+ if (mfile != NULL && modargc > 1)
+ {
+ error (0, 0, "\
+module `%s' is a request for a file in a module which is not a directory",
+ mname);
+ ++err;
+ goto do_module_return;
+ }
+
/* otherwise, process this module */
err += callback_proc (&modargc, modargv, where, mwhere, mfile, shorten,
local_specified, mname, msg);
@@ -698,7 +705,8 @@ do_module (db, mname, m_type, msg, callback_proc, where,
expanded_path = expand_path (prog, "modules", 0);
if (expanded_path != NULL)
{
- run_setup ("%s %s", expanded_path, real_where);
+ run_setup (expanded_path);
+ run_arg (real_where);
if (extra_arg)
run_arg (extra_arg);
@@ -849,15 +857,19 @@ save_d (k, ks, d, ds)
{
s_rec->status = def_status;
- /* Minor kluge, but general enough to maintain */
for (cp = s_rec->rest; (cp2 = strchr (cp, '-')) != NULL; cp = ++cp2)
{
if (*(cp2 + 1) == 's' && *(cp2 + 2) == ' ')
{
- s_rec->status = (cp2 += 3);
- while (*cp2 != ' ')
+ char *status_start;
+
+ cp2 += 3;
+ status_start = cp2;
+ while (*cp2 != ' ' && *cp2 != '\0')
cp2++;
- *cp2++ = '\0';
+ s_rec->status = xmalloc (cp2 - status_start + 1);
+ strncpy (s_rec->status, status_start, cp2 - status_start);
+ s_rec->status[cp2 - status_start] = '\0';
cp = cp2;
break;
}
@@ -934,15 +946,13 @@ cat_module (status)
line = xmalloc (strlen (s_h->status) + 15);
sprintf (line, " %-11s", s_h->status);
cvs_output (line, 0);
- if (s_h->status != def_status)
- *(s_h->status + strlen (s_h->status)) = ' ';
free (line);
}
line = xmalloc (strlen (s_h->modname) + strlen (s_h->rest) + 15);
/* Parse module file entry as command line and print options */
(void) sprintf (line, "%s %s", s_h->modname, s_h->rest);
- line2argv (&moduleargc, &moduleargv, line);
+ line2argv (&moduleargc, &moduleargv, line, " \t");
free (line);
argc = moduleargc;
argv = moduleargv;
@@ -1032,5 +1042,11 @@ cat_module (status)
}
free_names(&moduleargc, moduleargv);
+ /* FIXME-leak: here is where we would free s_h->modname, s_h->rest,
+ and if applicable, s_h->status. Not exactly a memory leak,
+ in the sense that we are about to exit(), but may be worth
+ noting if we ever do a multithreaded server or something of
+ the sort. */
}
+ /* FIXME-leak: as above, here is where we would free s_head. */
}
diff --git a/contrib/cvs/src/myndbm.c b/contrib/cvs/src/myndbm.c
index 1a3fcae..949ac78 100644
--- a/contrib/cvs/src/myndbm.c
+++ b/contrib/cvs/src/myndbm.c
@@ -2,7 +2,7 @@
* Copyright (c) 1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* A simple ndbm-emulator for CVS. It parses a text file of the format:
*
@@ -21,6 +21,8 @@
static void mydbm_load_file PROTO ((FILE *, List *));
+/* Returns NULL on error in which case errno has been set to indicate
+ the error. Can also call error() itself. */
/* ARGSUSED */
DBM *
mydbm_open (file, flags, mode)
@@ -203,11 +205,12 @@ mydbm_load_file (fp, list)
size_t value_allocated;
char *cp, *vp;
int len, cont;
+ int line_length;
value_allocated = 1;
value = xmalloc (value_allocated);
- for (cont = 0; getline (&line, &line_len, fp) >= 0;)
+ for (cont = 0; (line_length = getline (&line, &line_len, fp)) >= 0;)
{
if ((cp = strrchr (line, '\012')) != NULL)
*cp = '\0'; /* strip the newline */
@@ -288,6 +291,10 @@ mydbm_load_file (fp, list)
}
}
}
+ if (line_length < 0 && !feof (fp))
+ /* FIXME: should give the name of the file. */
+ error (0, errno, "cannot read file in mydbm_load_file");
+
free (line);
free (value);
}
diff --git a/contrib/cvs/src/no_diff.c b/contrib/cvs/src/no_diff.c
index 384800f..6d6a6fb 100644
--- a/contrib/cvs/src/no_diff.c
+++ b/contrib/cvs/src/no_diff.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* No Difference
*
diff --git a/contrib/cvs/src/options.h.in b/contrib/cvs/src/options.h.in
index 476d747..144980e 100644
--- a/contrib/cvs/src/options.h.in
+++ b/contrib/cvs/src/options.h.in
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* This file holds (most of) the configuration tweaks that can be made to
* customize CVS for your site. CVS comes configured for a typical SunOS 4.x
@@ -16,19 +16,6 @@
*/
/*
- * CVS provides the most features when used in conjunction with the
- * Version-5 release of RCS. Thus, it is the default. This also
- * assumes that GNU diff Version-1.15 is being used as well -- you
- * will have to configure your RCS V5 release separately to make this
- * the case. If you do not have RCS V5 and GNU diff V1.15, comment out
- * this define. You should not try mixing and matching other
- * combinations of these tools.
- */
-#ifndef HAVE_RCS5
-#define HAVE_RCS5
-#endif
-
-/*
* For portability and heterogeneity reasons, CVS is shipped by
* default using my own text-file version of the ndbm database library
* in the src/myndbm.c file. If you want better performance and are
@@ -40,23 +27,6 @@
#endif
/*
- * The "diff" program to execute when creating patch output. This
- * "diff" must support the "-c" option for context diffing. Specify a
- * full pathname if your site wants to use a particular diff. Note
- * that unlike the diff used with RCS, you *must not* supply -a here
- * (doing so will cause the server to generate patches which patch
- * cannot handle in some cases).
- *
- * NOTE: this program is only used for the ``patch'' sub-command (and
- * for ``update'' if you are using the server). The other commands
- * use rcsdiff which will use whatever version of diff was specified
- * when rcsdiff was built on your system.
- */
-#ifndef DIFF
-#define DIFF "diff"
-#endif
-
-/*
* The "patch" program to run when using the CVS server and accepting
* patches across the network. Specify a full pathname if your site
* wants to use a particular patch.
@@ -65,41 +35,6 @@
#define PATCH_PROGRAM "patch"
#endif
-/*
- * By default, RCS programs are executed with the shell or through
- * execlp(), so the user's PATH environment variable is searched. If
- * you'd like to bind all RCS programs to a certain directory (perhaps
- * one not in most people's PATH) then set the default in RCSBIN_DFLT.
- * Note that setting this here will cause all RCS programs to be
- * executed from this directory, unless the user overrides the default
- * with the RCSBIN environment variable or the "-b" option to CVS.
- *
- * If you use the password-authenticating server, then you need to
- * make sure that the server can find the RCS programs to invoke them.
- * The authenticating server starts out running as root, and then
- * switches to run as the appropriate user once authentication is
- * complete. But no actual shell is ever started by that user, so the
- * PATH environment variable may not contain the directory with the
- * RCS binaries, even though if that user logged in normally, PATH
- * would include the directory.
- *
- * One way to solve this problem is to set RCSBIN_DFLT here. An
- * alternative is to make sure that root has the right directory in
- * its path already. Another, probably better alternative is to
- * specify -b in /etc/inetd.conf.
- *
- * You may also have to set RCSBIN_DFLT here if there's no global
- * start-up script run for users by rshd and your RCS programs are not
- * in a directory in the default PATH assigned by rshd.
- *
- * This define should be either the empty string ("") or a full
- * pathname to the directory containing all the installed programs
- * from the RCS distribution.
- */
-#ifndef RCSBIN_DFLT
-#define RCSBIN_DFLT ""
-#endif
-
/* Directory used for storing temporary files, if not overridden by
environment variables or the -T global option. There should be little
need to change this (-T is a better mechanism if you need to use a
@@ -149,10 +84,14 @@
* working directory. This path is either a full-path or a path
* relative to CVSROOT.
*
- * The only advantage that I can see to having a relative path is that
+ * The big advantage that I can see to having a relative path is that
* one can change the physical location of the master source
- * repository, change one's CVSROOT environment variable, and CVS will
- * work without problems. I recommend using full-paths.
+ * repository, change the contents of CVS/Root files in your
+ * checked-out code, and CVS will work without problems.
+ *
+ * This is likely to be the default in the future, but we want to give
+ * people who may be relying on absolute pathnames time to update
+ * their scripts/software.
*/
#ifndef RELATIVE_REPOS
/* #define RELATIVE_REPOS */
@@ -261,8 +200,3 @@
#ifndef STDC_HEADERS
extern void exit ();
#endif
-
-#ifndef getwd
-extern char *getwd ();
-#endif
-
diff --git a/contrib/cvs/src/parseinfo.c b/contrib/cvs/src/parseinfo.c
index 833463a..c492be0 100644
--- a/contrib/cvs/src/parseinfo.c
+++ b/contrib/cvs/src/parseinfo.c
@@ -3,11 +3,12 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*/
#include "cvs.h"
#include "getline.h"
+#include <assert.h>
/*
* Parse the INFOFILE file for the specified REPOSITORY. Invoke CALLPROC for
@@ -62,7 +63,7 @@ Parse_Info (infofile, repository, callproc, all)
srepos = Short_Repository (repository);
if (trace)
- (void) fprintf (stderr, "-> ParseInfo(%s, %s, %s)\n",
+ (void) fprintf (stderr, " -> ParseInfo(%s, %s, %s)\n",
infopath, srepos, all ? "ALL" : "not ALL");
/* search the info file for lines that match */
@@ -185,3 +186,183 @@ Parse_Info (infofile, repository, callproc, all)
return (err);
}
+
+
+/* Parse the CVS config file. The syntax right now is a bit ad hoc
+ but tries to draw on the best or more common features of the other
+ *info files and various unix (or non-unix) config file syntaxes.
+ Lines starting with # are comments. Settings are lines of the form
+ KEYWORD=VALUE. There is currently no way to have a multi-line
+ VALUE (would be nice if there was, probably).
+
+ CVSROOT is the $CVSROOT directory (CVSroot_directory might not be
+ set yet).
+
+ Returns 0 for success, negative value for failure. Call
+ error(0, ...) on errors in addition to the return value. */
+int
+parse_config (cvsroot)
+ char *cvsroot;
+{
+ char *infopath;
+ FILE *fp_info;
+ char *line = NULL;
+ size_t line_allocated = 0;
+ size_t len;
+ char *p;
+ /* FIXME-reentrancy: If we do a multi-threaded server, this would need
+ to go to the per-connection data structures. */
+ static int parsed = 0;
+
+ /* Authentication code and serve_root might both want to call us.
+ Let this happen smoothly. */
+ if (parsed)
+ return 0;
+ parsed = 1;
+
+ infopath = malloc (strlen (cvsroot)
+ + sizeof (CVSROOTADM_CONFIG)
+ + sizeof (CVSROOTADM)
+ + 10);
+ if (infopath == NULL)
+ {
+ error (0, 0, "out of memory; cannot allocate infopath");
+ goto error_return;
+ }
+
+ strcpy (infopath, cvsroot);
+ strcat (infopath, "/");
+ strcat (infopath, CVSROOTADM);
+ strcat (infopath, "/");
+ strcat (infopath, CVSROOTADM_CONFIG);
+
+ fp_info = CVS_FOPEN (infopath, "r");
+ if (fp_info == NULL)
+ {
+ /* If no file, don't do anything special. */
+ if (!existence_error (errno))
+ {
+ /* Just a warning message; doesn't affect return
+ value, currently at least. */
+ error (0, errno, "cannot open %s", infopath);
+ }
+ free (infopath);
+ return 0;
+ }
+
+ while (getline (&line, &line_allocated, fp_info) >= 0)
+ {
+ /* Skip comments. */
+ if (line[0] == '#')
+ continue;
+
+ /* At least for the moment we don't skip whitespace at the start
+ of the line. Too picky? Maybe. But being insufficiently
+ picky leads to all sorts of confusion, and it is a lot easier
+ to start out picky and relax it than the other way around.
+
+ Is there any kind of written standard for the syntax of this
+ sort of config file? Anywhere in POSIX for example (I guess
+ makefiles are sort of close)? Red Hat Linux has a bunch of
+ these too (with some GUI tools which edit them)...
+
+ Along the same lines, we might want a table of keywords,
+ with various types (boolean, string, &c), as a mechanism
+ for making sure the syntax is consistent. Any good examples
+ to follow there (Apache?)? */
+
+ /* Strip the training newline. There will be one unless we
+ read a partial line without a newline, and then got end of
+ file (or error?). */
+
+ len = strlen (line) - 1;
+ if (line[len] == '\n')
+ line[len] = '\0';
+
+ /* Skip blank lines. */
+ if (line[0] == '\0')
+ continue;
+
+ /* The first '=' separates keyword from value. */
+ p = strchr (line, '=');
+ if (p == NULL)
+ {
+ /* Probably should be printing line number. */
+ error (0, 0, "syntax error in %s: line '%s' is missing '='",
+ infopath, line);
+ goto error_return;
+ }
+
+ *p++ = '\0';
+
+ if (strcmp (line, "RCSBIN") == 0)
+ {
+ /* This option used to specify the directory for RCS
+ executables. But since we don't run them any more,
+ this is a noop. Silently ignore it so that a
+ repository can work with either new or old CVS. */
+ ;
+ }
+ else if (strcmp (line, "SystemAuth") == 0)
+ {
+ if (strcmp (p, "no") == 0)
+#ifdef AUTH_SERVER_SUPPORT
+ system_auth = 0;
+#else
+ /* Still parse the syntax but ignore the
+ option. That way the same config file can
+ be used for local and server. */
+ ;
+#endif
+ else if (strcmp (p, "yes") == 0)
+#ifdef AUTH_SERVER_SUPPORT
+ system_auth = 1;
+#else
+ ;
+#endif
+ else
+ {
+ error (0, 0, "unrecognized value '%s' for SystemAuth", p);
+ goto error_return;
+ }
+ }
+ else
+ {
+ /* We may be dealing with a keyword which was added in a
+ subsequent version of CVS. In that case it is a good idea
+ to complain, as (1) the keyword might enable a behavior like
+ alternate locking behavior, in which it is dangerous and hard
+ to detect if some CVS's have it one way and others have it
+ the other way, (2) in general, having us not do what the user
+ had in mind when they put in the keyword violates the
+ principle of least surprise. Note that one corollary is
+ adding new keywords to your CVSROOT/config file is not
+ particularly recommended unless you are planning on using
+ the new features. */
+ error (0, 0, "%s: unrecognized keyword '%s'",
+ infopath, line);
+ goto error_return;
+ }
+ }
+ if (ferror (fp_info))
+ {
+ error (0, errno, "cannot read %s", infopath);
+ goto error_return;
+ }
+ if (fclose (fp_info) < 0)
+ {
+ error (0, errno, "cannot close %s", infopath);
+ goto error_return;
+ }
+ free (infopath);
+ if (line != NULL)
+ free (line);
+ return 0;
+
+ error_return:
+ if (infopath != NULL)
+ free (infopath);
+ if (line != NULL)
+ free (line);
+ return -1;
+}
diff --git a/contrib/cvs/src/patch.c b/contrib/cvs/src/patch.c
index 194999b..9d091c3 100644
--- a/contrib/cvs/src/patch.c
+++ b/contrib/cvs/src/patch.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Patch
*
@@ -54,6 +54,7 @@ static const char *const patch_usage[] =
"\t-D date\tDate.\n",
"\t-r rev\tRevision - symbolic or numeric.\n",
"\t-V vers\tUse RCS Version \"vers\" for keyword expansion.\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -385,6 +386,7 @@ patch_fileproc (callerdat, finfo)
size_t line2_chars_allocated;
char *cp1, *cp2;
FILE *fp;
+ int line_length;
line1 = NULL;
line1_chars_allocated = 0;
@@ -461,23 +463,39 @@ patch_fileproc (callerdat, finfo)
if (patch_short)
{
- (void) printf ("File %s ", finfo->fullname);
+ cvs_output ("File ", 0);
+ cvs_output (finfo->fullname, 0);
if (vers_tag == NULL)
- (void) printf ("is new; current revision %s\n", vers_head);
+ {
+ cvs_output (" is new; current revision ", 0);
+ cvs_output (vers_head, 0);
+ cvs_output ("\n", 1);
+ }
else if (vers_head == NULL)
{
- (void) printf ("is removed; not included in ");
+ cvs_output (" is removed; not included in ", 0);
if (rev2 != NULL)
- (void) printf ("release tag %s", rev2);
+ {
+ cvs_output ("release tag ", 0);
+ cvs_output (rev2, 0);
+ }
else if (date2 != NULL)
- (void) printf ("release date %s", date2);
+ {
+ cvs_output ("release date ", 0);
+ cvs_output (date2, 0);
+ }
else
- (void) printf ("current release");
- (void) printf ("\n");
+ cvs_output ("current release", 0);
+ cvs_output ("\n", 1);
}
else
- (void) printf ("changed from revision %s to %s\n",
- vers_tag, vers_head);
+ {
+ cvs_output (" changed from revision ", 0);
+ cvs_output (vers_tag, 0);
+ cvs_output (" to ", 0);
+ cvs_output (vers_head, 0);
+ cvs_output ("\n", 1);
+ }
ret = 0;
goto out2;
}
@@ -542,11 +560,8 @@ patch_fileproc (callerdat, finfo)
and therefore should be on the server, not the client. */
(void) utime (tmpfile2, &t);
}
- run_setup ("%s -%c", DIFF, unidiff ? 'u' : 'c');
- run_arg (tmpfile1);
- run_arg (tmpfile2);
- switch (run_exec (RUN_TTY, tmpfile3, RUN_TTY, RUN_REALLY))
+ switch (diff_exec (tmpfile1, tmpfile2, unidiff ? "-u" : "-c", tmpfile3))
{
case -1: /* fork/wait failure */
error (1, errno, "fork for diff failed on %s", rcs);
@@ -561,9 +576,9 @@ patch_fileproc (callerdat, finfo)
*/
/* Output an "Index:" line for patch to use */
- (void) fflush (stdout);
- (void) printf ("Index: %s\n", finfo->fullname);
- (void) fflush (stdout);
+ cvs_output ("Index: ", 0);
+ cvs_output (finfo->fullname, 0);
+ cvs_output ("\n", 1);
fp = open_file (tmpfile3, "r");
if (getline (&line1, &line1_chars_allocated, fp) < 0 ||
@@ -628,25 +643,49 @@ patch_fileproc (callerdat, finfo)
(void) sprintf (file2, "%s:%s", finfo->fullname,
vers_head ? vers_head : "removed");
- /* Note that this prints "diff" not DIFF. The format of a diff
- does not depend on the name of the program which happens to
- have produced it. */
+ /* Note that the string "diff" is specified by POSIX (for -c)
+ and is part of the diff output format, not the name of a
+ program. */
if (unidiff)
{
- (void) printf ("diff -u %s %s\n", file1, file2);
- (void) printf ("--- %s%s+++ ", file1, cp1);
+ cvs_output ("diff -u ", 0);
+ cvs_output (file1, 0);
+ cvs_output (" ", 1);
+ cvs_output (file2, 0);
+ cvs_output ("\n", 1);
+
+ cvs_output ("--- ", 0);
+ cvs_output (file1, 0);
+ cvs_output (cp1, 0);
+ cvs_output ("+++ ", 0);
}
else
{
- (void) printf ("diff -c %s %s\n", file1, file2);
- (void) printf ("*** %s%s--- ", file1, cp1);
+ cvs_output ("diff -c ", 0);
+ cvs_output (file1, 0);
+ cvs_output (" ", 1);
+ cvs_output (file2, 0);
+ cvs_output ("\n", 1);
+
+ cvs_output ("*** ", 0);
+ cvs_output (file1, 0);
+ cvs_output (cp1, 0);
+ cvs_output ("--- ", 0);
}
- (void) printf ("%s%s", finfo->fullname, cp2);
+ cvs_output (finfo->fullname, 0);
+ cvs_output (cp2, 0);
+
/* spew the rest of the diff out */
- while (getline (&line1, &line1_chars_allocated, fp) >= 0)
- (void) fputs (line1, stdout);
- (void) fclose (fp);
+ while ((line_length
+ = getline (&line1, &line1_chars_allocated, fp))
+ >= 0)
+ cvs_output (line1, 0);
+ if (line_length < 0 && !feof (fp))
+ error (0, errno, "cannot read %s", tmpfile3);
+
+ if (fclose (fp) < 0)
+ error (0, errno, "cannot close %s", tmpfile3);
free (file1);
free (file2);
break;
@@ -658,10 +697,12 @@ patch_fileproc (callerdat, finfo)
free (line1);
if (line2)
free (line2);
- /* FIXME: should be checking for errors. */
- (void) CVS_UNLINK (tmpfile1);
- (void) CVS_UNLINK (tmpfile2);
- (void) CVS_UNLINK (tmpfile3);
+ if (CVS_UNLINK (tmpfile1) < 0)
+ error (0, errno, "cannot unlink %s", tmpfile1);
+ if (CVS_UNLINK (tmpfile2) < 0)
+ error (0, errno, "cannot unlink %s", tmpfile2);
+ if (CVS_UNLINK (tmpfile3) < 0)
+ error (0, errno, "cannot unlink %s", tmpfile3);
free (tmpfile1);
free (tmpfile2);
free (tmpfile3);
diff --git a/contrib/cvs/src/rcs.c b/contrib/cvs/src/rcs.c
index a49c449..c134d67 100644
--- a/contrib/cvs/src/rcs.c
+++ b/contrib/cvs/src/rcs.c
@@ -2,7 +2,7 @@
* Copyright (c) 1992, Brian Berliner and Jeff Polk
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* The routines contained in this file do all the rcs file parsing and
* manipulation
@@ -10,6 +10,7 @@
#include <assert.h>
#include "cvs.h"
+#include "edit.h"
/* The RCS -k options, and a set of enums that must match the array.
These come first so that we can use enum kflag in function
@@ -19,7 +20,6 @@ static const char *const kflags[] =
enum kflag { KFLAG_KV = 0, KFLAG_KVL, KFLAG_K, KFLAG_V, KFLAG_O, KFLAG_B };
static RCSNode *RCS_parsercsfile_i PROTO((FILE * fp, const char *rcsfile));
-static void RCS_reparsercsfile PROTO((RCSNode *, int, FILE **));
static char *RCS_getdatebranch PROTO((RCSNode * rcs, char *date, char *branch));
static int getrcskey PROTO((FILE * fp, char **keyp, char **valp,
size_t *lenp));
@@ -27,7 +27,9 @@ static void getrcsrev PROTO ((FILE *fp, char **revp));
static int checkmagic_proc PROTO((Node *p, void *closure));
static void do_branches PROTO((List * list, char *val));
static void do_symbols PROTO((List * list, char *val));
+static void do_locks PROTO((List * list, char *val));
static void free_rcsnode_contents PROTO((RCSNode *));
+static void free_rcsvers_contents PROTO((RCSVers *));
static void rcsvers_delproc PROTO((Node * p));
static char *translate_symtag PROTO((RCSNode *, const char *));
static char *printable_date PROTO((const char *));
@@ -41,6 +43,24 @@ enum rcs_delta_op {RCS_ANNOTATE, RCS_FETCH};
static void RCS_deltas PROTO ((RCSNode *, FILE *, char *, enum rcs_delta_op,
char **, size_t *, char **, size_t *));
+/* Routines for reading, parsing and writing RCS files. */
+static RCSVers *getdelta PROTO ((FILE *, char *));
+static Deltatext *RCS_getdeltatext PROTO ((RCSNode *, FILE *));
+static void freedeltatext PROTO ((Deltatext *));
+
+static void RCS_putadmin PROTO ((RCSNode *, FILE *));
+static void RCS_putdtree PROTO ((RCSNode *, char *, FILE *));
+static void RCS_putdesc PROTO ((RCSNode *, FILE *));
+static void putdelta PROTO ((RCSVers *, FILE *));
+static int putrcsfield_proc PROTO ((Node *, void *));
+static int putsymbol_proc PROTO ((Node *, void *));
+static void RCS_copydeltas PROTO ((RCSNode *, FILE *, FILE *, Deltatext *, char *));
+static void putdeltatext PROTO ((FILE *, Deltatext *));
+
+static FILE *rcs_internal_lockfile PROTO ((char *));
+static void rcs_internal_unlockfile PROTO ((FILE *, char *));
+static char *rcs_lockfilename PROTO ((char *));
+
/*
* We don't want to use isspace() from the C library because:
*
@@ -232,10 +252,20 @@ RCS_parsercsfile_i (fp, rcsfile)
rdata->path = xstrdup (rcsfile);
/* Process HEAD and BRANCH keywords from the RCS header.
- *
- * Most cvs operatations on the main branch don't need any more
- * information. Those that do call XXX to completely parse the
- * RCS file. */
+
+ Most cvs operations on the main branch don't need any more
+ information. Those that do call RCS_reparsercsfile to parse
+ the rest of the header and the deltas.
+
+ People often wonder whether this is inefficient, to open the
+ file once here and once in RCS_reparsercsfile. Well, it might
+ help a little bit if we kept the file open (I haven't tried
+ timing this myself), but basically the common case, which we
+ want to optimize, is the one in which we call
+ RCS_parsercsfile_i and not RCS_reparsercsfile (for example,
+ "cvs update" on a lot of files most of which are unmodified).
+ So making the case in which we call RCS_reparsercsfile fast is
+ not as important. */
if (getrcskey (fp, &key, &value, NULL) == -1 || key == NULL)
goto l_error;
@@ -288,23 +318,19 @@ l_error:
On error, die with a fatal error; if it returns at all it was successful.
- If ALL is nonzero, remember all keywords and values. Otherwise
- only keep the ones we will need.
-
If PFP is NULL, close the file when done. Otherwise, leave it open
and store the FILE * in *PFP. */
-static void
-RCS_reparsercsfile (rdata, all, pfp)
+void
+RCS_reparsercsfile (rdata, pfp)
RCSNode *rdata;
- int all;
FILE **pfp;
{
FILE *fp;
char *rcsfile;
- Node *q;
+ Node *q, *kv;
RCSVers *vnode;
- int n;
+ long fpos;
char *cp;
char *key, *value;
@@ -316,6 +342,9 @@ RCS_reparsercsfile (rdata, all, pfp)
error (1, 0, "unable to reopen `%s'", rcsfile);
/* make a node */
+ /* This probably shouldn't be done until later: if a file has an
+ empty revision tree (which is permissible), rdata->versions
+ should be NULL. -twp */
rdata->versions = getlist ();
/*
@@ -324,12 +353,13 @@ RCS_reparsercsfile (rdata, all, pfp)
*/
for (;;)
{
+ fpos = ftell (fp);
+
/* get the next key/value pair */
/* if key is NULL here, then the file is missing some headers
or we had trouble reading the file. */
- if (getrcskey (fp, &key, &value, NULL) == -1 || key == NULL
- || strcmp (key, RCSDESC) == 0)
+ if (getrcskey (fp, &key, &value, NULL) == -1 || key == NULL)
{
if (ferror(fp))
{
@@ -342,6 +372,35 @@ RCS_reparsercsfile (rdata, all, pfp)
}
}
+ /* Skip head and branch tags; we already have them. */
+ if (strcmp (key, RCSHEAD) == 0 || strcmp (key, RCSBRANCH) == 0)
+ continue;
+
+ if (strcmp (key, "access") == 0)
+ {
+ if (value != NULL)
+ rdata->access = xstrdup (value);
+ continue;
+ }
+
+ /* We always save lock information, so that we can handle
+ -kkvl correctly when checking out a file. */
+ if (strcmp (key, "locks") == 0)
+ {
+ if (value != NULL)
+ rdata->locks_data = xstrdup (value);
+ fpos = ftell (fp);
+ if (getrcskey (fp, &key, &value, NULL) >= 0 &&
+ strcmp (key, "strict") == 0 &&
+ value == NULL)
+ {
+ rdata->strict_locks = 1;
+ }
+ else
+ (void) fseek (fp, fpos, SEEK_SET);
+ continue;
+ }
+
if (strcmp (RCSSYMBOLS, key) == 0)
{
if (value != NULL)
@@ -357,7 +416,7 @@ RCS_reparsercsfile (rdata, all, pfp)
/*
* check key for '.''s and digits (probably a rev) if it is a
- * revision, we are done with the headers and are down to the
+ * revision or `desc', we are done with the headers and are down to the
* revision deltas, so we break out of the loop
*/
for (cp = key; (isdigit (*cp) || *cp == '.') && *cp != '\0'; cp++)
@@ -365,26 +424,25 @@ RCS_reparsercsfile (rdata, all, pfp)
if (*cp == '\0' && strncmp (RCSDATE, value, strlen (RCSDATE)) == 0)
break;
- /* We always save lock information, so that we can handle
- -kkvl correctly when checking out a file. We don't use a
- special field for this information, since it will normally
- not be set for a CVS file. */
- if (all || strcmp (key, "locks") == 0)
- {
- Node *kv;
-
- if (rdata->other == NULL)
- rdata->other = getlist ();
- kv = getnode ();
- kv->type = RCSFIELD;
- kv->key = xstrdup (key);
- kv->data = xstrdup (value);
- if (addnode (rdata->other, kv) != 0)
- {
- error (0, 0, "warning: duplicate key `%s' in RCS file `%s'",
- key, rcsfile);
- freenode (kv);
- }
+ if (strcmp (key, RCSDESC) == 0)
+ break;
+
+ if (strcmp (key, "comment") == 0)
+ {
+ rdata->comment = xstrdup (value);
+ continue;
+ }
+ if (rdata->other == NULL)
+ rdata->other = getlist ();
+ kv = getnode ();
+ kv->type = RCSFIELD;
+ kv->key = xstrdup (key);
+ kv->data = xstrdup (value);
+ if (addnode (rdata->other, kv) != 0)
+ {
+ error (0, 0, "warning: duplicate key `%s' in RCS file `%s'",
+ key, rcsfile);
+ freenode (kv);
}
/* if we haven't grabbed it yet, we didn't want it */
@@ -395,116 +453,11 @@ RCS_reparsercsfile (rdata, all, pfp)
* revision delta in our hand key=the revision and value=the date key and
* its value
*/
- for (;;)
- {
- char *valp;
-
- vnode = (RCSVers *) xmalloc (sizeof (RCSVers));
- memset (vnode, 0, sizeof (RCSVers));
-
- /* fill in the version before we forget it */
- vnode->version = xstrdup (key);
-
- /* grab the value of the date from value */
- valp = value + strlen (RCSDATE);/* skip the "date" keyword */
- while (whitespace (*valp)) /* take space off front of value */
- valp++;
-
- vnode->date = xstrdup (valp);
-
- /* Get author field. */
- (void) getrcskey (fp, &key, &value, NULL);
- /* FIXME: should be using errno in case of ferror. */
- if (key == NULL || strcmp (key, "author") != 0)
- error (1, 0, "\
-unable to parse rcs file; `author' not in the expected place");
- vnode->author = xstrdup (value);
-
- /* Get state field. */
- (void) getrcskey (fp, &key, &value, NULL);
- /* FIXME: should be using errno in case of ferror. */
- if (key == NULL || strcmp (key, "state") != 0)
- error (1, 0, "\
-unable to parse rcs file; `state' not in the expected place");
- vnode->state = xstrdup (value);
- if (strcmp (value, "dead") == 0)
- {
- vnode->dead = 1;
- }
-
- /* fill in the branch list (if any branches exist) */
- (void) getrcskey (fp, &key, &value, NULL);
- /* FIXME: should be handling various error conditions better. */
- if (key != NULL && strcmp (key, RCSDESC) == 0)
- value = NULL;
- if (value != (char *) NULL)
- {
- vnode->branches = getlist ();
- do_branches (vnode->branches, value);
- }
-
- /* fill in the next field if there is a next revision */
- (void) getrcskey (fp, &key, &value, NULL);
- /* FIXME: should be handling various error conditions better. */
- if (key != NULL && strcmp (key, RCSDESC) == 0)
- value = NULL;
- if (value != (char *) NULL)
- vnode->next = xstrdup (value);
-
- /*
- * at this point, we skip any user defined fields XXX - this is where
- * we put the symbolic link stuff???
- */
- /* FIXME: Does not correctly handle errors, e.g. from stdio. */
- while ((n = getrcskey (fp, &key, &value, NULL)) >= 0)
- {
- assert (key != NULL);
-
- if (strcmp (key, RCSDESC) == 0)
- {
- n = -1;
- break;
- }
-
- /* Enable use of repositories created by certain obsolete
- versions of CVS. This code should remain indefinately;
- there is no procedure for converting old repositories, and
- checking for it is harmless. */
- if (strcmp(key, RCSDEAD) == 0)
- {
- vnode->dead = 1;
- if (vnode->state != NULL)
- free (vnode->state);
- vnode->state = xstrdup ("dead");
- continue;
- }
- /* if we have a revision, break and do it */
- for (cp = key; (isdigit (*cp) || *cp == '.') && *cp != '\0'; cp++)
- /* do nothing */ ;
- if (*cp == '\0' && strncmp (RCSDATE, value, strlen (RCSDATE)) == 0)
- break;
-
- if (all)
- {
- Node *kv;
-
- if (vnode->other == NULL)
- vnode->other = getlist ();
- kv = getnode ();
- kv->type = RCSFIELD;
- kv->key = xstrdup (key);
- kv->data = xstrdup (value);
- if (addnode (vnode->other, kv) != 0)
- {
- error (0, 0,
- "\
-warning: duplicate key `%s' in version `%s' of RCS file `%s'",
- key, vnode->version, rcsfile);
- freenode (kv);
- }
- }
- }
+ /* First, seek back to the start of the delta block. */
+ (void) fseek (fp, fpos, SEEK_SET);
+ while ((vnode = getdelta (fp, rcsfile)) != NULL)
+ {
/* get the node */
q = getnode ();
q->type = RCSVERS;
@@ -521,36 +474,22 @@ warning: duplicate key `%s' in version `%s' of RCS file `%s'",
freenode (q);
#endif
}
-
- /*
- * if we left the loop because there were no more keys, we break out
- * of the revision processing loop
- */
- if (n < 0)
- break;
}
- if (all && key != NULL && strcmp (key, RCSDESC) == 0)
+ (void) getrcskey (fp, &key, &value, NULL);
+ if (key != NULL && strcmp (key, RCSDESC) == 0)
{
- Node *kv;
-
- if (rdata->other == NULL)
- rdata->other = getlist ();
- kv = getnode ();
- kv->type = RCSFIELD;
- kv->key = xstrdup (key);
- kv->data = xstrdup (value);
- if (addnode (rdata->other, kv) != 0)
+ if (rdata->desc != NULL)
{
error (0, 0,
"warning: duplicate key `%s' in RCS file `%s'",
key, rcsfile);
- freenode (kv);
+ free (rdata->desc);
}
+ rdata->desc = xstrdup (value);
}
rdata->delta_pos = ftell (fp);
- rdata->flags &= ~NODELTA;
if (pfp == NULL)
{
@@ -582,7 +521,7 @@ RCS_fully_parse (rcs)
{
FILE *fp;
- RCS_reparsercsfile (rcs, 1, &fp);
+ RCS_reparsercsfile (rcs, &fp);
while (1)
{
@@ -780,19 +719,25 @@ free_rcsnode_contents (rnode)
free (rnode->expand);
if (rnode->other != (List *) NULL)
dellist (&rnode->other);
+ if (rnode->access != NULL)
+ free (rnode->access);
+ if (rnode->locks_data != NULL)
+ free (rnode->locks_data);
+ if (rnode->locks != (List *) NULL)
+ dellist (&rnode->locks);
+ if (rnode->comment != NULL)
+ free (rnode->comment);
+ if (rnode->desc != NULL)
+ free (rnode->desc);
}
-/*
- * rcsvers_delproc - free up an RCSVers type node
- */
+/* free_rcsvers_contents -- free up the contents of an RCSVers node,
+ but also free the pointer to the node itself. */
+
static void
-rcsvers_delproc (p)
- Node *p;
-{
+free_rcsvers_contents (rnode)
RCSVers *rnode;
-
- rnode = (RCSVers *) p->data;
-
+{
if (rnode->branches != (List *) NULL)
dellist (&rnode->branches);
if (rnode->date != (char *) NULL)
@@ -805,14 +750,29 @@ rcsvers_delproc (p)
free (rnode->state);
if (rnode->other != (List *) NULL)
dellist (&rnode->other);
+ if (rnode->other_delta != NULL)
+ dellist (&rnode->other_delta);
+ if (rnode->text != NULL)
+ freedeltatext (rnode->text);
free ((char *) rnode);
}
/*
+ * rcsvers_delproc - free up an RCSVers type node
+ */
+static void
+rcsvers_delproc (p)
+ Node *p;
+{
+ free_rcsvers_contents ((RCSVers *) p->data);
+}
+
+/*
* getrcskey - fill in the key and value from the rcs file the algorithm is
* as follows
*
- * o skip whitespace o fill in key with everything up to next white
+ * o skip whitespace
+ * o fill in key with everything up to next white
* space or semicolon
* o if key == "desc" then key and data are NULL and return -1
* o if key wasn't terminated by a semicolon, skip white space and fill
@@ -978,14 +938,18 @@ getrcskey (fp, keyp, valp, lenp)
}
} while (whitespace (c));
- if (cur >= max)
+ /* Do not include any trailing whitespace in the value. */
+ if (c != ';')
{
- size_t curoff = cur - value;
- expand_string (&value, &valsize, valsize + 1);
- cur = value + curoff;
- max = value + valsize;
+ if (cur >= max)
+ {
+ size_t curoff = cur - value;
+ expand_string (&value, &valsize, valsize + 1);
+ cur = value + curoff;
+ max = value + valsize;
+ }
+ *cur++ = ' ';
}
- *cur++ = ' ';
}
/* if we got a semi-colon we are done with the entire value */
@@ -1096,6 +1060,59 @@ getrcsrev (fp, revp)
*revp = key;
}
+/* Like getrcsrev, but don't die on error. Return the last character
+ read (last call to getc, which may be EOF). TODO: implement getrcsrev
+ in terms of this function. */
+static int
+getrevnum (fp, revp)
+ FILE *fp;
+ char **revp;
+{
+ char *cur;
+ char *max;
+ int c;
+
+ *revp = NULL;
+ do {
+ c = getc (fp);
+ if (c == EOF)
+ return c;
+ } while (whitespace (c));
+
+ if (!(isdigit (c) || c == '.'))
+ return c;
+
+ cur = key;
+ max = key + keysize;
+ while (isdigit (c) || c == '.')
+ {
+ if (cur >= max)
+ {
+ size_t curoff = cur - key;
+ expand_string (&key, &keysize, keysize + 1);
+ cur = key + curoff;
+ max = key + keysize;
+ }
+ *cur = c;
+
+ c = getc (fp);
+ if (c == EOF)
+ break;
+ cur++;
+ }
+
+ if (cur >= max)
+ {
+ size_t curoff = cur - key;
+ expand_string (&key, &keysize, keysize + 1);
+ cur = key + curoff;
+ max = key + keysize;
+ }
+ *cur = '\0';
+ *revp = key;
+ return c;
+}
+
/*
* process the symbols list of the rcs file
*/
@@ -1137,6 +1154,48 @@ do_symbols (list, val)
}
/*
+ * process the locks list of the rcs file
+ * Like do_symbols, but hash entries are keyed backwards: i.e.
+ * an entry like `user:rev' is keyed on REV rather than on USER.
+ */
+static void
+do_locks (list, val)
+ List *list;
+ char *val;
+{
+ Node *p;
+ char *cp = val;
+ char *user, *rev;
+
+ for (;;)
+ {
+ /* skip leading whitespace */
+ while (whitespace (*cp))
+ cp++;
+
+ /* if we got to the end, we are done */
+ if (*cp == '\0')
+ break;
+
+ /* split it up into user and rev */
+ user = cp;
+ cp = strchr (cp, ':');
+ *cp++ = '\0';
+ rev = cp;
+ while (!whitespace (*cp) && *cp != '\0')
+ cp++;
+ if (*cp != '\0')
+ *cp++ = '\0';
+
+ /* make a new node and add it to the list */
+ p = getnode ();
+ p->key = xstrdup (rev);
+ p->data = xstrdup (user);
+ (void) addnode (list, p);
+ }
+}
+
+/*
* process the branches list of a revision delta
*/
static void
@@ -1198,7 +1257,7 @@ RCS_getversion (rcs, tag, date, force_tag_match, simple_tag)
{
char *branch, *rev;
- if (! RCS_isbranch (rcs, tag))
+ if (! RCS_nodeisbranch (rcs, tag))
{
/* We can't get a particular date if the tag is not a
branch. */
@@ -1232,6 +1291,8 @@ RCS_getversion (rcs, tag, date, force_tag_match, simple_tag)
* and handle "magic" revisions specially.
*
* If the matched tag is a branch tag, find the head of the branch.
+ *
+ * Returns pointer to newly malloc'd string, or NULL.
*/
char *
RCS_gettag (rcs, symtag, force_tag_match, simple_tag)
@@ -1251,7 +1312,7 @@ RCS_gettag (rcs, symtag, force_tag_match, simple_tag)
/* XXX this is probably not necessary, --jtc */
if (rcs->flags & PARTIAL)
- RCS_reparsercsfile (rcs, 0, NULL);
+ RCS_reparsercsfile (rcs, NULL);
/* If tag is "HEAD", special case to get head RCS revision */
if (tag && (strcmp (tag, TAG_HEAD) == 0 || *tag == '\0'))
@@ -1483,6 +1544,8 @@ RCS_nodeisbranch (rcs, rev)
int dots;
char *version;
+ assert (rcs != NULL);
+
/* numeric revisions are easy -- even number of dots is a branch */
if (isdigit (*rev))
return ((numdots (rev) & 1) == 0);
@@ -1573,7 +1636,8 @@ RCS_whatbranch (rcs, rev)
/*
* Get the head of the specified branch. If the branch does not exist,
- * return NULL or RCS_head depending on force_tag_match
+ * return NULL or RCS_head depending on force_tag_match.
+ * Returns NULL or a newly malloc'd string.
*/
char *
RCS_getbranch (rcs, tag, force_tag_match)
@@ -1591,7 +1655,7 @@ RCS_getbranch (rcs, tag, force_tag_match)
assert (rcs != NULL);
if (rcs->flags & PARTIAL)
- RCS_reparsercsfile (rcs, 0, NULL);
+ RCS_reparsercsfile (rcs, NULL);
/* find out if the tag contains a dot, or is on the trunk */
cp = strrchr (tag, '.');
@@ -1690,9 +1754,88 @@ RCS_getbranch (rcs, tag, force_tag_match)
return (xstrdup (vn->version));
}
+/* Get the branch point for a particular branch, that is the first
+ revision on that branch. For example, RCS_getbranchpoint (rcs,
+ "1.3.2") will normally return "1.3.2.1". TARGET may be either a
+ branch number or a revision number; if a revnum, find the
+ branchpoint of the branch to which TARGET belongs.
+
+ Return RCS_head if TARGET is on the trunk or if the root node could
+ not be found (this is sort of backwards from our behavior on a branch;
+ the rationale is that the return value is a revision from which you
+ can start walking the next fields and end up at TARGET).
+ Return NULL on error. */
+
+static char *
+RCS_getbranchpoint (rcs, target)
+ RCSNode *rcs;
+ char *target;
+{
+ char *branch, *bp;
+ Node *vp;
+ RCSVers *rev;
+ int dots, isrevnum, brlen;
+
+ dots = numdots (target);
+ isrevnum = dots & 1;
+
+ if (dots == 1)
+ /* TARGET is a trunk revision; return rcs->head. */
+ return (RCS_head (rcs));
+
+ /* Get the revision number of the node at which TARGET's branch is
+ rooted. If TARGET is a branch number, lop off the last field;
+ if it's a revision number, lop off the last *two* fields. */
+ branch = xstrdup (target);
+ bp = strrchr (branch, '.');
+ if (bp == NULL)
+ error (1, 0, "%s: confused revision number %s",
+ rcs->path, target);
+ if (isrevnum)
+ while (*--bp != '.')
+ ;
+ *bp = '\0';
+
+ vp = findnode (rcs->versions, branch);
+ if (vp == NULL)
+ {
+ error (0, 0, "%s: can't find branch point %s", rcs->path, target);
+ return NULL;
+ }
+ rev = (RCSVers *) vp->data;
+
+ *bp++ = '.';
+ while (*bp && *bp != '.')
+ ++bp;
+ brlen = bp - branch;
+
+ vp = rev->branches->list->next;
+ while (vp != rev->branches->list)
+ {
+ /* BRANCH may be a genuine branch number, e.g. `1.1.3', or
+ maybe a full revision number, e.g. `1.1.3.6'. We have
+ found our branch point if the first BRANCHLEN characters
+ of the revision number match, *and* if the following
+ character is a dot. */
+ if (strncmp (vp->key, branch, brlen) == 0 && vp->key[brlen] == '.')
+ break;
+ vp = vp->next;
+ }
+
+ free (branch);
+ if (vp == rev->branches->list)
+ {
+ error (0, 0, "%s: can't find branch point %s", rcs->path, target);
+ return NULL;
+ }
+ else
+ return (xstrdup (vp->key));
+}
+
/*
* Get the head of the RCS file. If branch is set, this is the head of the
- * branch, otherwise the real head
+ * branch, otherwise the real head.
+ * Returns NULL or a newly malloc'd string.
*/
char *
RCS_head (rcs)
@@ -1730,7 +1873,7 @@ RCS_getdate (rcs, date, force_tag_match)
assert (rcs != NULL);
if (rcs->flags & PARTIAL)
- RCS_reparsercsfile (rcs, 0, NULL);
+ RCS_reparsercsfile (rcs, NULL);
/* if the head is on a branch, try the branch first */
if (rcs->branch != NULL)
@@ -1817,7 +1960,7 @@ RCS_getdatebranch (rcs, date, branch)
assert (rcs != NULL);
if (rcs->flags & PARTIAL)
- RCS_reparsercsfile (rcs, 0, NULL);
+ RCS_reparsercsfile (rcs, NULL);
p = findnode (rcs->versions, xrev);
free (xrev);
@@ -1829,7 +1972,8 @@ RCS_getdatebranch (rcs, date, branch)
if (RCS_datecmp (vers->date, date) <= 0)
cur_rev = vers->version;
- /* if no branches list, return now */
+ /* If no branches list, return now. This is what happens if the branch
+ is a (magic) branch with no revisions yet. */
if (vers->branches == NULL)
return xstrdup (cur_rev);
@@ -1843,9 +1987,11 @@ RCS_getdatebranch (rcs, date, branch)
free (xbranch);
if (p == vers->branches->list)
{
- /* FIXME: This case would seem to imply that the RCS file is
- somehow invalid. Should we give an error message? */
- return (NULL);
+ /* This is what happens if the branch is a (magic) branch with
+ no revisions yet. Similar to the case where vers->branches ==
+ NULL, except here there was a another branch off the same
+ branchpoint. */
+ return xstrdup (cur_rev);
}
p = findnode (rcs->versions, p->key);
@@ -1911,7 +2057,7 @@ RCS_getrevtime (rcs, rev, date, fudge)
assert (rcs != NULL);
if (rcs->flags & PARTIAL)
- RCS_reparsercsfile (rcs, 0, NULL);
+ RCS_reparsercsfile (rcs, NULL);
/* look up the revision */
p = findnode (rcs->versions, rev);
@@ -1934,15 +2080,9 @@ RCS_getrevtime (rcs, rev, date, fudge)
ftm->tm_year -= 1900;
/* put the date in a form getdate can grok */
-#ifdef HAVE_RCS5
(void) sprintf (tdate, "%d/%d/%d GMT %d:%d:%d", ftm->tm_mon,
ftm->tm_mday, ftm->tm_year + 1900, ftm->tm_hour,
ftm->tm_min, ftm->tm_sec);
-#else
- (void) sprintf (tdate, "%d/%d/%d %d:%d:%d", ftm->tm_mon,
- ftm->tm_mday, ftm->tm_year + 1900, ftm->tm_hour,
- ftm->tm_min, ftm->tm_sec);
-#endif
/* turn it into seconds since the epoch */
revdate = get_date (tdate, (struct timeb *) NULL);
@@ -1952,11 +2092,7 @@ RCS_getrevtime (rcs, rev, date, fudge)
if (date)
{
/* put an appropriate string into ``date'' if we were given one */
-#ifdef HAVE_RCS5
ftm = gmtime (&revdate);
-#else
- ftm = localtime (&revdate);
-#endif
(void) sprintf (date, DATEFORM,
ftm->tm_year + (ftm->tm_year < 100 ? 0 : 1900),
ftm->tm_mon + 1, ftm->tm_mday, ftm->tm_hour,
@@ -1967,13 +2103,32 @@ RCS_getrevtime (rcs, rev, date, fudge)
}
List *
+RCS_getlocks (rcs)
+ RCSNode *rcs;
+{
+ assert(rcs != NULL);
+
+ if (rcs->flags & PARTIAL)
+ RCS_reparsercsfile (rcs, NULL);
+
+ if (rcs->locks_data) {
+ rcs->locks = getlist ();
+ do_locks (rcs->locks, rcs->locks_data);
+ free(rcs->locks_data);
+ rcs->locks_data = NULL;
+ }
+
+ return rcs->locks;
+}
+
+List *
RCS_symbols(rcs)
RCSNode *rcs;
{
assert(rcs != NULL);
if (rcs->flags & PARTIAL)
- RCS_reparsercsfile (rcs, 0, NULL);
+ RCS_reparsercsfile (rcs, NULL);
if (rcs->symbols_data) {
rcs->symbols = getlist ();
@@ -1987,6 +2142,7 @@ RCS_symbols(rcs)
/*
* Return the version associated with a particular symbolic tag.
+ * Returns NULL or a newly malloc'd string.
*/
static char *
translate_symtag (rcs, tag)
@@ -1994,7 +2150,7 @@ translate_symtag (rcs, tag)
const char *tag;
{
if (rcs->flags & PARTIAL)
- RCS_reparsercsfile (rcs, 0, NULL);
+ RCS_reparsercsfile (rcs, NULL);
if (rcs->symbols != NULL)
{
@@ -2067,17 +2223,13 @@ RCS_check_kflag (arg)
" -kv\tGenerate only keyword values in keyword strings.\n",
" -ko\tGenerate the old keyword string (no changes from checked in file).\n",
" -kb\tGenerate binary file unmodified (merges not allowed) (RCS 5.7).\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL,
};
/* Big enough to hold any of the strings from kflags. */
char karg[10];
char const *const *cpp = NULL;
-#ifndef HAVE_RCS5
- error (1, 0, "%s %s: your version of RCS does not support the -k option",
- program_name, command_name);
-#endif
-
if (arg)
{
for (cpp = kflags; *cpp != NULL; cpp++)
@@ -2140,7 +2292,7 @@ RCS_isdead (rcs, tag)
RCSVers *version;
if (rcs->flags & PARTIAL)
- RCS_reparsercsfile (rcs, 0, NULL);
+ RCS_reparsercsfile (rcs, NULL);
p = findnode (rcs->versions, tag);
if (p == NULL)
@@ -2161,7 +2313,7 @@ RCS_getexpand (rcs)
{
assert (rcs != NULL);
if (rcs->flags & PARTIAL)
- RCS_reparsercsfile (rcs, 0, NULL);
+ RCS_reparsercsfile (rcs, NULL);
return rcs->expand;
}
@@ -2338,45 +2490,12 @@ expand_keywords (rcs, ver, name, log, loglen, expand, buf, len, retbuf, retlen)
/* If we are using -kkvl, dig out the locker information if any. */
locker = NULL;
- if (expand == KFLAG_KVL && rcs->other != NULL)
+ if (expand == KFLAG_KVL)
{
- Node *p;
-
- p = findnode (rcs->other, "locks");
- if (p != NULL)
- {
- char *cp;
- size_t verlen;
-
- /* The format of the locking information is
- USER:VERSION USER:VERSION ...
- If we find our version on the list, we set LOCKER to
- the corresponding user name. */
-
- verlen = strlen (ver->version);
- cp = p->data;
- while ((cp = strstr (cp, ver->version)) != NULL)
- {
- if (cp > p->data
- && cp[-1] == ':'
- && (cp[verlen] == '\0'
- || whitespace (cp[verlen])))
- {
- char *cpend;
-
- --cp;
- cpend = cp;
- while (cp > p->data && ! whitespace (*cp))
- --cp;
- locker = xmalloc (cpend - cp + 1);
- memcpy (locker, cp, cpend - cp);
- locker[cpend - cp] = '\0';
- break;
- }
-
- ++cp;
- }
- }
+ Node *lock;
+ lock = findnode (RCS_getlocks(rcs), ver->version);
+ if (lock != NULL)
+ locker = xstrdup (lock->data);
}
/* RCS keywords look like $STRING$ or $STRING: VALUE$. */
@@ -2849,14 +2968,8 @@ RCS_checkout (rcs, workfile, rev, nametag, options, sout, pfn, callerdat)
/* We want the head revision. Try to read it directly. */
- if (rcs->flags & NODELTA)
- {
- free_rcsnode_contents (rcs);
- rcs->flags |= PARTIAL;
- }
-
if (rcs->flags & PARTIAL)
- RCS_reparsercsfile (rcs, 0, &fp);
+ RCS_reparsercsfile (rcs, &fp);
else
{
fp = CVS_FOPEN (rcs->path, FOPEN_BINARY_READ);
@@ -2904,7 +3017,7 @@ RCS_checkout (rcs, workfile, rev, nametag, options, sout, pfn, callerdat)
fp = NULL;
if (rcs->flags & PARTIAL)
- RCS_reparsercsfile (rcs, 0, &fp);
+ RCS_reparsercsfile (rcs, &fp);
if (fp == NULL)
{
@@ -3013,16 +3126,42 @@ RCS_checkout (rcs, workfile, rev, nametag, options, sout, pfn, callerdat)
if (workfile == NULL && sout == RUN_TTY)
{
- if (len > 0)
- cvs_output (value, len);
+ if (expand == KFLAG_B)
+ cvs_output_binary (value, len);
+ else
+ {
+ /* cvs_output requires the caller to check for zero
+ length. */
+ if (len > 0)
+ cvs_output (value, len);
+ }
}
else
{
- if (fwrite (value, 1, len, ofp) != len)
- error (1, errno, "cannot write %s",
- (workfile != NULL
- ? workfile
- : (sout != RUN_TTY ? sout : "stdout")));
+ /* NT 4.0 is said to have trouble writing 2099999 bytes
+ (for example) in a single fwrite. So break it down
+ (there is no need to be writing that much at once
+ anyway; it is possible that LARGEST_FWRITE should be
+ somewhat larger for good performance, but for testing I
+ want to start with a small value until/unless a bigger
+ one proves useful). */
+#define LARGEST_FWRITE 8192
+ size_t nleft = len;
+ size_t nstep = (len < LARGEST_FWRITE ? len : LARGEST_FWRITE);
+ char *p = value;
+
+ while (nleft > 0)
+ {
+ if (fwrite (p, 1, nstep, ofp) != nstep)
+ error (1, errno, "cannot write %s",
+ (workfile != NULL
+ ? workfile
+ : (sout != RUN_TTY ? sout : "stdout")));
+ p += nstep;
+ nleft -= nstep;
+ if (nleft < nstep)
+ nstep = nleft;
+ }
}
if (workfile != NULL)
@@ -3049,6 +3188,794 @@ RCS_checkout (rcs, workfile, rev, nametag, options, sout, pfn, callerdat)
return 0;
}
+static RCSVers *RCS_findlock_or_tip PROTO ((RCSNode *rcs));
+
+/* Find the delta currently locked by the user. From the `ci' man page:
+
+ "If rev is omitted, ci tries to derive the new revision
+ number from the caller's last lock. If the caller has
+ locked the tip revision of a branch, the new revision is
+ appended to that branch. The new revision number is
+ obtained by incrementing the tip revision number. If the
+ caller locked a non-tip revision, a new branch is started
+ at that revision by incrementing the highest branch number
+ at that revision. The default initial branch and level
+ numbers are 1.
+
+ If rev is omitted and the caller has no lock, but owns the
+ file and locking is not set to strict, then the revision
+ is appended to the default branch (normally the trunk; see
+ the -b option of rcs(1))."
+
+ RCS_findlock_or_tip finds the unique revision locked by the caller
+ and returns its delta node. If the caller has not locked any
+ revisions (and is permitted to commit to an unlocked delta, as
+ described above), return the tip of the default branch. */
+
+static RCSVers *
+RCS_findlock_or_tip (rcs)
+ RCSNode *rcs;
+{
+ char *user = getcaller();
+ Node *lock, *p;
+ List *locklist;
+
+ /* Find unique delta locked by caller. This code is very similar
+ to the code in RCS_unlock -- perhaps it could be abstracted
+ into a RCS_findlock function. */
+ locklist = RCS_getlocks (rcs);
+ lock = NULL;
+ for (p = locklist->list->next; p != locklist->list; p = p->next)
+ {
+ if (strcmp (p->data, user) == 0)
+ {
+ if (lock != NULL)
+ {
+ error (0, 0, "\
+%s: multiple revisions locked by %s; please specify one", rcs->path, user);
+ return NULL;
+ }
+ lock = p;
+ }
+ }
+
+ if (lock != NULL)
+ {
+ /* Found an old lock, but check that the revision still exists. */
+ p = findnode (rcs->versions, lock->key);
+ if (p == NULL)
+ {
+ error (0, 0, "%s: can't unlock nonexistent revision %s",
+ rcs->path,
+ lock->key);
+ return NULL;
+ }
+ return (RCSVers *) p->data;
+ }
+
+ /* No existing lock. The RCS rule is that this is an error unless
+ locking is nonstrict AND the file is owned by the current
+ user. Trying to determine the latter is a portability nightmare
+ in the face of NT, VMS, AFS, and other systems with non-unix-like
+ ideas of users and owners. In the case of CVS, we should never get
+ here (as long as the traditional behavior of making sure to call
+ RCS_lock persists). Anyway, we skip the RCS error checks
+ and just return the default branch or head. The reasoning is that
+ those error checks are to make users lock before a checkin, and we do
+ that in other ways if at all anyway (e.g. rcslock.pl). */
+
+ p = findnode (rcs->versions, RCS_getbranch (rcs, rcs->branch, 0));
+ return (RCSVers *) p->data;
+}
+
+/* Revision number string, R, must contain a `.'.
+ Return a newly-malloc'd copy of the prefix of R up
+ to but not including the final `.'. */
+
+static char *
+truncate_revnum (r)
+ const char *r;
+{
+ size_t len;
+ char *new_r;
+ char *dot = strrchr (r, '.');
+
+ assert (dot);
+ len = dot - r;
+ new_r = xmalloc (len + 1);
+ memcpy (new_r, r, len);
+ *(new_r + len) = '\0';
+ return new_r;
+}
+
+/* Revision number string, R, must contain a `.'.
+ R must be writable. Replace the rightmost `.' in R with
+ the NUL byte and return a pointer to that NUL byte. */
+
+static char *
+truncate_revnum_in_place (r)
+ char *r;
+{
+ char *dot = strrchr (r, '.');
+ assert (dot);
+ *dot = '\0';
+ return dot;
+}
+
+/* Revision number strings, R and S, must each contain a `.'.
+ R and S must be writable and must have the same number of dots.
+ Truncate R and S for the comparison, then restored them to their
+ original state.
+ Return the result (see compare_revnums) of comparing R and S
+ ignoring differences in any component after the rightmost `.'. */
+
+static int
+compare_truncated_revnums (r, s)
+ char *r;
+ char *s;
+{
+ char *r_dot = truncate_revnum_in_place (r);
+ char *s_dot = truncate_revnum_in_place (s);
+ int cmp;
+
+ assert (numdots (r) == numdots (s));
+
+ cmp = compare_revnums (r, s);
+
+ *r_dot = '.';
+ *s_dot = '.';
+
+ return cmp;
+}
+
+/* Return a malloc'd copy of the string representing the highest branch
+ number on BRANCHNODE. If there are no branches on BRANCHNODE, return NULL.
+ FIXME: isn't the max rev always the last one?
+ If so, we don't even need a loop. */
+
+static char *
+max_rev (const RCSVers *branchnode)
+{
+ Node *head;
+ Node *bp;
+ char *max;
+
+ if (branchnode->branches == NULL)
+ {
+ return NULL;
+ }
+
+ max = NULL;
+ head = branchnode->branches->list;
+ for (bp = head->next; bp != head; bp = bp->next)
+ {
+ if (max == NULL || compare_truncated_revnums (max, bp->key) < 0)
+ {
+ max = bp->key;
+ }
+ }
+ assert (max);
+
+ return truncate_revnum (max);
+}
+
+/* Create BRANCH in RCS's delta tree. BRANCH may be either a branch
+ number or a revision number. In the former case, create the branch
+ with the specified number; in the latter case, create a new branch
+ rooted at node BRANCH with a higher branch number than any others.
+ Return the number of the tip node on the new branch. */
+
+static char *
+RCS_addbranch (rcs, branch)
+ RCSNode *rcs;
+ const char *branch;
+{
+ char *branchpoint, *newrevnum;
+ Node *nodep, *bp;
+ Node *marker;
+ RCSVers *branchnode;
+
+ /* Append to end by default. */
+ marker = NULL;
+
+ branchpoint = xstrdup (branch);
+ if ((numdots (branchpoint) & 1) == 0)
+ {
+ truncate_revnum_in_place (branchpoint);
+ }
+
+ /* Find the branch rooted at BRANCHPOINT. */
+ nodep = findnode (rcs->versions, branchpoint);
+ if (nodep == NULL)
+ {
+ error (0, 0, "%s: can't find branch point %s", rcs->path, branchpoint);
+ return NULL;
+ }
+ branchnode = (RCSVers *) nodep->data;
+
+ /* If BRANCH was a full branch number, make sure it is higher than MAX. */
+ if ((numdots (branch) & 1) == 1)
+ {
+ if (branchnode->branches == NULL)
+ {
+ /* We have to create the first branch on this node, which means
+ appending ".2" to the revision number. */
+ newrevnum = (char *) xmalloc (strlen (branch) + 3);
+ strcpy (newrevnum, branch);
+ strcat (newrevnum, ".2");
+ }
+ else
+ {
+ char *max = max_rev (branchnode);
+ assert (max);
+ newrevnum = increment_revnum (max);
+ free (max);
+ }
+ }
+ else
+ {
+ newrevnum = xstrdup (branch);
+
+ if (branchnode->branches != NULL)
+ {
+ Node *head;
+ Node *bp;
+
+ /* Find the position of this new branch in the sorted list
+ of branches. */
+ head = branchnode->branches->list;
+ for (bp = head->next; bp != head; bp = bp->next)
+ {
+ char *dot;
+ int found_pos;
+
+ /* The existing list must be sorted on increasing revnum. */
+ assert (bp->next == head
+ || compare_truncated_revnums (bp->key,
+ bp->next->key) < 0);
+ dot = truncate_revnum_in_place (bp->key);
+ found_pos = (compare_revnums (branch, bp->key) < 0);
+ *dot = '.';
+
+ if (found_pos)
+ {
+ break;
+ }
+ }
+ marker = bp;
+ }
+ }
+
+ newrevnum = (char *) xrealloc (newrevnum, strlen (newrevnum) + 3);
+ strcat (newrevnum, ".1");
+
+ /* Add this new revision number to BRANCHPOINT's branches list. */
+ if (branchnode->branches == NULL)
+ branchnode->branches = getlist();
+ bp = getnode();
+ bp->key = xstrdup (newrevnum);
+
+ /* Append to the end of the list by default, that is, just before
+ the header node, `list'. */
+ if (marker == NULL)
+ marker = branchnode->branches->list;
+
+ {
+ int fail;
+ fail = insert_before (branchnode->branches, marker, bp);
+ assert (!fail);
+ }
+
+ return newrevnum;
+}
+
+/* Check in to RCSFILE with revision REV (which must be greater than the
+ largest revision) and message MESSAGE (which is checked for legality).
+ If FLAGS & RCS_FLAGS_DEAD, check in a dead revision. If FLAGS &
+ RCS_FLAGS_QUIET, tell ci to be quiet. If FLAGS & RCS_FLAGS_MODTIME,
+ use the working file's modification time for the checkin time.
+ WORKFILE is the working file to check in from, or NULL to use the usual
+ RCS rules for deriving it from the RCSFILE.
+
+ Return value is -1 for error (and errno is set to indicate the
+ error), positive for error (and an error message has been printed),
+ or zero for success. */
+
+/* TODO: RCS_checkin always unlinks the working file after checkin --
+ then RCS_checkout checks it out again. The logic should probably
+ be reversed here. */
+
+int
+RCS_checkin (rcs, workfile, message, rev, flags)
+ RCSNode *rcs;
+ char *workfile;
+ char *message;
+ char *rev;
+ int flags;
+{
+ RCSVers *delta, *commitpt;
+ Deltatext *dtext;
+ Node *nodep;
+ char *tmpfile, *changefile, *chtext;
+ char *diffopts;
+ size_t bufsize;
+ int buflen, chtextlen;
+ int status, checkin_quiet, allocated_workfile;
+ struct tm *ftm;
+ time_t modtime;
+
+ commitpt = NULL;
+
+ if (rcs->flags & PARTIAL)
+ RCS_reparsercsfile (rcs, NULL);
+
+ /* Get basename of working file. Is there a library function to
+ do this? I couldn't find one. -twp */
+ allocated_workfile = 0;
+ if (workfile == NULL)
+ {
+ char *p;
+ int extlen = strlen (RCSEXT);
+ workfile = xstrdup (last_component (rcs->path));
+ p = workfile + (strlen (workfile) - extlen);
+ assert (strncmp (p, RCSEXT, extlen) == 0);
+ *p = '\0';
+ allocated_workfile = 1;
+ }
+
+ checkin_quiet = flags & RCS_FLAGS_QUIET;
+ if (!checkin_quiet)
+ {
+ cvs_output (rcs->path, 0);
+ cvs_output (" <-- ", 7);
+ cvs_output (workfile, 0);
+ cvs_output ("\n", 1);
+ }
+
+ /* Create new delta node. */
+ delta = (RCSVers *) xmalloc (sizeof (RCSVers));
+ memset (delta, 0, sizeof (RCSVers));
+ delta->author = xstrdup (getcaller ());
+ if (flags & RCS_FLAGS_MODTIME)
+ {
+ struct stat ws;
+ if (stat (workfile, &ws) < 0)
+ {
+ error (1, errno, "cannot stat %s", workfile);
+ }
+ modtime = ws.st_mtime;
+ }
+ else
+ (void) time (&modtime);
+ ftm = gmtime (&modtime);
+ delta->date = (char *) xmalloc (MAXDATELEN);
+ (void) sprintf (delta->date, DATEFORM,
+ ftm->tm_year + (ftm->tm_year < 100 ? 0 : 1900),
+ ftm->tm_mon + 1, ftm->tm_mday, ftm->tm_hour,
+ ftm->tm_min, ftm->tm_sec);
+ if (flags & RCS_FLAGS_DEAD)
+ {
+ delta->state = xstrdup (RCSDEAD);
+ delta->dead = 1;
+ }
+ else
+ delta->state = xstrdup ("Exp");
+
+ /* Create a new deltatext node. */
+ dtext = (Deltatext *) xmalloc (sizeof (Deltatext));
+ memset (dtext, 0, sizeof (Deltatext));
+
+ dtext->log = make_message_rcslegal (message);
+
+ /* If the delta tree is empty, then there's nothing to link the
+ new delta into. So make a new delta tree, snarf the working
+ file contents, and just write the new RCS file. */
+ if (rcs->head == NULL)
+ {
+ char *newrev;
+ FILE *fout;
+
+ /* Figure out what the first revision number should be. */
+ if (rev == NULL || *rev == '\0')
+ newrev = xstrdup ("1.1");
+ else if (numdots (rev) == 0)
+ {
+ newrev = (char *) xmalloc (strlen (rev) + 3);
+ strcpy (newrev, rev);
+ strcat (newrev, ".1");
+ }
+ else
+ newrev = xstrdup (rev);
+
+ /* Don't need to xstrdup NEWREV because it's already dynamic, and
+ not used for anything else. (Don't need to free it, either.) */
+ rcs->head = newrev;
+ delta->version = xstrdup (newrev);
+ nodep = getnode();
+ nodep->type = RCSVERS;
+ nodep->key = xstrdup (newrev);
+ nodep->data = (char *) delta;
+ (void) addnode (rcs->versions, nodep);
+
+ dtext->version = xstrdup (newrev);
+ bufsize = 0;
+ get_file(workfile, workfile, "r", &dtext->text, &bufsize, &dtext->len);
+
+ if (!checkin_quiet)
+ {
+ cvs_output ("initial revision: ", 0);
+ cvs_output (rcs->head, 0);
+ cvs_output ("\n", 1);
+ }
+
+ fout = rcs_internal_lockfile (rcs->path);
+ RCS_putadmin (rcs, fout);
+ RCS_putdtree (rcs, rcs->head, fout);
+ RCS_putdesc (rcs, fout);
+ rcs->delta_pos = ftell (fout);
+ if (rcs->delta_pos == -1)
+ error (1, errno, "cannot ftell for %s", rcs->path);
+ putdeltatext (fout, dtext);
+ rcs_internal_unlockfile (fout, rcs->path);
+ freedeltatext (dtext);
+
+ /* Removing the file here is an RCS user-visible behavior which
+ we almost surely do not need in the CVS case. In fact, getting
+ rid of it should clean up link_file and friends in import.c. */
+ if (unlink_file (workfile) < 0)
+ /* FIXME-update-dir: message does not include update_dir. */
+ error (0, errno, "cannot remove %s", workfile);
+
+ if (!checkin_quiet)
+ cvs_output ("done\n", 5);
+
+ return 0;
+ }
+
+ /* Derive a new revision number. From the `ci' man page:
+
+ "If rev is a revision number, it must be higher than the
+ latest one on the branch to which rev belongs, or must
+ start a new branch.
+
+ If rev is a branch rather than a revision number, the new
+ revision is appended to that branch. The level number is
+ obtained by incrementing the tip revision number of that
+ branch. If rev indicates a non-existing branch, that
+ branch is created with the initial revision numbered
+ rev.1."
+
+ RCS_findlock_or_tip handles the case where REV is omitted.
+ RCS 5.7 also permits REV to be "$" or to begin with a dot, but
+ we do not address those cases -- every routine that calls
+ RCS_checkin passes it a numeric revision. */
+
+ if (rev == NULL || *rev == '\0')
+ {
+ /* Figure out where the commit point is by looking for locks.
+ If the commit point is at the tip of a branch (or is the
+ head of the delta tree), then increment its revision number
+ to obtain the new revnum. Otherwise, start a new
+ branch. */
+ commitpt = RCS_findlock_or_tip (rcs);
+ if (commitpt == NULL)
+ {
+ status = 1;
+ goto checkin_done;
+ }
+ else if (commitpt->next == NULL
+ || strcmp (commitpt->version, rcs->head) == 0)
+ delta->version = increment_revnum (commitpt->version);
+ else
+ delta->version = RCS_addbranch (rcs, commitpt->version);
+ }
+ else
+ {
+ /* REV is either a revision number or a branch number. Find the
+ tip of the target branch. */
+ char *branch, *tip, *newrev, *p;
+ int dots, isrevnum;
+
+ assert (isdigit(*rev));
+
+ newrev = xstrdup (rev);
+ dots = numdots (newrev);
+ isrevnum = dots & 1;
+
+ branch = xstrdup (rev);
+ if (isrevnum)
+ {
+ p = strrchr (branch, '.');
+ *p = '\0';
+ }
+
+ /* Find the tip of the target branch. If we got a one- or two-digit
+ revision number, this will be the head of the tree. Exception:
+ if rev is a single-field revision equal to the branch number of
+ the trunk (usually "1") then we want to treat it like an ordinary
+ branch revision. */
+ if (dots == 0)
+ {
+ tip = xstrdup (rcs->head);
+ if (atoi (tip) != atoi (branch))
+ {
+ newrev = (char *) xrealloc (newrev, strlen (newrev) + 3);
+ strcat (newrev, ".1");
+ dots = isrevnum = 1;
+ }
+ }
+ else if (dots == 1)
+ tip = xstrdup (rcs->head);
+ else
+ tip = RCS_getbranch (rcs, branch, 1);
+
+ /* If the branch does not exist, and we were supplied an exact
+ revision number, signal an error. Otherwise, if we were
+ given only a branch number, create it and set COMMITPT to
+ the branch point. */
+ if (tip == NULL)
+ {
+ if (isrevnum)
+ {
+ error (0, 0, "%s: can't find branch point %s",
+ rcs->path, branch);
+ free (branch);
+ free (newrev);
+ status = 1;
+ goto checkin_done;
+ }
+ delta->version = RCS_addbranch (rcs, branch);
+ p = strrchr (branch, '.');
+ *p = '\0';
+ tip = xstrdup (branch);
+ }
+ else
+ {
+ if (isrevnum)
+ {
+ /* NEWREV must be higher than TIP. */
+ if (compare_revnums (tip, newrev) >= 0)
+ {
+ error (0, 0,
+ "%s: revision %s too low; must be higher than %s",
+ rcs->path,
+ newrev, tip);
+ free (branch);
+ free (newrev);
+ free (tip);
+ status = 1;
+ goto checkin_done;
+ }
+ delta->version = xstrdup (newrev);
+ }
+ else
+ /* Just increment the tip number to get the new revision. */
+ delta->version = increment_revnum (tip);
+ }
+
+ nodep = findnode (rcs->versions, tip);
+ commitpt = (RCSVers *) nodep->data;
+
+ free (branch);
+ free (newrev);
+ free (tip);
+ }
+
+ assert (delta->version != NULL);
+
+ /* If COMMITPT is locked by us, break the lock. If it's locked
+ by someone else, signal an error. */
+ nodep = findnode (RCS_getlocks (rcs), commitpt->version);
+ if (nodep != NULL)
+ {
+ if (strcmp (nodep->data, delta->author) != 0)
+ {
+ error (0, 0, "%s: revision %s locked by %s",
+ rcs->path,
+ nodep->key, nodep->data);
+ status = 1;
+ goto checkin_done;
+ }
+ delnode (nodep);
+ }
+
+ dtext->version = xstrdup (delta->version);
+
+ /* Obtain the change text for the new delta. If DELTA is to be the
+ new head of the tree, then its change text should be the contents
+ of the working file, and LEAFNODE's change text should be a diff.
+ Else, DELTA's change text should be a diff between LEAFNODE and
+ the working file. */
+
+ tmpfile = cvs_temp_name();
+ status = RCS_checkout (rcs, NULL, commitpt->version, NULL,
+ ((rcs->expand != NULL
+ && strcmp (rcs->expand, "b") == 0)
+ ? "-kb"
+ : "-ko"),
+ tmpfile,
+ (RCSCHECKOUTPROC)0, NULL);
+ if (status != 0)
+ error (1, status < 0 ? errno : 0,
+ "could not check out revision %s of `%s'",
+ commitpt->version, rcs->path);
+
+ bufsize = buflen = 0;
+ chtext = NULL;
+ chtextlen = 0;
+ changefile = cvs_temp_name();
+
+ /* Diff options should include --binary if the RCS file has -kb set
+ in its `expand' field. */
+ diffopts = (rcs->expand != NULL && strcmp (rcs->expand, "b") == 0
+ ? "-a -n --binary"
+ : "-a -n");
+
+ if (strcmp (commitpt->version, rcs->head) == 0 &&
+ numdots (delta->version) == 1)
+ {
+ /* If this revision is being inserted on the trunk, the change text
+ for the new delta should be the contents of the working file ... */
+ bufsize = 0;
+ get_file (workfile, workfile,
+ rcs->expand != NULL && strcmp (rcs->expand, "b") == 0 ? "rb" : "r",
+ &dtext->text, &bufsize, &dtext->len);
+
+ /* ... and the change text for the old delta should be a diff. */
+ commitpt->text = (Deltatext *) xmalloc (sizeof (Deltatext));
+ memset (commitpt->text, 0, sizeof (Deltatext));
+
+ bufsize = 0;
+ switch (diff_exec (workfile, tmpfile, diffopts, changefile))
+ {
+ case 0:
+ case 1:
+ break;
+ case -1:
+ /* FIXME-update-dir: message does not include update_dir. */
+ error (1, errno, "error diffing %s", workfile);
+ break;
+ default:
+ /* FIXME-update-dir: message does not include update_dir. */
+ error (1, 0, "error diffing %s", workfile);
+ break;
+ }
+
+ /* OK, the text file case here is really dumb. Logically
+ speaking we want diff to read the files in text mode,
+ convert them to the canonical form found in RCS files
+ (which, we hope at least, is independent of OS--always
+ bare linefeeds), and then work with change texts in that
+ format. However, diff_exec both generates change
+ texts and produces output for user purposes (e.g. patch.c),
+ and there is no way to distinguish between the two cases.
+ So we actually implement the text file case by writing the
+ change text as a text file, then reading it as a text file.
+ This should cause no harm, but doesn't strike me as
+ immensely clean. */
+ get_file (changefile, changefile,
+ rcs->expand != NULL && strcmp (rcs->expand, "b") == 0 ? "rb" : "r",
+ &commitpt->text->text, &bufsize, &commitpt->text->len);
+
+ /* If COMMITPT->TEXT->TEXT is NULL, it means that CHANGEFILE
+ was empty and that there are no differences between revisions.
+ In that event, we want to force RCS_rewrite to write an empty
+ string for COMMITPT's change text. Leaving the change text
+ field set NULL won't work, since that means "preserve the original
+ change text for this delta." */
+ if (commitpt->text->text == NULL)
+ {
+ commitpt->text->text = xstrdup ("");
+ commitpt->text->len = 0;
+ }
+ }
+ else
+ {
+ /* This file is not being inserted at the head, but on a side
+ branch somewhere. Make a diff from the previous revision
+ to the working file. */
+ switch (diff_exec (tmpfile, workfile, diffopts, changefile))
+ {
+ case 0:
+ case 1:
+ break;
+ case -1:
+ /* FIXME-update-dir: message does not include update_dir. */
+ error (1, errno, "error diffing %s", workfile);
+ break;
+ default:
+ /* FIXME-update-dir: message does not include update_dir. */
+ error (1, 0, "error diffing %s", workfile);
+ break;
+ }
+ /* See the comment above, at the other get_file invocation,
+ regarding binary vs. text. */
+ get_file (changefile, changefile,
+ rcs->expand != NULL && strcmp (rcs->expand, "b") == 0 ? "rb" : "r",
+ &dtext->text, &bufsize,
+ &dtext->len);
+ if (dtext->text == NULL)
+ {
+ dtext->text = xstrdup ("");
+ dtext->len = 0;
+ }
+ }
+
+ /* Update DELTA linkage. It is important not to do this before
+ the very end of RCS_checkin; if an error arises that forces
+ us to abort checking in, we must not have malformed deltas
+ partially linked into the tree.
+
+ If DELTA and COMMITPT are on different branches, do nothing --
+ DELTA is linked to the tree through COMMITPT->BRANCHES, and we
+ don't want to change `next' pointers.
+
+ Otherwise, if the nodes are both on the trunk, link DELTA to
+ COMMITPT; otherwise, link COMMITPT to DELTA. */
+
+ if (numdots (commitpt->version) == numdots (delta->version))
+ {
+ if (strcmp (commitpt->version, rcs->head) == 0)
+ {
+ delta->next = rcs->head;
+ rcs->head = xstrdup (delta->version);
+ }
+ else
+ commitpt->next = xstrdup (delta->version);
+ }
+
+ /* Add DELTA to RCS->VERSIONS. */
+ if (rcs->versions == NULL)
+ rcs->versions = getlist();
+ nodep = getnode();
+ nodep->type = RCSVERS;
+ nodep->key = xstrdup (delta->version);
+ nodep->data = (char *) delta;
+ (void) addnode (rcs->versions, nodep);
+
+ /* Write the new RCS file, inserting the new delta at COMMITPT. */
+ if (!checkin_quiet)
+ {
+ cvs_output ("new revision: ", 14);
+ cvs_output (delta->version, 0);
+ cvs_output ("; previous revision: ", 21);
+ cvs_output (commitpt->version, 0);
+ cvs_output ("\n", 1);
+ }
+
+ RCS_rewrite (rcs, dtext, commitpt->version);
+
+ /* Removing the file here is an RCS user-visible behavior which
+ we almost surely do not need in the CVS case. In fact, getting
+ rid of it should clean up link_file and friends in import.c. */
+ if (unlink_file (workfile) < 0)
+ /* FIXME-update-dir: message does not include update_dir. */
+ error (1, errno, "cannot remove %s", workfile);
+ if (unlink_file (tmpfile) < 0)
+ error (0, errno, "cannot remove %s", tmpfile);
+ if (unlink_file (changefile) < 0)
+ error (0, errno, "cannot remove %s", changefile);
+
+ if (!checkin_quiet)
+ cvs_output ("done\n", 5);
+
+ checkin_done:
+ if (allocated_workfile)
+ free (workfile);
+
+ if (commitpt != NULL && commitpt->text != NULL)
+ {
+ freedeltatext (commitpt->text);
+ commitpt->text = NULL;
+ }
+
+ freedeltatext (dtext);
+ if (status != 0)
+ free_rcsvers_contents (delta);
+
+ return status;
+}
+
/* This structure is passed between RCS_cmp_file and cmp_file_buffer. */
struct cmp_file_data
@@ -3175,7 +4102,11 @@ RCS_settag (rcs, tag, rev)
const char *tag;
const char *rev;
{
- int ret;
+ List *symbols;
+ Node *node;
+
+ if (rcs->flags & PARTIAL)
+ RCS_reparsercsfile (rcs, NULL);
/* FIXME: This check should be moved to RCS_check_tag. There is no
reason for it to be here. */
@@ -3190,89 +4121,61 @@ RCS_settag (rcs, tag, rev)
return 1;
}
- ret = RCS_exec_settag (rcs->path, tag, rev);
- if (ret != 0)
- return ret;
-
- /* If we have already parsed the RCS file, update the tag
- information. If we have not yet parsed it (i.e., the PARTIAL
- flag is set), the new tag information will be read when and if
- we do parse it. */
- if ((rcs->flags & PARTIAL) == 0)
+ /* A revision number of NULL means use the head or default branch.
+ If rev is not NULL, it may be a symbolic tag or branch number;
+ expand it to the correct numeric revision or branch head. */
+ if (rev == NULL)
+ rev = rcs->branch ? rcs->branch : rcs->head;
+
+ /* At this point rcs->symbol_data may not have been parsed.
+ Calling RCS_symbols will force it to be parsed into a list
+ which we can easily manipulate. */
+ symbols = RCS_symbols (rcs);
+ if (symbols == NULL)
{
- List *symbols;
- Node *node;
-
- /* At this point rcs->symbol_data may not have been parsed.
- Calling RCS_symbols will force it to be parsed into a list
- which we can easily manipulate. */
- symbols = RCS_symbols (rcs);
- if (symbols == NULL)
- {
- symbols = getlist ();
- rcs->symbols = symbols;
- }
- node = findnode (symbols, tag);
- if (node != NULL)
- {
- free (node->data);
- node->data = xstrdup (rev);
- }
- else
- {
- node = getnode ();
- node->key = xstrdup (tag);
- node->data = xstrdup (rev);
- (void) addnode (symbols, node);
- }
+ symbols = getlist ();
+ rcs->symbols = symbols;
+ }
+ node = findnode (symbols, tag);
+ if (node != NULL)
+ {
+ free (node->data);
+ node->data = xstrdup (rev);
+ }
+ else
+ {
+ node = getnode ();
+ node->key = xstrdup (tag);
+ node->data = xstrdup (rev);
+ (void) addnode_at_front (symbols, node);
}
-
- /* Setting the tag will most likely have invalidated delta_pos. */
- rcs->flags |= NODELTA;
return 0;
}
-/* Delete the symbolic tag TAG from the RCS file RCS. NOERR is 1 to
- suppress errors--FIXME it would be better to avoid the errors or
- some cleaner solution. */
+/* Delete the symbolic tag TAG from the RCS file RCS. Return 0 if
+ the tag was found (and removed), or 1 if it was not present. (In
+ either case, the tag will no longer be in RCS->SYMBOLS.) */
int
-RCS_deltag (rcs, tag, noerr)
+RCS_deltag (rcs, tag)
RCSNode *rcs;
const char *tag;
- int noerr;
{
- int ret;
-
- ret = RCS_exec_deltag (rcs->path, tag, noerr);
- if (ret != 0)
- return ret;
-
- /* If we have already parsed the RCS file, update the tag
- information. If we have not yet parsed it (i.e., the PARTIAL
- flag is set), the new tag information will be read when and if
- we do parse it. */
- if ((rcs->flags & PARTIAL) == 0)
- {
- List *symbols;
+ List *symbols;
+ Node *node;
+ if (rcs->flags & PARTIAL)
+ RCS_reparsercsfile (rcs, NULL);
- /* At this point rcs->symbol_data may not have been parsed.
- Calling RCS_symbols will force it to be parsed into a list
- which we can easily manipulate. */
- symbols = RCS_symbols (rcs);
- if (symbols != NULL)
- {
- Node *node;
+ symbols = RCS_symbols (rcs);
+ if (symbols == NULL)
+ return 1;
- node = findnode (symbols, tag);
- if (node != NULL)
- delnode (node);
- }
- }
+ node = findnode (symbols, tag);
+ if (node == NULL)
+ return 1;
- /* Deleting the tag will most likely have invalidated delta_pos. */
- rcs->flags |= NODELTA;
+ delnode (node);
return 0;
}
@@ -3284,124 +4187,836 @@ RCS_setbranch (rcs, rev)
RCSNode *rcs;
const char *rev;
{
- int ret;
+ if (rcs->flags & PARTIAL)
+ RCS_reparsercsfile (rcs, NULL);
if (rev == NULL && rcs->branch == NULL)
return 0;
if (rev != NULL && rcs->branch != NULL && strcmp (rev, rcs->branch) == 0)
return 0;
- ret = RCS_exec_setbranch (rcs->path, rev);
- if (ret != 0)
- return ret;
-
if (rcs->branch != NULL)
free (rcs->branch);
rcs->branch = xstrdup (rev);
- /* Changing the branch will have changed the data in the file, so
- delta_pos will no longer be correct. */
- rcs->flags |= NODELTA;
-
return 0;
}
-/* Lock revision REV. NOERR is 1 to suppress errors--FIXME it would
- be better to avoid the errors or some cleaner solution. FIXME:
+/* Lock revision REV. LOCK_QUIET is 1 to suppress output. FIXME:
This is only required because the RCS ci program requires a lock.
If we eventually do the checkin ourselves, this can become a no-op. */
+/* FIXME-twp: if a lock owned by someone else is broken, should this
+ send mail to the lock owner? Prompt user? It seems like such an
+ obscure situation for CVS as almost not worth worrying much
+ about. */
int
-RCS_lock (rcs, rev, noerr)
+RCS_lock (rcs, rev, lock_quiet)
RCSNode *rcs;
const char *rev;
- int noerr;
+ int lock_quiet;
{
- int ret;
+ List *locks;
+ Node *p;
+ char *user;
+ char *xrev = NULL;
+
+ if (rcs->flags & PARTIAL)
+ RCS_reparsercsfile (rcs, NULL);
+
+ locks = RCS_getlocks (rcs);
+ if (locks == NULL)
+ locks = rcs->locks = getlist();
+ user = getcaller();
+
+ /* A revision number of NULL means lock the head or default branch. */
+ if (rev == NULL)
+ xrev = RCS_head (rcs);
+
+ /* If rev is a branch number, lock the latest revision on that
+ branch. I think that if the branch doesn't exist, it's
+ okay to return 0 -- that just means that the branch is new,
+ so we don't need to lock it anyway. -twp */
+ else if (RCS_nodeisbranch (rcs, rev))
+ {
+ xrev = RCS_getbranch (rcs, (char *) rev, 1);
+ if (xrev == NULL)
+ {
+ if (!lock_quiet)
+ error (0, 0, "%s: branch %s absent", rcs->path, rev);
+ return 1;
+ }
+ }
+
+ if (xrev == NULL)
+ xrev = xstrdup (rev);
+
+ /* Make sure that the desired revision exists. Technically,
+ we can update the locks list without even checking this,
+ but RCS 5.7 did this. And it can't hurt. */
+ if (findnode (rcs->versions, xrev) == NULL)
+ {
+ if (!lock_quiet)
+ error (0, 0, "%s: revision %s absent", rcs->path, xrev);
+ free (xrev);
+ return 1;
+ }
- ret = RCS_exec_lock (rcs->path, rev, noerr);
- if (ret != 0)
- return ret;
+ /* Is this rev already locked? */
+ p = findnode (locks, xrev);
+ if (p != NULL)
+ {
+ if (strcmp (p->data, user) == 0)
+ {
+ /* We already own the lock on this revision, so do nothing. */
+ free (xrev);
+ return 0;
+ }
- /* Setting a lock will have changed the data in the file, so
- delta_pos will no longer be correct. */
- rcs->flags |= NODELTA;
+ /* Break the lock. */
+ if (!lock_quiet)
+ {
+ cvs_output (rev, 0);
+ cvs_output (" unlocked\n", 0);
+ }
+ delnode (p);
+ }
+
+ /* Create a new lock. */
+ p = getnode();
+ p->key = xrev; /* already xstrdupped */
+ p->data = xstrdup (getcaller());
+ (void) addnode_at_front (locks, p);
+
+ if (!lock_quiet)
+ {
+ cvs_output (xrev, 0);
+ cvs_output (" locked\n", 0);
+ }
return 0;
}
-/* Unlock revision REV. NOERR is 1 to suppress errors--FIXME it would
- be better to avoid the errors or some cleaner solution. FIXME:
+/* Unlock revision REV. UNLOCK_QUIET is 1 to suppress output. FIXME:
Like RCS_lock, this can become a no-op if we do the checkin
- ourselves. */
+ ourselves.
+
+ If REV is not null and is locked by someone else, break their
+ lock and notify them. It is an open issue whether RCS_unlock
+ queries the user about whether or not to break the lock. */
int
-RCS_unlock (rcs, rev, noerr)
+RCS_unlock (rcs, rev, unlock_quiet)
RCSNode *rcs;
const char *rev;
- int noerr;
+ int unlock_quiet;
{
- int ret;
+ Node *lock;
+ List *locks;
+ char *user;
+ char *xrev = NULL;
+
+ user = getcaller();
+ if (rcs->flags & PARTIAL)
+ RCS_reparsercsfile (rcs, NULL);
+
+ /* If rev is NULL, unlock the latest revision (first in
+ rcs->locks) held by the caller. */
+ if (rev == NULL)
+ {
+ Node *p;
+
+ /* No-ops: attempts to unlock an empty tree or an unlocked file. */
+ if (rcs->head == NULL)
+ {
+ if (!unlock_quiet)
+ cvs_outerr ("can't unlock an empty tree\n", 0);
+ return 0;
+ }
+
+ locks = RCS_getlocks (rcs);
+ if (locks == NULL)
+ {
+ if (!unlock_quiet)
+ cvs_outerr ("No locks are set.\n", 0);
+ return 0;
+ }
+
+ lock = NULL;
+ for (p = locks->list->next; p != locks->list; p = p->next)
+ {
+ if (strcmp (p->data, user) == 0)
+ {
+ if (lock != NULL)
+ {
+ if (!unlock_quiet)
+ error (0, 0, "\
+%s: multiple revisions locked by %s; please specify one", rcs->path, user);
+ return 1;
+ }
+ lock = p;
+ }
+ }
+ if (lock == NULL)
+ return 0; /* no lock found, ergo nothing to do */
+ xrev = xstrdup (lock->key);
+ }
+ else if (RCS_nodeisbranch (rcs, rev))
+ {
+ /* If rev is a branch number, unlock the latest revision on that
+ branch. */
+ xrev = RCS_getbranch (rcs, (char *) rev, 1);
+ if (xrev == NULL)
+ {
+ error (0, 0, "%s: branch %s absent", rcs->path, rev);
+ return 1;
+ }
+ }
+ else
+ /* REV is an exact revision number. */
+ xrev = xstrdup (rev);
- ret = RCS_exec_unlock (rcs->path, rev, noerr);
- if (ret != 0)
- return ret;
+ lock = findnode (RCS_getlocks (rcs), xrev);
+ if (lock == NULL)
+ {
+ /* This revision isn't locked. */
+ free (xrev);
+ return 0;
+ }
- /* Setting a lock will have changed the data in the file, so
- delta_pos will no longer be correct. */
- rcs->flags |= NODELTA;
+ if (strcmp (lock->data, user) != 0)
+ {
+ /* If the revision is locked by someone else, notify
+ them. Note that this shouldn't ever happen if RCS_unlock
+ is called with a NULL revision, since that means "whatever
+ revision is currently locked by the caller." */
+ char *repos, *workfile;
+ repos = xstrdup (rcs->path);
+ workfile = strrchr (repos, '/');
+ *workfile++ = '\0';
+ notify_do ('C', workfile, user, NULL, NULL, repos);
+ free (repos);
+ }
+
+ delnode (lock);
+ if (!unlock_quiet)
+ {
+ cvs_output (xrev, 0);
+ cvs_output (" unlocked\n", 0);
+ }
+ free (xrev);
return 0;
}
-
-/* RCS_deltas and friends. Processing of the deltas in RCS files. */
-/* Linked list of allocated blocks. Seems kind of silly to
- reinvent the obstack wheel, and this isn't as nice as obstacks
- in some ways, but obstacks are pretty baroque. */
-struct allocblock
+/* Add USER to the access list of RCS. Do nothing if already present.
+ FIXME-twp: check syntax of USER to make sure it's a valid id. */
+
+void
+RCS_addaccess (rcs, user)
+ RCSNode *rcs;
+ char *user;
{
- char *text;
- struct allocblock *next;
-};
-struct allocblock *blocks;
+ char *access, *a;
-static void *block_alloc PROTO ((size_t));
+ if (rcs->flags & PARTIAL)
+ RCS_reparsercsfile (rcs, NULL);
-static void *
-block_alloc (n)
- size_t n;
-{
- struct allocblock *blk;
- blk = (struct allocblock *) xmalloc (sizeof (struct allocblock));
- blk->text = xmalloc (n);
- blk->next = blocks;
- blocks = blk;
- return blk->text;
+ if (rcs->access == NULL)
+ rcs->access = xstrdup (user);
+ else
+ {
+ access = xstrdup (rcs->access);
+ for (a = strtok (access, " "); a != NULL; a = strtok (NULL, " "))
+ {
+ if (strcmp (a, user) == 0)
+ {
+ free (access);
+ return;
+ }
+ }
+ rcs->access = (char *) xrealloc
+ (rcs->access, strlen (rcs->access) + strlen (user) + 2);
+ strcat (rcs->access, " ");
+ strcat (rcs->access, user);
+ }
}
-static void block_free PROTO ((void));
+/* Remove USER from the access list of RCS. */
-static void
-block_free ()
+void
+RCS_delaccess (rcs, user)
+ RCSNode *rcs;
+ char *user;
{
- struct allocblock *p;
- struct allocblock *q;
+ char *p, *s;
+ int ulen;
+
+ if (rcs->flags & PARTIAL)
+ RCS_reparsercsfile (rcs, NULL);
+
+ if (rcs->access == NULL)
+ return;
- p = blocks;
+ p = rcs->access;
+ ulen = strlen (user);
while (p != NULL)
{
- free (p->text);
- q = p->next;
- free (p);
- p = q;
+ if (p[ulen] == '\0' || p[ulen] == ' ')
+ if (strncmp (p, user, ulen) == 0)
+ break;
+ p = strchr (p, ' ');
+ if (p != NULL)
+ ++p;
}
- blocks = NULL;
+
+ if (p == NULL)
+ return;
+
+ s = p + ulen;
+ while (*s != '\0')
+ *p++ = *s++;
+ *p = '\0';
+}
+
+char *
+RCS_getaccess (rcs)
+ RCSNode *rcs;
+{
+ if (rcs->flags & PARTIAL)
+ RCS_reparsercsfile (rcs, NULL);
+
+ return rcs->access;
}
+static int findtag PROTO ((Node *, void *));
+
+/* Return a nonzero value if the revision specified by ARG is found. */
+
+static int
+findtag (node, arg)
+ Node *node;
+ void *arg;
+{
+ char *rev = (char *)arg;
+
+ if (strcmp (node->data, rev) == 0)
+ return 1;
+ else
+ return 0;
+}
+
+/* Delete revisions between REV1 and REV2. The changes between the two
+ revisions must be collapsed, and the result stored in the revision
+ immediately preceding the lower one. Return 0 for successful completion,
+ 1 otherwise.
+
+ Solution: check out the revision preceding REV1 and the revision
+ following REV2. Use call_diff to find aggregate diffs between
+ these two revisions, and replace the delta text for the latter one
+ with the new aggregate diff. Alternatively, we could write a
+ function that takes two change texts and combines them to produce a
+ new change text, without checking out any revs or calling diff. It
+ would be hairy, but so, so cool.
+
+ If INCLUSIVE is set, then TAG1 and TAG2, if non-NULL, tell us to
+ delete that revision as well (cvs admin -o tag1:tag2). If clear,
+ delete up to but not including that revision (cvs admin -o tag1::tag2).
+ This does not affect TAG1 or TAG2 being NULL; the meaning of the start
+ point in ::tag2 and :tag2 is the same and likewise for end points. */
+
+int
+RCS_delete_revs (rcs, tag1, tag2, inclusive)
+ RCSNode *rcs;
+ char *tag1;
+ char *tag2;
+ int inclusive;
+{
+ char *next;
+ Node *nodep;
+ RCSVers *revp = NULL;
+ RCSVers *beforep;
+ int status, found;
+ int save_noexec;
+
+ char *branchpoint = NULL;
+ char *rev1 = NULL;
+ char *rev2 = NULL;
+ int rev1_inclusive = inclusive;
+ int rev2_inclusive = inclusive;
+ char *before = NULL;
+ char *after = NULL;
+ char *beforefile = NULL;
+ char *afterfile = NULL;
+ char *outfile = NULL;
+
+ if (tag1 == NULL && tag2 == NULL)
+ return 0;
+
+ /* Assume error status until everything is finished. */
+ status = 1;
+
+ /* Make sure both revisions exist. */
+ if (tag1 != NULL)
+ {
+ rev1 = RCS_gettag (rcs, tag1, 1, NULL);
+ if (rev1 == NULL || (nodep = findnode (rcs->versions, rev1)) == NULL)
+ {
+ error (0, 0, "%s: Revision %s doesn't exist.", rcs->path, tag1);
+ goto delrev_done;
+ }
+ }
+ if (tag2 != NULL)
+ {
+ rev2 = RCS_gettag (rcs, tag2, 1, NULL);
+ if (rev2 == NULL || (nodep = findnode (rcs->versions, rev2)) == NULL)
+ {
+ error (0, 0, "%s: Revision %s doesn't exist.", rcs->path, tag2);
+ goto delrev_done;
+ }
+ }
+
+ /* If rev1 is on the trunk and rev2 is NULL, rev2 should be
+ RCS->HEAD. (*Not* RCS_head(rcs), which may return rcs->branch
+ instead.) We need to check this special case early, in order
+ to make sure that rev1 and rev2 get ordered correctly. */
+ if (rev2 == NULL && numdots (rev1) == 1)
+ {
+ rev2 = xstrdup (rcs->head);
+ rev2_inclusive = 1;
+ }
+
+ if (rev2 == NULL)
+ rev2_inclusive = 1;
+
+ if (rev1 != NULL && rev2 != NULL)
+ {
+ /* A range consisting of a branch number means the latest revision
+ on that branch. */
+ if (RCS_isbranch (rcs, rev1) && strcmp (rev1, rev2) == 0)
+ rev1 = rev2 = RCS_getbranch (rcs, rev1, 0);
+ else
+ {
+ /* Make sure REV1 and REV2 are ordered correctly (in the
+ same order as the next field). For revisions on the
+ trunk, REV1 should be higher than REV2; for branches,
+ REV1 should be lower. */
+ /* Shouldn't we just be giving an error in the case where
+ the user specifies the revisions in the wrong order
+ (that is, always swap on the trunk, never swap on a
+ branch, in the non-error cases)? It is not at all
+ clear to me that users who specify -o 1.4:1.2 really
+ meant to type -o 1.2:1.4, and the out of order usage
+ has never been documented, either by cvs.texinfo or
+ rcs(1). */
+ char *temp;
+ int temp_inclusive;
+ if (numdots (rev1) == 1)
+ {
+ if (compare_revnums (rev1, rev2) <= 0)
+ {
+ temp = rev2;
+ rev2 = rev1;
+ rev1 = temp;
+
+ temp_inclusive = rev2_inclusive;
+ rev2_inclusive = rev1_inclusive;
+ rev1_inclusive = temp_inclusive;
+ }
+ }
+ else if (compare_revnums (rev1, rev2) > 0)
+ {
+ temp = rev2;
+ rev2 = rev1;
+ rev1 = temp;
+
+ temp_inclusive = rev2_inclusive;
+ rev2_inclusive = rev1_inclusive;
+ rev1_inclusive = temp_inclusive;
+ }
+ }
+ }
+
+ /* Basically the same thing; make sure that the ordering is what we
+ need. */
+ if (rev1 == NULL)
+ {
+ assert (rev2 != NULL);
+ if (numdots (rev2) == 1)
+ {
+ /* Swap rev1 and rev2. */
+ int temp_inclusive;
+
+ rev1 = rev2;
+ rev2 = NULL;
+
+ temp_inclusive = rev2_inclusive;
+ rev2_inclusive = rev1_inclusive;
+ rev1_inclusive = temp_inclusive;
+ }
+ }
+
+ /* Put the revision number preceding the first one to delete into
+ BEFORE (where "preceding" means according to the next field).
+ If the first revision to delete is the first revision on its
+ branch (e.g. 1.3.2.1), BEFORE should be the node on the trunk
+ at which the branch is rooted. If the first revision to delete
+ is the head revision of the trunk, set BEFORE to NULL.
+
+ Note that because BEFORE may not be on the same branch as REV1,
+ it is not very handy for navigating the revision tree. It's
+ most useful just for checking out the revision preceding REV1. */
+ before = NULL;
+ branchpoint = RCS_getbranchpoint (rcs, rev1 != NULL ? rev1 : rev2);
+ if (rev1 == NULL)
+ {
+ rev1 = xstrdup (branchpoint);
+ if (numdots (branchpoint) > 1)
+ {
+ char *bp;
+ bp = strrchr (branchpoint, '.');
+ while (*--bp != '.')
+ ;
+ *bp = '\0';
+ /* Note that this is exclusive, always, because the inclusive
+ flag doesn't affect the meaning when rev1 == NULL. */
+ before = xstrdup (branchpoint);
+ *bp = '.';
+ }
+ }
+ else if (strcmp (rev1, branchpoint) != 0)
+ {
+ /* Walk deltas from BRANCHPOINT on, looking for REV1. */
+ nodep = findnode (rcs->versions, branchpoint);
+ revp = (RCSVers *) nodep->data;
+ while (revp->next != NULL && strcmp (revp->next, rev1) != 0)
+ {
+ revp = (RCSVers *) nodep->data;
+ nodep = findnode (rcs->versions, revp->next);
+ }
+ if (revp->next == NULL)
+ {
+ error (0, 0, "%s: Revision %s doesn't exist.", rcs->path, rev1);
+ goto delrev_done;
+ }
+ if (rev1_inclusive)
+ before = xstrdup (revp->version);
+ else
+ {
+ before = rev1;
+ nodep = findnode (rcs->versions, before);
+ rev1 = xstrdup (((RCSVers *)nodep->data)->next);
+ }
+ }
+ else if (!rev1_inclusive)
+ {
+ before = rev1;
+ nodep = findnode (rcs->versions, before);
+ rev1 = xstrdup (((RCSVers *)nodep->data)->next);
+ }
+ else if (numdots (branchpoint) > 1)
+ {
+ /* Example: rev1 is "1.3.2.1", branchpoint is "1.3.2.1".
+ Set before to "1.3". */
+ char *bp;
+ bp = strrchr (branchpoint, '.');
+ while (*--bp != '.')
+ ;
+ *bp = '\0';
+ before = xstrdup (branchpoint);
+ *bp = '.';
+ }
+
+ /* If any revision between REV1 and REV2 is locked or is a branch point,
+ we can't delete that revision and must abort. */
+ after = NULL;
+ next = rev1;
+ found = 0;
+ while (!found && next != NULL)
+ {
+ nodep = findnode (rcs->versions, next);
+ revp = (RCSVers *) nodep->data;
+
+ if (rev2 != NULL)
+ found = (strcmp (revp->version, rev2) == 0);
+ next = revp->next;
+
+ if ((!found && next != NULL) || rev2_inclusive || rev2 == NULL)
+ {
+ if (findnode (RCS_getlocks (rcs), revp->version))
+ {
+ error (0, 0, "%s: can't remove locked revision %s",
+ rcs->path,
+ revp->version);
+ goto delrev_done;
+ }
+ if (revp->branches != NULL)
+ {
+ error (0, 0, "%s: can't remove branch point %s",
+ rcs->path,
+ revp->version);
+ goto delrev_done;
+ }
+
+ /* Doing this only for the :: syntax is for compatibility.
+ See cvs.texinfo for somewhat more discussion. */
+ if (!inclusive
+ && walklist (RCS_symbols (rcs), findtag, revp->version))
+ {
+ /* We don't print which file this happens to on the theory
+ that the caller will print the name of the file in a
+ more useful fashion (fullname not rcs->path). */
+ error (0, 0, "cannot remove revision %s because it has tags",
+ revp->version);
+ goto delrev_done;
+ }
+
+ /* It's misleading to print the `deleting revision' output
+ here, since we may not actually delete these revisions.
+ But that's how RCS does it. Bleah. Someday this should be
+ moved to the point where the revs are actually marked for
+ deletion. -twp */
+ cvs_output ("deleting revision ", 0);
+ cvs_output (revp->version, 0);
+ cvs_output ("\n", 1);
+ }
+ }
+
+ if (rev2 == NULL)
+ ;
+ else if (found)
+ {
+ if (rev2_inclusive)
+ after = xstrdup (next);
+ else
+ after = xstrdup (revp->version);
+ }
+ else if (!inclusive)
+ {
+ /* In the case of an empty range, for example 1.2::1.2 or
+ 1.2::1.3, we want to just do nothing. */
+ status = 0;
+ goto delrev_done;
+ }
+ else
+ {
+ /* This looks fishy in the cases where tag1 == NULL or tag2 == NULL.
+ Are those cases really impossible? */
+ assert (tag1 != NULL);
+ assert (tag2 != NULL);
+
+ error (0, 0, "%s: invalid revision range %s:%s", rcs->path,
+ tag1, tag2);
+ goto delrev_done;
+ }
+
+ /* The conditionals at this point get really hairy. Here is the
+ general idea:
+
+ IF before != NULL and after == NULL
+ THEN don't check out any revisions, just delete them
+ IF before == NULL and after != NULL
+ THEN only check out after's revision, and use it for the new deltatext
+ ELSE
+ check out both revisions and diff -n them. This could use
+ RCS_exec_rcsdiff with some changes, like being able
+ to suppress diagnostic messages and to direct output. */
+
+ assert (before != NULL || after != NULL);
+
+ if (after != NULL)
+ {
+ char *diffbuf;
+ size_t bufsize, len;
+
+ afterfile = cvs_temp_name();
+ status = RCS_checkout (rcs, NULL, after, NULL, NULL, afterfile,
+ (RCSCHECKOUTPROC)0, NULL);
+ if (status > 0)
+ goto delrev_done;
+
+ else if (status < 0)
+ {
+ error (0, errno,
+ "cannot check out revision %s of %s", after, rcs->path);
+ goto delrev_done;
+ }
+
+ if (before == NULL)
+ {
+ /* We are deleting revisions from the head of the tree,
+ so must create a new head. */
+ diffbuf = NULL;
+ bufsize = 0;
+ get_file (afterfile, afterfile, "r", &diffbuf, &bufsize, &len);
+
+ save_noexec = noexec;
+ noexec = 0;
+ if (unlink_file (afterfile) < 0)
+ error (0, errno, "cannot remove %s", afterfile);
+ noexec = save_noexec;
+
+ free (afterfile);
+ afterfile = NULL;
+
+ free (rcs->head);
+ rcs->head = xstrdup (after);
+ }
+ else
+ {
+ beforefile = cvs_temp_name();
+ status = RCS_checkout (rcs, NULL, before, NULL, NULL, beforefile,
+ (RCSCHECKOUTPROC)0, NULL);
+ if (status > 0)
+ goto delrev_done;
+ else if (status < 0)
+ {
+ error (0, errno, "cannot check out revision %s of %s",
+ before, rcs->path);
+ goto delrev_done;
+ }
+
+ outfile = cvs_temp_name();
+ status = diff_exec (beforefile, afterfile, "-n", outfile);
+
+ if (status == 2)
+ {
+ /* Not sure we need this message; will diff_exec already
+ have printed an error? */
+ error (0, 0, "%s: could not diff", rcs->path);
+ status = 1;
+ goto delrev_done;
+ }
+
+ diffbuf = NULL;
+ bufsize = 0;
+ get_file (outfile, outfile, "r", &diffbuf, &bufsize, &len);
+ }
+
+ /* Save the new change text in after's delta node. */
+ nodep = findnode (rcs->versions, after);
+ revp = (RCSVers *) nodep->data;
+
+ assert (revp->text == NULL);
+
+ revp->text = (Deltatext *) xmalloc (sizeof (Deltatext));
+ memset ((Deltatext *) revp->text, 0, sizeof (Deltatext));
+ revp->text->version = xstrdup (revp->version);
+ revp->text->text = diffbuf;
+ revp->text->len = len;
+
+ /* If DIFFBUF is NULL, it means that OUTFILE is empty and that
+ there are no differences between the two revisions. In that
+ case, we want to force RCS_copydeltas to write an empty string
+ for the new change text (leaving the text field set NULL
+ means "preserve the original change text for this delta," so
+ we don't want that). */
+ if (revp->text->text == NULL)
+ revp->text->text = xstrdup ("");
+ }
+
+ /* Walk through the revisions (again) to mark each one as
+ outdated. (FIXME: would it be safe to use the `dead' field for
+ this? Doubtful.) */
+ for (next = rev1;
+ next != NULL && (after == NULL || strcmp (next, after) != 0);
+ next = revp->next)
+ {
+ nodep = findnode (rcs->versions, next);
+ revp = (RCSVers *) nodep->data;
+ revp->outdated = 1;
+ }
+
+ /* Update delta links. If BEFORE == NULL, we're changing the
+ head of the tree and don't need to update any `next' links. */
+ if (before != NULL)
+ {
+ /* If REV1 is the first node on its branch, then BEFORE is its
+ root node (on the trunk) and we have to update its branches
+ list. Otherwise, BEFORE is on the same branch as AFTER, and
+ we can just change BEFORE's `next' field to point to AFTER.
+ (This should be safe: since findnode manages its lists via
+ the `hashnext' and `hashprev' fields, rather than `next' and
+ `prev', mucking with `next' and `prev' should not corrupt the
+ delta tree's internal structure. Much. -twp) */
+
+ if (rev1 == NULL)
+ /* beforep's ->next field already should be equal to after,
+ which I think is always NULL in this case. */
+ ;
+ else if (strcmp (rev1, branchpoint) == 0)
+ {
+ nodep = findnode (rcs->versions, before);
+ revp = (RCSVers *) nodep->data;
+ nodep = revp->branches->list->next;
+ while (nodep != revp->branches->list &&
+ strcmp (nodep->key, rev1) != 0)
+ nodep = nodep->next;
+ assert (nodep != revp->branches->list);
+ if (after == NULL)
+ delnode (nodep);
+ else
+ {
+ free (nodep->key);
+ nodep->key = xstrdup (after);
+ }
+ }
+ else
+ {
+ nodep = findnode (rcs->versions, before);
+ beforep = (RCSVers *) nodep->data;
+ free (beforep->next);
+ beforep->next = xstrdup (after);
+ }
+ }
+
+ status = 0;
+
+ delrev_done:
+ if (rev1 != NULL)
+ free (rev1);
+ if (rev2 != NULL)
+ free (rev2);
+ if (branchpoint != NULL)
+ free (branchpoint);
+ if (before != NULL)
+ free (before);
+ if (after != NULL)
+ free (after);
+
+ save_noexec = noexec;
+ noexec = 0;
+ if (beforefile != NULL)
+ {
+ if (unlink_file (beforefile) < 0)
+ error (0, errno, "cannot remove %s", beforefile);
+ free (beforefile);
+ }
+ if (afterfile != NULL)
+ {
+ if (unlink_file (afterfile) < 0)
+ error (0, errno, "cannot remove %s", afterfile);
+ free (afterfile);
+ }
+ if (outfile != NULL)
+ {
+ if (unlink_file (outfile) < 0)
+ error (0, errno, "cannot remove %s", outfile);
+ free (outfile);
+ }
+ noexec = save_noexec;
+
+ return status;
+}
+
+/* RCS_deltas and friends. Processing of the deltas in RCS files. */
+
struct line
{
- /* Text of this line. */
+ /* Text of this line. Part of the same malloc'd block as the struct
+ line itself (we probably should use the "struct hack" (char text[1])
+ and save ourselves sizeof (char *) bytes). Does not include \n;
+ instead has_newline indicates the presence or absence of \n. */
char *text;
/* Length of this line, not counting \n if has_newline is true. */
size_t len;
@@ -3410,6 +5025,8 @@ struct line
/* Nonzero if this line ends with \n. This will always be true
except possibly for the last line. */
int has_newline;
+ /* Number of pointers to this struct line. */
+ int refcount;
};
struct linevector
@@ -3434,30 +5051,36 @@ linevector_init (vec)
vec->vector = NULL;
}
-static int linevector_add PROTO ((struct linevector *vec, char *text,
+static int linevector_add PROTO ((struct linevector *vec, const char *text,
size_t len, RCSVers *vers,
unsigned int pos));
/* Given some text TEXT, add each of its lines to VEC before line POS
(where line 0 is the first line). The last line in TEXT may or may
- not be \n terminated. All \n in TEXT are changed to \0 (FIXME: I
- don't think this is needed, or used, now that we have the ->len
- field). Set the version for each of the new lines to VERS. This
+ not be \n terminated.
+ Set the version for each of the new lines to VERS. This
function returns non-zero for success. It returns zero if the line
- number is out of range. */
+ number is out of range.
+
+ Each of the lines in TEXT are copied to space which is managed with
+ the linevector (and freed by linevector_free). So the caller doesn't
+ need to keep TEXT around after the call to this function. */
static int
linevector_add (vec, text, len, vers, pos)
struct linevector *vec;
- char *text;
+ const char *text;
size_t len;
RCSVers *vers;
unsigned int pos;
{
- char *textend;
+ const char *textend;
unsigned int i;
unsigned int nnew;
- char *p;
- struct line *lines;
+ const char *p;
+ const char *nextline_text;
+ size_t nextline_len;
+ int nextline_newline;
+ struct line *q;
if (len == 0)
return 1;
@@ -3469,8 +5092,6 @@ linevector_add (vec, text, len, vers, pos)
for (p = text; p < textend; ++p)
if (*p == '\n' && p + 1 < textend)
++nnew;
- /* Allocate the struct line's. */
- lines = block_alloc (nnew * sizeof (struct line));
/* Expand VEC->VECTOR if needed. */
if (vec->nlines + nnew >= vec->lines_alloced)
@@ -3490,29 +5111,41 @@ linevector_add (vec, text, len, vers, pos)
if (pos > vec->nlines)
return 0;
- /* Actually add the lines, to LINES and VEC->VECTOR. */
+ /* Actually add the lines, to VEC->VECTOR. */
i = pos;
- lines[0].text = text;
- lines[0].vers = vers;
- lines[0].has_newline = 0;
- vec->vector[i++] = &lines[0];
+ nextline_text = text;
+ nextline_newline = 0;
for (p = text; p < textend; ++p)
if (*p == '\n')
{
- *p = '\0';
- lines[i - pos - 1].has_newline = 1;
+ nextline_newline = 1;
if (p + 1 == textend)
/* If there are no characters beyond the last newline, we
don't consider it another line. */
break;
- lines[i - pos - 1].len = p - lines[i - pos - 1].text;
- lines[i - pos].text = p + 1;
- lines[i - pos].vers = vers;
- lines[i - pos].has_newline = 0;
- vec->vector[i] = &lines[i - pos];
- ++i;
- }
- lines[i - pos - 1].len = p - lines[i - pos - 1].text;
+ nextline_len = p - nextline_text;
+ q = (struct line *) xmalloc (sizeof (struct line) + nextline_len);
+ q->vers = vers;
+ q->text = (char *)q + sizeof (struct line);
+ q->len = nextline_len;
+ q->has_newline = nextline_newline;
+ q->refcount = 1;
+ memcpy (q->text, nextline_text, nextline_len);
+ vec->vector[i++] = q;
+
+ nextline_text = (char *)p + 1;
+ nextline_newline = 0;
+ }
+ nextline_len = p - nextline_text;
+ q = (struct line *) xmalloc (sizeof (struct line) + nextline_len);
+ q->vers = vers;
+ q->text = (char *)q + sizeof (struct line);
+ q->len = nextline_len;
+ q->has_newline = nextline_newline;
+ q->refcount = 1;
+ memcpy (q->text, nextline_text, nextline_len);
+ vec->vector[i] = q;
+
vec->nlines += nnew;
return 1;
@@ -3533,6 +5166,11 @@ linevector_delete (vec, pos, nlines)
unsigned int last;
last = vec->nlines - nlines;
+ for (i = pos; i < pos + nlines; ++i)
+ {
+ if (--vec->vector[i]->refcount == 0)
+ free (vec->vector[i]);
+ }
for (i = pos; i < last; ++i)
vec->vector[i] = vec->vector[i + nlines];
vec->nlines -= nlines;
@@ -3546,6 +5184,13 @@ linevector_copy (to, from)
struct linevector *to;
struct linevector *from;
{
+ unsigned int ln;
+
+ for (ln = 0; ln < to->nlines; ++ln)
+ {
+ if (--to->vector[ln]->refcount == 0)
+ free (to->vector[ln]);
+ }
if (from->nlines > to->lines_alloced)
{
if (to->lines_alloced == 0)
@@ -3558,18 +5203,27 @@ linevector_copy (to, from)
memcpy (to->vector, from->vector,
from->nlines * sizeof (*to->vector));
to->nlines = from->nlines;
+ for (ln = 0; ln < to->nlines; ++ln)
+ ++to->vector[ln]->refcount;
}
static void linevector_free PROTO ((struct linevector *));
-/* Free storage associated with linevector (that is, the vector but
- not the lines pointed to). */
+/* Free storage associated with linevector. */
static void
linevector_free (vec)
struct linevector *vec;
{
+ unsigned int ln;
+
if (vec->vector != NULL)
+ {
+ for (ln = 0; ln < vec->nlines; ++ln)
+ if (--vec->vector[ln]->refcount == 0)
+ free (vec->vector[ln]);
+
free (vec->vector);
+ }
}
static char *month_printname PROTO ((char *));
@@ -3630,7 +5284,7 @@ apply_rcs_changes (lines, diffbuf, difflen, name, addvers, delvers)
enum {ADD, DELETE} type;
unsigned long pos;
unsigned long nlines;
- char *new_lines;
+ const char *new_lines;
size_t len;
struct deltafrag *next;
};
@@ -3683,9 +5337,8 @@ apply_rcs_changes (lines, diffbuf, difflen, name, addvers, delvers)
break;
}
- /* Copy the text we are adding into allocated space. */
- df->new_lines = block_alloc (q - p);
- memcpy (df->new_lines, p, q - p);
+ /* Stash away a pointer to the text we are adding. */
+ df->new_lines = p;
df->len = q - p;
p = q;
@@ -3735,9 +5388,9 @@ apply_rcs_changes (lines, diffbuf, difflen, name, addvers, delvers)
argument. NAME is used in error messages. TEXTBUF is the text
buffer to change, and TEXTLEN is the size. DIFFBUF and DIFFLEN are
the change buffer and size. The new buffer is returned in *RETBUF
- and *RETLEN. The new buffer is allocated by xmalloc. The function
- changes the contents of TEXTBUF. This function returns 1 for
- success. On failure, it calls error and returns 0. */
+ and *RETLEN. The new buffer is allocated by xmalloc.
+
+ Return 1 for success. On failure, call error and return 0. */
int
rcs_change_text (name, textbuf, textlen, diffbuf, difflen, retbuf, retlen)
@@ -3795,11 +5448,6 @@ rcs_change_text (name, textbuf, textlen, diffbuf, difflen, retbuf, retlen)
linevector_free (&lines);
- /* Note that this assumes that we have not called from anything
- else which uses the block vectors. FIXME: We could fix this by
- saving and restoring the state of the block allocation code. */
- block_free ();
-
return ret;
}
@@ -3851,19 +5499,11 @@ RCS_deltas (rcs, fp, version, op, text, len, log, loglen)
if (fp == NULL)
{
- if (rcs->flags & NODELTA)
- {
- free_rcsnode_contents (rcs);
- RCS_reparsercsfile (rcs, 0, &fp);
- }
- else
- {
- fp = CVS_FOPEN (rcs->path, FOPEN_BINARY_READ);
- if (fp == NULL)
- error (1, 0, "unable to reopen `%s'", rcs->path);
- if (fseek (fp, rcs->delta_pos, SEEK_SET) != 0)
- error (1, 0, "cannot fseek RCS file");
- }
+ fp = CVS_FOPEN (rcs->path, FOPEN_BINARY_READ);
+ if (fp == NULL)
+ error (1, 0, "unable to reopen `%s'", rcs->path);
+ if (fseek (fp, rcs->delta_pos, SEEK_SET) != 0)
+ error (1, 0, "cannot fseek RCS file");
}
ishead = 1;
@@ -3940,12 +5580,7 @@ RCS_deltas (rcs, fp, version, op, text, len, log, loglen)
{
if (ishead)
{
- char *p;
-
- p = block_alloc (vallen);
- memcpy (p, value, vallen);
-
- if (! linevector_add (&curlines, p, vallen, NULL, 0))
+ if (! linevector_add (&curlines, value, vallen, NULL, 0))
error (1, 0, "invalid rcs file %s", rcs->path);
ishead = 0;
@@ -4084,7 +5719,18 @@ RCS_deltas (rcs, fp, version, op, text, len, log, loglen)
/* Now output the date. */
ym = strchr (prvers->date, '.');
if (ym == NULL)
- cvs_output ("?\?-??\?-??", 0);
+ {
+ /* ??- is an ANSI trigraph. The ANSI way to
+ avoid it is \? but some pre ANSI compilers
+ complain about the unrecognized escape
+ sequence. Of course string concatenation
+ ("??" "-???") is also an ANSI-ism. Testing
+ __STDC__ seems to be a can of worms, since
+ compilers do all kinds of things with it. */
+ cvs_output ("??", 0);
+ cvs_output ("-???", 0);
+ cvs_output ("-??", 0);
+ }
else
{
md = strchr (ym + 1, '.');
@@ -4102,8 +5748,9 @@ RCS_deltas (rcs, fp, version, op, text, len, log, loglen)
cvs_output (ym - 2, 2);
}
cvs_output ("): ", 0);
- cvs_output (headlines.vector[ln]->text,
- headlines.vector[ln]->len);
+ if (headlines.vector[ln]->len != 0)
+ cvs_output (headlines.vector[ln]->text,
+ headlines.vector[ln]->len);
cvs_output ("\n", 1);
}
}
@@ -4141,7 +5788,6 @@ RCS_deltas (rcs, fp, version, op, text, len, log, loglen)
linevector_free (&headlines);
linevector_free (&trunklines);
- block_free ();
return;
l_error:
@@ -4151,6 +5797,720 @@ RCS_deltas (rcs, fp, version, op, text, len, log, loglen)
error (1, 0, "%s does not appear to be a valid rcs file",
rcs->path);
}
+
+static RCSVers *
+getdelta (fp, rcsfile)
+ FILE *fp;
+ char *rcsfile;
+{
+ RCSVers *vnode;
+ char *key, *value, *cp;
+ long fpos;
+ Node *kv;
+
+ vnode = (RCSVers *) xmalloc (sizeof (RCSVers));
+ memset (vnode, 0, sizeof (RCSVers));
+
+ /* Get revision number. This uses getrcskey because it doesn't
+ croak when encountering unexpected input. As a result, we have
+ to play unholy games with `key' and `value'. */
+ fpos = ftell (fp);
+ getrcskey (fp, &key, &value, NULL);
+
+ /* Make sure that it is a revision number and not a cabbage
+ or something. */
+ for (cp = key; (isdigit (*cp) || *cp == '.') && *cp != '\0'; cp++)
+ /* do nothing */ ;
+ if (*cp != '\0' || strncmp (RCSDATE, value, strlen (RCSDATE)) != 0)
+ {
+ (void) fseek (fp, fpos, SEEK_SET);
+ free (vnode);
+ return NULL;
+ }
+ vnode->version = xstrdup (key);
+
+ /* grab the value of the date from value */
+ cp = value + strlen (RCSDATE);/* skip the "date" keyword */
+ while (whitespace (*cp)) /* take space off front of value */
+ cp++;
+
+ vnode->date = xstrdup (cp);
+
+ /* Get author field. */
+ (void) getrcskey (fp, &key, &value, NULL);
+ /* FIXME: should be using errno in case of ferror. */
+ if (key == NULL || strcmp (key, "author") != 0)
+ error (1, 0, "\
+unable to parse rcs file; `author' not in the expected place");
+ vnode->author = xstrdup (value);
+
+ /* Get state field. */
+ (void) getrcskey (fp, &key, &value, NULL);
+ /* FIXME: should be using errno in case of ferror. */
+ if (key == NULL || strcmp (key, "state") != 0)
+ error (1, 0, "\
+unable to parse rcs file; `state' not in the expected place");
+ vnode->state = xstrdup (value);
+ if (strcmp (value, "dead") == 0)
+ {
+ vnode->dead = 1;
+ }
+
+ /* Note that "branches" and "next" are in fact mandatory, according
+ to doc/RCSFILES. We perhaps should be giving an error if they
+ are not there. */
+
+ /* fill in the branch list (if any branches exist) */
+ fpos = ftell (fp);
+ (void) getrcskey (fp, &key, &value, NULL);
+ /* FIXME: should be handling various error conditions better. */
+ if (key != NULL && strcmp (key, RCSDESC) == 0)
+ {
+ (void) fseek (fp, fpos, SEEK_SET);
+ return vnode;
+ }
+ if (value != (char *) NULL)
+ {
+ vnode->branches = getlist ();
+ do_branches (vnode->branches, value);
+ }
+
+ /* fill in the next field if there is a next revision */
+ fpos = ftell (fp);
+ (void) getrcskey (fp, &key, &value, NULL);
+ /* FIXME: should be handling various error conditions better. */
+ if (key != NULL && strcmp (key, RCSDESC) == 0)
+ {
+ (void) fseek (fp, fpos, SEEK_SET);
+ return vnode;
+ }
+ if (value != (char *) NULL)
+ vnode->next = xstrdup (value);
+
+ /*
+ * XXX - this is where we put the symbolic link stuff???
+ * (into newphrases in the deltas).
+ */
+ /* FIXME: Does not correctly handle errors, e.g. from stdio. */
+ while (1)
+ {
+ fpos = ftell (fp);
+ if (getrcskey (fp, &key, &value, NULL) < 0)
+ break;
+
+ assert (key != NULL);
+
+ if (strcmp (key, RCSDESC) == 0)
+ break;
+
+ /* Enable use of repositories created by certain obsolete
+ versions of CVS. This code should remain indefinately;
+ there is no procedure for converting old repositories, and
+ checking for it is harmless. */
+ if (strcmp(key, RCSDEAD) == 0)
+ {
+ vnode->dead = 1;
+ if (vnode->state != NULL)
+ free (vnode->state);
+ vnode->state = xstrdup ("dead");
+ continue;
+ }
+ /* if we have a new revision number, we're done with this delta */
+ for (cp = key; (isdigit (*cp) || *cp == '.') && *cp != '\0'; cp++)
+ /* do nothing */ ;
+ if (*cp == '\0' && strncmp (RCSDATE, value, strlen (RCSDATE)) == 0)
+ break;
+
+ /* At this point, key and value represent a user-defined field
+ in the delta node. */
+ if (vnode->other_delta == NULL)
+ vnode->other_delta = getlist ();
+ kv = getnode ();
+ kv->type = RCSFIELD;
+ kv->key = xstrdup (key);
+ kv->data = xstrdup (value);
+ if (addnode (vnode->other_delta, kv) != 0)
+ {
+ /* Complaining about duplicate keys in newphrases seems
+ questionable, in that we don't know what they mean and
+ doc/RCSFILES has no prohibition on several newphrases
+ with the same key. But we can't store more than one as
+ long as we store them in a List *. */
+ error (0, 0, "warning: duplicate key `%s' in RCS file `%s'",
+ key, rcsfile);
+ freenode (kv);
+ }
+ }
+
+ /* We got here because we read beyond the end of a delta. Seek back
+ to the beginning of the erroneous read. */
+ (void) fseek (fp, fpos, SEEK_SET);
+
+ return vnode;
+}
+
+static void
+freedeltatext (d)
+ Deltatext *d;
+{
+ if (d->version != NULL)
+ free (d->version);
+ if (d->log != NULL)
+ free (d->log);
+ if (d->text != NULL)
+ free (d->text);
+ if (d->other != (List *) NULL)
+ dellist (&d->other);
+ free (d);
+}
+
+static Deltatext *
+RCS_getdeltatext (rcs, fp)
+ RCSNode *rcs;
+ FILE *fp;
+{
+ char *num;
+ char *key, *value;
+ int n;
+ Node *p;
+ Deltatext *d;
+ size_t textlen;
+
+ /* Get the revision number. */
+ n = getrevnum (fp, &num);
+ if (ferror (fp))
+ error (1, errno, "%s: cannot read", rcs->path);
+ if (n == EOF)
+ {
+ /* If n == EOF and num == NULL, it means we reached EOF
+ naturally. That's fine. */
+ if (num == NULL)
+ return NULL;
+ else
+ error (1, 0, "%s: unexpected EOF", rcs->path);
+ }
+
+ p = findnode (rcs->versions, num);
+ if (p == NULL)
+ error (1, 0, "mismatch in rcs file %s between deltas and deltatexts",
+ rcs->path);
+
+ d = (Deltatext *) xmalloc (sizeof (Deltatext));
+ d->version = xstrdup (num);
+
+ /* Get the log message. */
+ if (getrcskey (fp, &key, &value, NULL) < 0)
+ error (1, 0, "%s, delta %s: unexpected EOF", rcs->path, num);
+ if (strcmp (key, "log") != 0)
+ error (1, 0, "%s, delta %s: expected `log', got `%s'",
+ rcs->path, num, key);
+ d->log = xstrdup (value);
+
+ /* Get random newphrases. */
+ d->other = getlist();
+ for (n = getrcskey (fp, &key, &value, &textlen);
+ n >= 0 && strcmp (key, "text") != 0;
+ n = getrcskey (fp, &key, &value, &textlen))
+ {
+ p = getnode();
+ p->type = RCSFIELD;
+ p->key = xstrdup (key);
+ p->data = xstrdup (value);
+ if (addnode (d->other, p) < 0)
+ {
+ error (0, 0, "warning: %s, delta %s: duplicate field `%s'",
+ rcs->path, num, key);
+ }
+ }
+ if (n < 0)
+ error (1, 0, "%s, delta %s: unexpected EOF", rcs->path, num);
+
+ /* Get the change text. We already know that this key is `text'. */
+ d->text = (char *) malloc (textlen + 1);
+ d->len = textlen;
+ memcpy (d->text, value, textlen);
+
+ return d;
+}
+
+/* RCS output functions, for writing RCS format files from RCSNode
+ structures.
+
+ For most of this work, RCS 5.7 uses an `aprintf' function which aborts
+ program upon error. Instead, these functions check the output status
+ of the stream right before closing it, and aborts if an error condition
+ is found. The RCS solution is probably the better one: it produces
+ more overhead, but will produce a clearer diagnostic in the case of
+ catastrophic error. In either case, however, the repository will probably
+ not get corrupted. */
+
+static int
+putsymbol_proc (symnode, fp)
+ Node *symnode;
+ void *fp;
+{
+ return fprintf ((FILE *) fp, "\n\t%s:%s", symnode->key, symnode->data);
+}
+
+static int putlock_proc PROTO ((Node *, void *));
+
+/* putlock_proc is like putsymbol_proc, but key and data are reversed. */
+
+static int
+putlock_proc (symnode, fp)
+ Node *symnode;
+ void *fp;
+{
+ return fprintf ((FILE *) fp, "\n\t%s:%s", symnode->data, symnode->key);
+}
+
+static int
+putrcsfield_proc (node, vfp)
+ Node *node;
+ void *vfp;
+{
+ FILE *fp = (FILE *) vfp;
+
+ /* Some magic keys used internally by CVS start with `;'. Skip them. */
+ if (node->key[0] == ';')
+ return 0;
+
+ fprintf (fp, "\n%s\t", node->key);
+ if (node->data != NULL)
+ {
+ /* If the field's value contains evil characters,
+ it must be stringified. */
+ /* FIXME: This does not quite get it right. "7jk8f" is not a legal
+ value for a value in a newpharse, according to doc/RCSFILES,
+ because digits are not valid in an "id". We might do OK by
+ always writing strings (enclosed in @@). Would be nice to
+ explicitly mention this one way or another in doc/RCSFILES.
+ A case where we are wrong in a much more clear-cut way is that
+ we let through non-graphic characters such as whitespace and
+ control characters. */
+ int n = strcspn (node->data, "$,.:;@");
+ if (node->data[n] == 0)
+ fputs (node->data, fp);
+ else
+ {
+ putc ('@', fp);
+ expand_at_signs (node->data, (off_t) strlen (node->data), fp);
+ putc ('@', fp);
+ }
+ }
+
+ /* desc, log and text fields should not be terminated with semicolon;
+ all other fields should be. */
+ if (strcmp (node->key, "desc") != 0 &&
+ strcmp (node->key, "log") != 0 &&
+ strcmp (node->key, "text") != 0)
+ {
+ putc (';', fp);
+ }
+ return 0;
+}
+
+/* Output the admin node for RCS into stream FP. */
+
+static void
+RCS_putadmin (rcs, fp)
+ RCSNode *rcs;
+ FILE *fp;
+{
+ fprintf (fp, "%s\t%s;\n", RCSHEAD, rcs->head ? rcs->head : "");
+ if (rcs->branch)
+ fprintf (fp, "%s\t%s;\n", RCSBRANCH, rcs->branch);
+
+ fputs ("access", fp);
+ if (rcs->access)
+ {
+ char *p, *s;
+ s = xstrdup (rcs->access);
+ for (p = strtok (s, " \n\t"); p != NULL; p = strtok (NULL, " \n\t"))
+ fprintf (fp, "\n\t%s", p);
+ free (s);
+ }
+ fputs (";\n", fp);
+
+ fputs (RCSSYMBOLS, fp);
+ walklist (RCS_symbols(rcs), putsymbol_proc, (void *) fp);
+ fputs (";\n", fp);
+
+ fputs ("locks", fp);
+ if (rcs->locks_data)
+ fprintf (fp, "\t%s", rcs->locks_data);
+ else if (rcs->locks)
+ walklist (rcs->locks, putlock_proc, (void *) fp);
+ if (rcs->strict_locks)
+ fprintf (fp, "; strict");
+ fputs (";\n", fp);
+
+ if (rcs->comment)
+ {
+ fprintf (fp, "comment\t@");
+ expand_at_signs (rcs->comment, (off_t) strlen (rcs->comment), fp);
+ fputs ("@;\n", fp);
+ }
+ if (rcs->expand && strcmp (rcs->expand, "kv") != 0)
+ fprintf (fp, "%s\t@%s@;\n", RCSEXPAND, rcs->expand);
+
+ walklist (rcs->other, putrcsfield_proc, (void *) fp);
+
+ putc ('\n', fp);
+}
+
+static void
+putdelta (vers, fp)
+ RCSVers *vers;
+ FILE *fp;
+{
+ Node *bp, *start;
+
+ /* Skip if no revision was supplied, or if it is outdated (cvs admin -o) */
+ if (vers == NULL || vers->outdated)
+ return;
+
+ fprintf (fp, "\n%s\n%s\t%s;\t%s %s;\t%s %s;\nbranches",
+ vers->version,
+ RCSDATE, vers->date,
+ "author", vers->author,
+ "state", vers->state ? vers->state : "");
+
+ if (vers->branches != NULL)
+ {
+ start = vers->branches->list;
+ for (bp = start->next; bp != start; bp = bp->next)
+ fprintf (fp, "\n\t%s", bp->key);
+ }
+
+ fprintf (fp, ";\nnext\t%s;", vers->next ? vers->next : "");
+
+ walklist (vers->other_delta, putrcsfield_proc, fp);
+
+ putc ('\n', fp);
+}
+
+static void
+RCS_putdtree (rcs, rev, fp)
+ RCSNode *rcs;
+ char *rev;
+ FILE *fp;
+{
+ RCSVers *versp;
+ Node *p, *branch;
+
+ if (rev == NULL)
+ return;
+
+ /* Find the delta node for this revision. */
+ p = findnode (rcs->versions, rev);
+ assert (p != NULL);
+ versp = (RCSVers *) p->data;
+
+ /* Print the delta node and recurse on its `next' node. This prints
+ the trunk. If there are any branches printed on this revision,
+ print those trunks as well. */
+ putdelta (versp, fp);
+ RCS_putdtree (rcs, versp->next, fp);
+ if (versp->branches != NULL)
+ {
+ branch = versp->branches->list;
+ for (p = branch->next; p != branch; p = p->next)
+ RCS_putdtree (rcs, p->key, fp);
+ }
+}
+
+static void
+RCS_putdesc (rcs, fp)
+ RCSNode *rcs;
+ FILE *fp;
+{
+ fprintf (fp, "\n\n%s\n@", RCSDESC);
+ if (rcs->desc != NULL)
+ {
+ off_t len = (off_t) strlen (rcs->desc);
+ if (len > 0)
+ {
+ expand_at_signs (rcs->desc, len, fp);
+ if (rcs->desc[len-1] != '\n')
+ putc ('\n', fp);
+ }
+ }
+ fputs ("@\n", fp);
+}
+
+static void
+putdeltatext (fp, d)
+ FILE *fp;
+ Deltatext *d;
+{
+ fprintf (fp, "\n\n%s\nlog\n@", d->version);
+ if (d->log != NULL)
+ {
+ int loglen = strlen (d->log);
+ expand_at_signs (d->log, (off_t) loglen, fp);
+ if (d->log[loglen-1] != '\n')
+ putc ('\n', fp);
+ }
+ putc ('@', fp);
+
+ walklist (d->other, putrcsfield_proc, fp);
+
+ fputs ("\ntext\n@", fp);
+ if (d->text != NULL)
+ expand_at_signs (d->text, (off_t) d->len, fp);
+ fputs ("@\n", fp);
+}
+
+/* TODO: the whole mechanism for updating deltas is kludgey... more
+ sensible would be to supply all the necessary info in a `newdeltatext'
+ field for RCSVers nodes. -twp */
+
+/* Copy delta text nodes from FIN to FOUT. If NEWDTEXT is non-NULL, it
+ is a new delta text node, and should be added to the tree at the
+ node whose revision number is INSERTPT. (Note that trunk nodes are
+ written in decreasing order, and branch nodes are written in
+ increasing order.) */
+
+static void
+RCS_copydeltas (rcs, fin, fout, newdtext, insertpt)
+ RCSNode *rcs;
+ FILE *fin;
+ FILE *fout;
+ Deltatext *newdtext;
+ char *insertpt;
+{
+ Deltatext *dtext;
+ RCSVers *dadmin;
+ Node *np;
+ int insertbefore, found;
+
+ /* Make a note of whether NEWDTEXT should be inserted
+ before or after its INSERTPT. */
+ insertbefore = (newdtext != NULL && numdots (newdtext->version) == 1);
+
+ found = 0;
+ while ((dtext = RCS_getdeltatext (rcs, fin)) != NULL)
+ {
+ found = (insertpt != NULL && strcmp (dtext->version, insertpt) == 0);
+ if (found && insertbefore)
+ putdeltatext (fout, newdtext);
+
+ np = findnode (rcs->versions, dtext->version);
+ dadmin = (RCSVers *) np->data;
+
+ /* If this revision has been outdated, just skip it. */
+ if (dadmin->outdated)
+ continue;
+
+ /* Update the change text for this delta. New change text
+ data may come from cvs admin -m, cvs admin -o, or cvs ci. */
+ if (dadmin->text != NULL)
+ {
+ if (dadmin->text->log != NULL)
+ {
+ free (dtext->log);
+ dtext->log = dadmin->text->log;
+ dadmin->text->log = NULL;
+ }
+ if (dadmin->text->text != NULL)
+ {
+ free (dtext->text);
+ dtext->text = dadmin->text->text;
+ dtext->len = dadmin->text->len;
+ dadmin->text->text = NULL;
+ }
+ }
+ putdeltatext (fout, dtext);
+ freedeltatext (dtext);
+
+ if (found && !insertbefore)
+ putdeltatext (fout, newdtext);
+ }
+ putc ('\n', fout);
+}
+
+/* RCS_internal_lockfile and RCS_internal_unlockfile perform RCS-style
+ locking on the specified RCSFILE: for a file called `foo,v', open
+ for writing a file called `,foo,'.
+
+ Note that we what do here is quite different from what RCS does.
+ RCS creates the ,foo, file before it reads the RCS file (if it
+ knows that it will be writing later), so that it actually serves as
+ a lock. We don't; instead we rely on CVS writelocks. This means
+ that if someone is running RCS on the file at the same time they
+ are running CVS on it, they might lose (we read the file,
+ then RCS writes it, then we write it, clobbering the
+ changes made by RCS). I believe the current sentiment about this
+ is "well, don't do that".
+
+ A concern has been expressed about whether adopting the RCS
+ strategy would slow us down. I don't think so, since we need to
+ write the ,foo, file anyway (unless perhaps if O_EXCL is slower or
+ something).
+
+ These do not perform quite the same function as the RCS -l option
+ for locking files: they are intended to prevent competing RCS
+ processes from stomping all over each other's laundry. Hence,
+ they are `internal' locking functions.
+
+ Note that we don't clean up the ,foo, file on ^C. We probably should.
+ I'm not completely sure whether RCS does or not (I looked at the code
+ a little, and didn't find it).
+
+ If there is an error, give a fatal error; if we return we always
+ return a non-NULL value. */
+
+static FILE *
+rcs_internal_lockfile (rcsfile)
+ char *rcsfile;
+{
+ char *lockfile;
+ int fd;
+ struct stat rstat;
+ FILE *fp;
+
+ /* Get the lock file name: `,file,' for RCS file `file,v'. */
+ lockfile = rcs_lockfilename (rcsfile);
+
+ /* Use the existing RCS file mode, or read-only if this is a new
+ file. (Really, this is a lie -- if this is a new file,
+ RCS_checkin uses the permissions from the working copy. For
+ actually creating the file, we use 0444 as a safe default mode.) */
+ if (stat (rcsfile, &rstat) < 0)
+ {
+ if (existence_error (errno))
+ rstat.st_mode = S_IRUSR | S_IRGRP | S_IROTH;
+ else
+ error (1, errno, "cannot stat %s", rcsfile);
+ }
+
+ /* Try to open exclusively. POSIX.1 guarantees that O_EXCL|O_CREAT
+ guarantees an exclusive open. According to the RCS source, with
+ NFS v2 we must also throw in O_TRUNC and use an open mask that makes
+ the file unwriteable. For extensive justification, see the comments for
+ rcswriteopen() in rcsedit.c, in RCS 5.7. This is kind of pointless
+ in the CVS case; see comment at the start of this file concerning
+ general ,foo, file strategy.
+
+ There is some sentiment that with NFSv3 and such, that one can
+ rely on O_EXCL these days. This might be true for unix (I
+ don't really know), but I am still pretty skeptical in the case
+ of the non-unix systems. */
+ fd = open (lockfile, OPEN_BINARY | O_WRONLY | O_CREAT | O_EXCL | O_TRUNC,
+ S_IRUSR | S_IRGRP | S_IROTH);
+
+ if (fd < 0)
+ {
+ error (1, errno, "could not open lock file `%s'", lockfile);
+ }
+
+ free (lockfile);
+
+ /* Force the file permissions, and return a stream object. */
+ /* Because we change the modes later, we don't worry about
+ this in the non-HAVE_FCHMOD case. */
+#ifdef HAVE_FCHMOD
+ if (fchmod (fd, rstat.st_mode) < 0)
+ error (1, errno, "cannot change mode for %s", lockfile);
+#endif
+ fp = fdopen (fd, FOPEN_BINARY_WRITE);
+ if (fp == NULL)
+ error (1, errno, "cannot fdopen %s", lockfile);
+ return fp;
+}
+
+static void
+rcs_internal_unlockfile (fp, rcsfile)
+ FILE *fp;
+ char *rcsfile;
+{
+ char *lockfile;
+
+ /* Get the lock file name: `,file,' for RCS file `file,v'. */
+ lockfile = rcs_lockfilename (rcsfile);
+
+ /* Abort if we could not write everything successfully to LOCKFILE.
+ This is not a great error-handling mechanism, but should prevent
+ corrupting the repository. */
+
+ if (ferror (fp))
+ error (1, 0, "error writing to lock file %s", lockfile);
+ if (fclose (fp) == EOF)
+ error (1, errno, "error closing lock file %s", lockfile);
+
+ rename_file (lockfile, rcsfile);
+ free (lockfile);
+}
+
+static char *
+rcs_lockfilename (rcsfile)
+ char *rcsfile;
+{
+ char *lockfile, *lockp;
+ char *rcsbase, *rcsp, *rcsend;
+ int rcslen;
+
+ /* Create the lockfile name. */
+ rcslen = strlen (rcsfile);
+ lockfile = (char *) xmalloc (rcslen + 10);
+ rcsbase = last_component (rcsfile);
+ rcsend = rcsfile + rcslen - sizeof(RCSEXT);
+ for (lockp = lockfile, rcsp = rcsfile; rcsp < rcsbase; ++rcsp)
+ *lockp++ = *rcsp;
+ *lockp++ = ',';
+ while (rcsp <= rcsend)
+ *lockp++ = *rcsp++;
+ *lockp++ = ',';
+ *lockp = '\0';
+
+ return lockfile;
+}
+
+/* Rewrite an RCS file. The basic idea here is that the caller should
+ first call RCS_reparsercsfile, then munge the data structures as
+ desired (via RCS_delete_revs, RCS_settag, &c), then call RCS_rewrite. */
+
+void
+RCS_rewrite (rcs, newdtext, insertpt)
+ RCSNode *rcs;
+ Deltatext *newdtext;
+ char *insertpt;
+{
+ FILE *fin, *fout;
+
+ if (noexec)
+ return;
+
+ fout = rcs_internal_lockfile (rcs->path);
+
+ RCS_putadmin (rcs, fout);
+ RCS_putdtree (rcs, rcs->head, fout);
+ RCS_putdesc (rcs, fout);
+
+ /* Open the original RCS file and seek to the first delta text. */
+ if ((fin = CVS_FOPEN (rcs->path, FOPEN_BINARY_READ)) == NULL)
+ error (1, errno, "cannot open RCS file `%s' for reading", rcs->path);
+ if (fseek (fin, rcs->delta_pos, SEEK_SET) < 0)
+ error (1, errno, "cannot fseek in RCS file %s", rcs->path);
+
+ /* Update delta_pos to the current position in the output file.
+ Do NOT move these statements: they must be done after fin has
+ been positioned at the old delta_pos, but before any delta
+ texts have been written to fout. */
+ rcs->delta_pos = ftell (fout);
+ if (rcs->delta_pos == -1)
+ error (1, errno, "cannot ftell in RCS file %s", rcs->path);
+
+ RCS_copydeltas (rcs, fin, fout, newdtext, insertpt);
+
+ if (ferror (fin))
+ error (0, errno, "warning: when closing RCS file `%s'", rcs->path);
+ if (fclose (fin) < 0)
+ error (0, errno, "warning: closing RCS file `%s'", rcs->path);
+
+ rcs_internal_unlockfile (fout, rcs->path);
+}
/* Annotate command. In rcs.c for historical reasons (from back when
@@ -4176,7 +6536,7 @@ annotate_fileproc (callerdat, finfo)
return (1);
if (finfo->rcs->flags & PARTIAL)
- RCS_reparsercsfile (finfo->rcs, 0, &fp);
+ RCS_reparsercsfile (finfo->rcs, &fp);
version = RCS_getversion (finfo->rcs, tag, date, force_tag_match,
(int *) NULL);
@@ -4203,6 +6563,7 @@ static const char *const annotate_usage[] =
"\t-f\tUse head revision if tag/date not found.\n",
"\t-r rev\tAnnotate file as of specified revision/tag.\n",
"\t-D date\tAnnotate file as of specified date.\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -4274,3 +6635,57 @@ annotate (argc, argv)
argc, argv, local, W_LOCAL, 0, 1, (char *)NULL,
1);
}
+
+/*
+ * For a given file with full pathname PATH and revision number REV,
+ * produce a file label suitable for passing to diff. The default
+ * file label as used by RCS 5.7 looks like this:
+ *
+ * FILENAME <tab> YYYY/MM/DD <sp> HH:MM:SS <tab> REVNUM
+ *
+ * The date and time used are the revision's last checkin date and time.
+ * If REV is NULL, use the working copy's mtime instead.
+ */
+char *
+make_file_label (path, rev, rcs)
+ char *path;
+ char *rev;
+ RCSNode *rcs;
+{
+ char datebuf[MAXDATELEN];
+ char *label;
+ char *file;
+
+ file = last_component (path);
+ label = (char *) xmalloc (strlen (file)
+ + (rev == NULL ? 0 : strlen (rev))
+ + 50);
+
+ if (rev)
+ {
+ char *date;
+ RCS_getrevtime (rcs, rev, datebuf, 0);
+ date = printable_date (datebuf);
+ (void) sprintf (label, "-L%s\t%s\t%s", file, date, rev);
+ free (date);
+ }
+ else
+ {
+ struct stat sb;
+ struct tm *wm;
+
+ if (CVS_STAT (file, &sb) < 0)
+ error (0, 1, "could not get info for `%s'", path);
+ else
+ {
+ wm = gmtime (&sb.st_mtime);
+ (void) sprintf (datebuf, "%04d/%02d/%02d %02d:%02d:%02d",
+ wm->tm_year + 1900, wm->tm_mon + 1,
+ wm->tm_mday, wm->tm_hour,
+ wm->tm_min, wm->tm_sec);
+ (void) sprintf (label, "-L%s\t%s", file, datebuf);
+ }
+ }
+ return label;
+}
+
diff --git a/contrib/cvs/src/rcs.h b/contrib/cvs/src/rcs.h
index 1855fb9..d0f47bb 100644
--- a/contrib/cvs/src/rcs.h
+++ b/contrib/cvs/src/rcs.h
@@ -3,16 +3,11 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* RCS source control definitions needed by rcs.c and friends
*/
-#define RCS "rcs"
-#define RCS_CI "ci"
-#define RCS_DIFF "rcsdiff"
-#define RCS_RCSMERGE "rcsmerge"
-
/* String which indicates a conflict if it occurs at the start of a line. */
#define RCS_MERGE_PAT ">>>>>>> "
@@ -40,11 +35,21 @@
#define VALID 0x1 /* flags field contains valid data */
#define INATTIC 0x2 /* RCS file is located in the Attic */
#define PARTIAL 0x4 /* RCS file not completly parsed */
-#define NODELTA 0x8 /* delta_pos no longer valid */
+
+/* All the "char *" fields in RCSNode, Deltatext, and RCSVers are
+ '\0'-terminated (except "text" in Deltatext). This means that we
+ can't deal with fields containing '\0', which is a limitation that
+ RCS does not have. Would be nice to fix this some day. */
struct rcsnode
{
+ /* Reference count for this structure. Used to deal with the
+ fact that there might be a pointer from the Vers_TS or might
+ not. Callers who increment this field are responsible for
+ calling freercsnode when they are done with their reference. */
int refcount;
+
+ /* Flags (INATTIC, PARTIAL, &c), see above. */
int flags;
/* File name of the RCS file. This is not necessarily the name
@@ -53,28 +58,102 @@ struct rcsnode
(the various names might differ in case). */
char *path;
+ /* Value for head keyword from RCS header, or NULL if empty. */
char *head;
+
+ /* Value for branch keyword from RCS header, or NULL if omitted. */
char *branch;
+
+ /* Raw data on symbolic revisions. The first time that RCS_symbols is
+ called, we parse these into ->symbols, and free ->symbols_data. */
char *symbols_data;
+
+ /* Value for expand keyword from RCS header, or NULL if omitted. */
char *expand;
+
+ /* List of nodes, the key of which is the symbolic name and the data
+ of which is the numeric revision that it corresponds to (malloc'd). */
List *symbols;
+
+ /* List of nodes (type RCSVERS), the key of which the numeric revision
+ number, and the data of which is an RCSVers * for the revision. */
List *versions;
+
+ /* Value for access keyword from RCS header, or NULL if empty.
+ FIXME: RCS_delaccess would also seem to use "" for empty. We
+ should pick one or the other. */
+ char *access;
+
+ /* Raw data on locked revisions. The first time that RCS_getlocks is
+ called, we parse these into ->locks, and free ->locks_data. */
+ char *locks_data;
+
+ /* List of nodes, the key of which is the numeric revision and the
+ data of which is the user that it corresponds to (malloc'd). */
+ List *locks;
+
+ /* Set for the strict keyword from the RCS header. */
+ int strict_locks;
+
+ /* Value for the comment keyword from RCS header (comment leader), or
+ NULL if omitted. */
+ char *comment;
+
+ /* Value for the desc field in the RCS file, or NULL if empty. */
+ char *desc;
+
+ /* File offset of the first deltatext node, so we can seek there. */
long delta_pos;
+
+ /* Newphrases from the RCS header. List of nodes, the key of which
+ is the "id" which introduces the newphrase, and the value of which
+ is the value from the newphrase. */
List *other;
};
typedef struct rcsnode RCSNode;
+struct deltatext {
+ char *version;
+
+ /* Log message, or NULL if we do not intend to change the log message
+ (that is, RCS_copydeltas should just use the log message from the
+ file). */
+ char *log;
+
+ /* Change text, or NULL if we do not intend to change the change text
+ (that is, RCS_copydeltas should just use the change text from the
+ file). Note that it is perfectly legal to have log be NULL and
+ text non-NULL, or vice-versa. */
+ char *text;
+ size_t len;
+
+ /* Newphrase fields from deltatext nodes. FIXME: duplicates the
+ other field in the rcsversnode, I think. */
+ List *other;
+};
+typedef struct deltatext Deltatext;
+
struct rcsversnode
{
+ /* Duplicate of the key by which this structure is indexed. */
char *version;
+
char *date;
char *author;
char *state;
char *next;
int dead;
+ int outdated;
+ Deltatext *text;
List *branches;
+ /* Newphrase fields from deltatext nodes. Also contains ";add" and
+ ";delete" magic fields (see rcs.c, log.c). I think this is
+ only used by log.c (where it looks up "log"). Duplicates the
+ other field in struct deltatext, I think. */
List *other;
+ /* Newphrase fields from delta nodes. */
+ List *other_delta;
};
typedef struct rcsversnode RCSVers;
@@ -96,6 +175,8 @@ typedef void (*RCSCHECKOUTPROC) PROTO ((void *, const char *, size_t));
RCSNode *RCS_parse PROTO((const char *file, const char *repos));
RCSNode *RCS_parsercsfile PROTO((char *rcsfile));
void RCS_fully_parse PROTO((RCSNode *));
+void RCS_reparsercsfile PROTO((RCSNode *, FILE **));
+
char *RCS_check_kflag PROTO((const char *arg));
char *RCS_getdate PROTO((RCSNode * rcs, char *date, int force_tag_match));
char *RCS_gettag PROTO((RCSNode * rcs, char *symtag, int force_tag_match,
@@ -111,6 +192,7 @@ int RCS_datecmp PROTO((char *date1, char *date2));
time_t RCS_getrevtime PROTO((RCSNode * rcs, char *rev, char *date, int fudge));
List *RCS_symbols PROTO((RCSNode *rcs));
void RCS_check_tag PROTO((const char *tag));
+List *RCS_getlocks PROTO((RCSNode *rcs));
void freercsnode PROTO((RCSNode ** rnodep));
char *RCS_getbranch PROTO((RCSNode * rcs, char *tag, int force_tag_match));
@@ -118,15 +200,24 @@ int RCS_isdead PROTO((RCSNode *, const char *));
char *RCS_getexpand PROTO ((RCSNode *));
int RCS_checkout PROTO ((RCSNode *, char *, char *, char *, char *, char *,
RCSCHECKOUTPROC, void *));
+int RCS_checkin PROTO ((RCSNode *rcs, char *workfile, char *message,
+ char *rev, int flags));
int RCS_cmp_file PROTO ((RCSNode *, char *, char *, const char *));
int RCS_settag PROTO ((RCSNode *, const char *, const char *));
-int RCS_deltag PROTO ((RCSNode *, const char *, int));
+int RCS_deltag PROTO ((RCSNode *, const char *));
int RCS_setbranch PROTO((RCSNode *, const char *));
int RCS_lock PROTO ((RCSNode *, const char *, int));
int RCS_unlock PROTO ((RCSNode *, const char *, int));
+int RCS_delete_revs PROTO ((RCSNode *, char *, char *, int));
+void RCS_addaccess PROTO ((RCSNode *, char *));
+void RCS_delaccess PROTO ((RCSNode *, char *));
+char *RCS_getaccess PROTO ((RCSNode *));
+void RCS_rewrite PROTO ((RCSNode *, Deltatext *, char *));
int rcs_change_text PROTO ((const char *, char *, size_t, const char *,
size_t, char **, size_t *));
+char *make_file_label PROTO ((char *, char *, RCSNode *));
/* From import.c. */
-extern int add_rcs_file PROTO ((char *, char *, char *, char *,
- char *, char *, int, char **, FILE *));
+extern int add_rcs_file PROTO ((char *, char *, char *, char *, char *,
+ char *, char *, int, char **,
+ char *, size_t, FILE *));
diff --git a/contrib/cvs/src/rcscmds.c b/contrib/cvs/src/rcscmds.c
index 1f356cf..9a237a9 100644
--- a/contrib/cvs/src/rcscmds.c
+++ b/contrib/cvs/src/rcscmds.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* The functions in this file provide an interface for performing
* operations directly on RCS files.
@@ -12,16 +12,8 @@
#include "cvs.h"
#include <assert.h>
-/* This file, rcs.h, and rcs.c, are intended to define our interface
- to RCS files. As of July, 1996, there are still a few places that
- still exec RCS commands directly. The intended long-term direction
- is to have CVS access RCS files via an RCS library (rcs.c can be
- considered a start at one), for performance, cleanliness (CVS has
- some awful hacks to work around RCS behaviors which don't make
- sense for CVS), installation hassles, ease of implementing the CVS
- server (I don't think that the output-out-of-order bug can be
- completely fixed as long as CVS calls RCS), and perhaps other
- reasons.
+/* This file, rcs.h, and rcs.c, together sometimes known as the "RCS
+ library", are intended to define our interface to RCS files.
Whether there will also be a version of RCS which uses this
library, or whether the library will be packaged for uses beyond
@@ -32,7 +24,7 @@
existing CVS code which accesses RCS files. In particular, simple
approaches will often be slow.
- 2. An RCS library should not use the code from the current RCS
+ 2. An RCS library should not use code from the current RCS
(5.7 and its ancestors). The code has many problems. Too few
comments, too many layers of abstraction, too many global variables
(the correct number for a library is zero), too much intricately
@@ -54,169 +46,514 @@
See doc/RCSFILES in the CVS distribution for documentation of this
file format.
- On somewhat related notes:
+ On a related note, see the comments at diff_exec, later in this file,
+ for more on the diff library. */
- 1. A library for diff is an obvious idea. The one thing which I'm
- not so sure about is that I think CVS probably wants the ability to
- allow arbitrarily-bizarre (and possibly customized for particular
- file formats) external diff programs.
+static void RCS_output_diff_options PROTO ((char *, char *, char *, char *));
- 2. A library for patch is another such idea. CVS's needs are
- smaller than the functionality of the standalone patch program (it
- only calls patch in the client, and only needs to be able to patch
- unmodified versions, which is something that RCS_deltas already
- does in a different context). But it is silly for CVS to be making
- people install patch as well as CVS for such a simple purpose. */
-/* For RCS file PATH, make symbolic tag TAG point to revision REV.
- This validates that TAG is OK for a user to use. Return value is
- -1 for error (and errno is set to indicate the error), positive for
- error (and an error message has been printed), or zero for success. */
+/* Stuff to deal with passing arguments the way libdiff.a wants to deal
+ with them. This is a crufty interface; there is no good reason for it
+ to resemble a command line rather than something closer to "struct
+ log_data" in log.c. */
-int
-RCS_exec_settag(path, tag, rev)
- const char *path;
- const char *tag;
- const char *rev;
+/* First call call_diff_setup to setup any initial arguments. The
+ argument will be parsed into whitespace separated words and added
+ to the global call_diff_argv list.
+
+ Then, optionally, call call_diff_arg for each additional argument
+ that you'd like to pass to the diff library.
+
+ Finally, call call_diff or call_diff3 to produce the diffs. */
+
+static char **call_diff_argv;
+static int call_diff_argc;
+static int call_diff_argc_allocated;
+
+static void call_diff_add_arg PROTO ((const char *));
+static void call_diff_setup PROTO ((const char *prog));
+static int call_diff PROTO ((char *out));
+static int call_diff3 PROTO ((char *out));
+
+/* VARARGS */
+static void
+call_diff_setup (prog)
+ const char *prog;
{
- run_setup ("%s%s -x,v/ -q -N%s:%s", Rcsbin, RCS, tag, rev);
- run_arg (path);
- return run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL);
+ char *cp;
+ int i;
+ char *call_diff_prog;
+
+ /* clean out any malloc'ed values from call_diff_argv */
+ for (i = 0; i < call_diff_argc; i++)
+ {
+ if (call_diff_argv[i])
+ {
+ free (call_diff_argv[i]);
+ call_diff_argv[i] = (char *) 0;
+ }
+ }
+ call_diff_argc = 0;
+
+ call_diff_prog = xstrdup (prog);
+
+ /* put each word into call_diff_argv, allocating it as we go */
+ for (cp = strtok (call_diff_prog, " \t");
+ cp != NULL;
+ cp = strtok ((char *) NULL, " \t"))
+ call_diff_add_arg (cp);
+ free (call_diff_prog);
}
-/* NOERR is 1 to suppress errors--FIXME it would
- be better to avoid the errors or some cleaner solution. */
-int
-RCS_exec_deltag(path, tag, noerr)
- const char *path;
- const char *tag;
- int noerr;
+static void
+call_diff_arg (s)
+ const char *s;
{
- run_setup ("%s%s -x,v/ -q -N%s", Rcsbin, RCS, tag);
- run_arg (path);
- return run_exec (RUN_TTY, RUN_TTY, noerr ? DEVNULL : RUN_TTY, RUN_NORMAL);
+ call_diff_add_arg (s);
}
-/* set RCS branch to REV */
-int
-RCS_exec_setbranch(path, rev)
- const char *path;
- const char *rev;
+static void
+call_diff_add_arg (s)
+ const char *s;
{
- run_setup ("%s%s -x,v/ -q -b%s", Rcsbin, RCS, rev ? rev : "");
- run_arg (path);
- return run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL);
+ /* allocate more argv entries if we've run out */
+ if (call_diff_argc >= call_diff_argc_allocated)
+ {
+ call_diff_argc_allocated += 50;
+ call_diff_argv = (char **)
+ xrealloc ((char *) call_diff_argv,
+ call_diff_argc_allocated * sizeof (char **));
+ }
+
+ if (s)
+ call_diff_argv[call_diff_argc++] = xstrdup (s);
+ else
+ /* Not post-incremented on purpose! */
+ call_diff_argv[call_diff_argc] = (char *) 0;
}
-/* Lock revision REV. NOERR is 1 to suppress errors--FIXME it would
- be better to avoid the errors or some cleaner solution. */
-int
-RCS_exec_lock(path, rev, noerr)
- const char *path;
- const char *rev;
- int noerr;
+/* diff_run is imported from libdiff.a. */
+extern int diff_run PROTO ((int argc, char **argv, char *out));
+
+static int
+call_diff (out)
+ char *out;
{
- run_setup ("%s%s -x,v/ -q -l%s", Rcsbin, RCS, rev ? rev : "");
- run_arg (path);
- return run_exec (RUN_TTY, RUN_TTY, noerr ? DEVNULL : RUN_TTY, RUN_NORMAL);
+ /* Try to keep the out-of-order bugs at bay (protocol_pipe for cvs_output
+ with has "Index: foo" and such; stdout and/or stderr for diff's
+ output). I think the only reason that this used to not be such
+ a problem is that the time spent on the fork() and exec() of diff
+ slowed us down enough to let the "Index:" make it through first.
+
+ The real fix, of course, will be to have the diff library do all
+ its output through callbacks (which CVS will supply as cvs_output
+ and cvs_outerr). */
+ sleep (1);
+
+ if (out == RUN_TTY)
+ return diff_run (call_diff_argc, call_diff_argv, NULL);
+ else
+ return diff_run (call_diff_argc, call_diff_argv, out);
}
-/* Unlock revision REV. NOERR is 1 to suppress errors--FIXME it would
- be better to avoid the errors or some cleaner solution. */
-int
-RCS_exec_unlock(path, rev, noerr)
- const char *path;
- const char *rev;
- int noerr;
+extern int diff3_run PROTO ((int argc, char **argv, char *out));
+
+static int
+call_diff3 (out)
+ char *out;
{
- run_setup ("%s%s -x,v/ -q -u%s", Rcsbin, RCS, rev ? rev : "");
- run_arg (path);
- return run_exec (RUN_TTY, RUN_TTY, noerr ? DEVNULL : RUN_TTY, RUN_NORMAL);
+ /* Try to keep the out-of-order bugs at bay (protocol_pipe for cvs_output
+ with has "Index: foo" and such; stdout and/or stderr for diff's
+ output). I think the only reason that this used to not be such
+ a problem is that the time spent on the fork() and exec() of diff
+ slowed us down enough to let the "Index:" make it through first.
+
+ The real fix, of course, will be to have the diff library do all
+ its output through callbacks (which CVS will supply as cvs_output
+ and cvs_outerr). */
+ sleep (1);
+
+ if (out == RUN_TTY)
+ return diff3_run (call_diff_argc, call_diff_argv, NULL);
+ else
+ return diff3_run (call_diff_argc, call_diff_argv, out);
}
+
+
/* Merge revisions REV1 and REV2. */
+
int
-RCS_merge(path, options, rev1, rev2)
- const char *path;
- const char *options;
- const char *rev1;
- const char *rev2;
+RCS_merge(rcs, path, workfile, options, rev1, rev2)
+ RCSNode *rcs;
+ char *path;
+ char *workfile;
+ char *options;
+ char *rev1;
+ char *rev2;
{
- int status;
+ char *xrev1, *xrev2;
+ char *tmp1, *tmp2;
+ char *diffout = NULL;
+ int retval;
+
+ if (options != NULL && options[0] != '\0')
+ assert (options[0] == '-' && options[1] == 'k');
+
+ cvs_output ("RCS file: ", 0);
+ cvs_output (rcs->path, 0);
+ cvs_output ("\n", 1);
+
+ /* Calculate numeric revision numbers from rev1 and rev2 (may be
+ symbolic). */
+ xrev1 = RCS_gettag (rcs, rev1, 0, NULL);
+ xrev2 = RCS_gettag (rcs, rev2, 0, NULL);
- /* XXX - Do merge by hand instead of using rcsmerge, due to -k handling */
+ /* Check out chosen revisions. The error message when RCS_checkout
+ fails is not very informative -- it is taken verbatim from RCS 5.7,
+ and relies on RCS_checkout saying something intelligent upon failure. */
+ cvs_output ("retrieving revision ", 0);
+ cvs_output (xrev1, 0);
+ cvs_output ("\n", 1);
- run_setup ("%s%s -x,v/ %s -r%s -r%s %s", Rcsbin, RCS_RCSMERGE,
- options, rev1, rev2, path);
- status = run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL);
-#ifndef HAVE_RCS5
- if (status == 0)
+ tmp1 = cvs_temp_name();
+ if (RCS_checkout (rcs, NULL, xrev1, rev1, options, tmp1,
+ (RCSCHECKOUTPROC)0, NULL))
{
- error (1, 0, "CVS no longer supports RCS versions older than RCS5");
- /* This case needs to call file_has_markers to see if the file
- contains conflict indicators. But is anyone using the !HAVE_RCS5
- code any more? */
+ cvs_outerr ("rcsmerge: co failed\n", 0);
+ error_exit();
}
-#endif
- return status;
+
+ cvs_output ("retrieving revision ", 0);
+ cvs_output (xrev2, 0);
+ cvs_output ("\n", 1);
+
+ tmp2 = cvs_temp_name();
+ if (RCS_checkout (rcs, NULL, xrev2, rev2, options, tmp2,
+ (RCSCHECKOUTPROC)0, NULL))
+ {
+ cvs_outerr ("rcsmerge: co failed\n", 0);
+ error_exit();
+ }
+
+ /* Merge changes. */
+ cvs_output ("Merging differences between ", 0);
+ cvs_output (xrev1, 0);
+ cvs_output (" and ", 0);
+ cvs_output (xrev2, 0);
+ cvs_output (" into ", 0);
+ cvs_output (workfile, 0);
+ cvs_output ("\n", 1);
+
+ /* Remember that the first word in the `call_diff_setup' string is used now
+ only for diagnostic messages -- CVS no longer forks to run diff3. */
+ diffout = cvs_temp_name();
+ call_diff_setup ("diff3");
+ call_diff_arg ("-E");
+ call_diff_arg ("-am");
+
+ call_diff_arg ("-L");
+ call_diff_arg (workfile);
+ call_diff_arg ("-L");
+ call_diff_arg (xrev1);
+ call_diff_arg ("-L");
+ call_diff_arg (xrev2);
+
+ call_diff_arg (workfile);
+ call_diff_arg (tmp1);
+ call_diff_arg (tmp2);
+
+ retval = call_diff3 (diffout);
+
+ if (retval == 1)
+ cvs_outerr ("rcsmerge: warning: conflicts during merge\n", 0);
+ else if (retval == 2)
+ error_exit();
+
+ if (diffout)
+ copy_file (diffout, workfile);
+
+ /* Clean up. */
+ {
+ int save_noexec = noexec;
+ noexec = 0;
+ if (unlink_file (tmp1) < 0)
+ {
+ if (!existence_error (errno))
+ error (0, errno, "cannot remove temp file %s", tmp1);
+ }
+ free (tmp1);
+ if (unlink_file (tmp2) < 0)
+ {
+ if (!existence_error (errno))
+ error (0, errno, "cannot remove temp file %s", tmp2);
+ }
+ free (tmp2);
+ if (diffout)
+ {
+ if (unlink_file (diffout) < 0)
+ {
+ if (!existence_error (errno))
+ error (0, errno, "cannot remove temp file %s", diffout);
+ }
+ free (diffout);
+ }
+ free (xrev1);
+ free (xrev2);
+ noexec = save_noexec;
+ }
+
+ return retval;
}
-/* Check in to RCSFILE with revision REV (which must be greater than the
- largest revision) and message MESSAGE (which is checked for legality).
- If FLAGS & RCS_FLAGS_DEAD, check in a dead revision. If FLAGS &
- RCS_FLAGS_QUIET, tell ci to be quiet. If FLAGS & RCS_FLAGS_MODTIME,
- use the working file's modification time for the checkin time.
- WORKFILE is the working file to check in from, or NULL to use the usual
- RCS rules for deriving it from the RCSFILE.
-
- Return value is -1 for error (and errno is set to indicate the
- error), positive for error (and an error message has been printed),
- or zero for success. */
+/* Diff revisions and/or files. OPTS controls the format of the diff
+ (it contains options such as "-w -c", &c), or "" for the default.
+ OPTIONS controls keyword expansion, as a string starting with "-k",
+ or "" to use the default. REV1 is the first revision to compare
+ against; it must be non-NULL. If REV2 is non-NULL, compare REV1
+ and REV2; if REV2 is NULL compare REV1 with the file in the working
+ directory, whose name is WORKFILE. LABEL1 and LABEL2 are default
+ file labels, and (if non-NULL) should be added as -L options
+ to diff. Output goes to stdout.
+
+ Return value is 0 for success, -1 for a failure which set errno,
+ or positive for a failure which printed a message on stderr.
+
+ This used to exec rcsdiff, but now calls RCS_checkout and diff_exec.
+
+ An issue is what timezone is used for the dates which appear in the
+ diff output. rcsdiff uses the -z flag, which is not presently
+ processed by CVS diff, but I'm not sure exactly how hard to worry
+ about this--any such features are undocumented in the context of
+ CVS, and I'm not sure how important to users. */
int
-RCS_checkin (rcsfile, workfile, message, rev, flags)
- char *rcsfile;
+RCS_exec_rcsdiff (rcsfile, opts, options, rev1, rev2, label1, label2, workfile)
+ RCSNode *rcsfile;
+ char *opts;
+ char *options;
+ char *rev1;
+ char *rev2;
+ char *label1;
+ char *label2;
char *workfile;
- char *message;
- char *rev;
- int flags;
{
- /* The desired behavior regarding permissions is to preserve the
- permissions on RCSFILE if it already exists. Based on looking
- at the RCS 5.7 source, it would appear that RCS_CI does this
- except when it is creating RCSFILE (reasonable), or when
- RCSFILE was created with rcs -i (this is strange, and quite
- possibly unintentional). In those two cases it copies the
- permissions from the workfile.
-
- Anyway, the fix is simple enough: we preserve the mode ourself. */
- struct stat sb;
- int fix_mode = 1;
- int retval;
+ char *tmpfile1;
+ char *tmpfile2;
+ char *use_file2;
+ int status, retval;
+
+ tmpfile1 = cvs_temp_name ();
+ tmpfile2 = NULL;
+
+ cvs_output ("\
+===================================================================\n\
+RCS file: ", 0);
+ cvs_output (rcsfile->path, 0);
+ cvs_output ("\n", 1);
- if (CVS_STAT (rcsfile, &sb) < 0)
+ /* Historically, `cvs diff' has expanded the $Name keyword to the
+ empty string when checking out revisions. This is an accident,
+ but no one has considered the issue thoroughly enough to determine
+ what the best behavior is. Passing NULL for the `nametag' argument
+ preserves the existing behavior. */
+
+ cvs_output ("retrieving revision ", 0);
+ cvs_output (rev1, 0);
+ cvs_output ("\n", 1);
+ status = RCS_checkout (rcsfile, NULL, rev1, NULL, options, tmpfile1,
+ (RCSCHECKOUTPROC)0, NULL);
+ if (status > 0)
+ {
+ retval = status;
+ goto error_return;
+ }
+ else if (status < 0)
{
- fix_mode = 0;
- if (!existence_error (errno))
- error (0, errno, "warning: cannot stat %s", rcsfile);
+ error (0, errno,
+ "cannot check out revision %s of %s", rev1, rcsfile->path);
+ retval = 1;
+ goto error_return;
}
- run_setup ("%s%s -x,v/ -w%s -f %s%s", Rcsbin, RCS_CI, getcaller (),
- rev ? "-r" : "", rev ? rev : "");
- if (flags & RCS_FLAGS_DEAD)
- run_arg ("-sdead");
- if (flags & RCS_FLAGS_QUIET)
- run_arg ("-q");
- if (flags & RCS_FLAGS_MODTIME)
- run_arg ("-d");
- run_args ("-m%s", make_message_rcslegal (message));
- if (workfile != NULL)
- run_arg (workfile);
- run_arg (rcsfile);
- retval = run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL);
- if (retval == 0 && fix_mode)
+
+ if (rev2 == NULL)
+ {
+ assert (workfile != NULL);
+ use_file2 = workfile;
+ }
+ else
+ {
+ tmpfile2 = cvs_temp_name ();
+ cvs_output ("retrieving revision ", 0);
+ cvs_output (rev2, 0);
+ cvs_output ("\n", 1);
+ status = RCS_checkout (rcsfile, NULL, rev2, NULL, options,
+ tmpfile2, (RCSCHECKOUTPROC)0, NULL);
+ if (status > 0)
+ {
+ retval = status;
+ goto error_return;
+ }
+ else if (status < 0)
+ {
+ error (0, errno,
+ "cannot check out revision %s of %s", rev2, rcsfile->path);
+ return 1;
+ }
+ use_file2 = tmpfile2;
+ }
+
+ RCS_output_diff_options (opts, rev1, rev2, workfile);
+ status = diff_execv (tmpfile1, use_file2, label1, label2, opts, RUN_TTY);
+ if (status >= 0)
{
- if (chmod (rcsfile, sb.st_mode) < 0)
- error (0, errno, "warning: cannot change permissions on %s",
- rcsfile);
+ retval = status;
+ goto error_return;
}
+ else if (status < 0)
+ {
+ error (0, errno,
+ "cannot diff %s and %s", tmpfile1, use_file2);
+ retval = 1;
+ goto error_return;
+ }
+
+ error_return:
+ {
+ int save_noexec = noexec;
+ noexec = 0;
+ if (unlink_file (tmpfile1) < 0)
+ {
+ if (!existence_error (errno))
+ error (0, errno, "cannot remove temp file %s", tmpfile1);
+ }
+ noexec = save_noexec;
+ }
+ free (tmpfile1);
+ if (tmpfile2 != NULL)
+ {
+ int save_noexec = noexec;
+ noexec = 0;
+ if (unlink_file (tmpfile2) < 0)
+ {
+ if (!existence_error (errno))
+ error (0, errno, "cannot remove temp file %s", tmpfile2);
+ }
+ noexec = save_noexec;
+ free (tmpfile2);
+ }
+
return retval;
}
+
+
+/* Show differences between two files. This is the start of a diff library.
+
+ Some issues:
+
+ * Should option parsing be part of the library or the caller? The
+ former allows the library to add options without changing the callers,
+ but it causes various problems. One is that something like --brief really
+ wants special handling in CVS, and probably the caller should retain
+ some flexibility in this area. Another is online help (the library could
+ have some feature for providing help, but how does that interact with
+ the help provided by the caller directly?). Another is that as things
+ stand currently, there is no separate namespace for diff options versus
+ "cvs diff" options like -l (that is, if the library adds an option which
+ conflicts with a CVS option, it is trouble).
+
+ * This isn't required for a first-cut diff library, but if there
+ would be a way for the caller to specify the timestamps that appear
+ in the diffs (rather than the library getting them from the files),
+ that would clean up the kludgy utime() calls in patch.c.
+
+ Show differences between FILE1 and FILE2. Either one can be
+ DEVNULL to indicate a nonexistent file (same as an empty file
+ currently, I suspect, but that may be an issue in and of itself).
+ OPTIONS is a list of diff options, or "" if none. At a minimum,
+ CVS expects that -c (update.c, patch.c) and -n (update.c) will be
+ supported. Other options, like -u, --speed-large-files, &c, will
+ be specified if the user specified them.
+
+ OUT is a filename to send the diffs to, or RUN_TTY to send them to
+ stdout. Error messages go to stderr. Return value is 0 for
+ success, -1 for a failure which set errno, 1 for success (and some
+ differences were found), or >1 for a failure which printed a
+ message on stderr. */
+
+int
+diff_exec (file1, file2, options, out)
+ char *file1;
+ char *file2;
+ char *options;
+ char *out;
+{
+ char *args = xmalloc (strlen (options) + 10);
+ /* The first word in this string is used only for error reporting. */
+ sprintf (args, "diff %s", options);
+ call_diff_setup (args);
+ call_diff_arg (file1);
+ call_diff_arg (file2);
+ free (args);
+
+ return call_diff (out);
+}
+
+int
+diff_execv (file1, file2, label1, label2, options, out)
+ char *file1;
+ char *file2;
+ char *label1;
+ char *label2;
+ char *options;
+ char *out;
+{
+ char *args = xmalloc (strlen (options) + 10);
+ /* The first word in this string is used only for error reporting. */
+ /* I guess we are pretty confident that options starts with a space. */
+ sprintf (args, "diff%s", options);
+ call_diff_setup (args);
+ if (label1)
+ call_diff_arg (label1);
+ if (label2)
+ call_diff_arg (label2);
+ call_diff_arg (file1);
+ call_diff_arg (file2);
+ free (args);
+
+ return call_diff (out);
+}
+
+/* Print the options passed to DIFF, in the format used by rcsdiff.
+ The rcsdiff code that produces this output is extremely hairy, and
+ it is not clear how rcsdiff decides which options to print and
+ which not to print. The code below reproduces every rcsdiff run
+ that I have seen. */
+
+static void
+RCS_output_diff_options (opts, rev1, rev2, workfile)
+ char *opts;
+ char *rev1;
+ char *rev2;
+ char *workfile;
+{
+ char *tmp;
+
+ tmp = (char *) xmalloc (strlen (opts) + strlen (rev1) + 10);
+
+ sprintf (tmp, "diff%s -r%s", opts, rev1);
+ cvs_output (tmp, 0);
+ free (tmp);
+
+ if (rev2)
+ {
+ cvs_output (" -r", 3);
+ cvs_output (rev2, 0);
+ }
+ else
+ {
+ assert (workfile != NULL);
+ cvs_output (" ", 1);
+ cvs_output (workfile, 0);
+ }
+ cvs_output ("\n", 1);
+}
diff --git a/contrib/cvs/src/recurse.c b/contrib/cvs/src/recurse.c
index b4b55a8..d2fae6f 100644
--- a/contrib/cvs/src/recurse.c
+++ b/contrib/cvs/src/recurse.c
@@ -2,7 +2,7 @@
* Copyright (c) 1992, Brian Berliner and Jeff Polk
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* General recursion handler
*
@@ -157,7 +157,25 @@ start_recursion (fileproc, filesdoneproc, direntproc, dirleaveproc, callerdat,
* called with the list of sub-dirs of the current dir as args
*/
if ((which & W_LOCAL) && !isdir (CVSADM))
+ {
dirlist = Find_Directories ((char *) NULL, W_LOCAL, (List *) NULL);
+ /* If there are no sub-directories, there is a certain logic in
+ favor of doing nothing, but in fact probably the user is just
+ confused about what directory they are in, or whether they
+ cvs add'd a new directory. In the case of at least one
+ sub-directory, at least when we recurse into them we
+ notice (hopefully) whether they are under CVS control. */
+ if (list_isempty (dirlist))
+ {
+ if (update_dir[0] == '\0')
+ error (0, 0, "in directory .:");
+ else
+ error (0, 0, "in directory %s:", update_dir);
+ error (1, 0,
+ "there is no version here; run '%s checkout' first",
+ program_name);
+ }
+ }
else
addlist (&dirlist, ".");
@@ -637,7 +655,7 @@ but CVS uses %s for its own purposes; skipping %s directory",
else
{
newrepos = xmalloc (strlen (repository) + strlen (dir) + 5);
- (void) sprintf (newrepos, "%s/%s", repository, dir);
+ sprintf (newrepos, "%s/%s", repository, dir);
}
}
else
@@ -651,10 +669,78 @@ but CVS uses %s for its own purposes; skipping %s directory",
newrepos = xstrdup (repository);
}
+ /* Check to see that the CVSADM directory, if it exists, seems to be
+ well-formed. It can be missing files if the user hit ^C in the
+ middle of a previous run. We want to (a) make this a nonfatal
+ error, and (b) make sure we print which directory has the
+ problem.
+
+ Do this before the direntproc, so that (1) the direntproc
+ doesn't have to guess/deduce whether we will skip the directory
+ (e.g. send_dirent_proc and whether to send the directory), and
+ (2) so that the warm fuzzy doesn't get printed if we skip the
+ directory. */
+ if (frame->which & W_LOCAL)
+ {
+ char *cvsadmdir;
+
+ cvsadmdir = xmalloc (strlen (dir)
+ + sizeof (CVSADM_REP)
+ + sizeof (CVSADM_ENT)
+ + 80);
+
+ strcpy (cvsadmdir, dir);
+ strcat (cvsadmdir, "/");
+ strcat (cvsadmdir, CVSADM);
+ if (isdir (cvsadmdir))
+ {
+ strcpy (cvsadmdir, dir);
+ strcat (cvsadmdir, "/");
+ strcat (cvsadmdir, CVSADM_REP);
+ if (!isfile (cvsadmdir))
+ {
+ /* Some commands like update may have printed "? foo" but
+ if we were planning to recurse, and don't on account of
+ CVS/Repository, we want to say why. */
+ error (0, 0, "ignoring %s (%s missing)", update_dir,
+ CVSADM_REP);
+ dir_return = R_SKIP_ALL;
+ }
+
+ /* Likewise for CVS/Entries. */
+ if (dir_return != R_SKIP_ALL)
+ {
+ strcpy (cvsadmdir, dir);
+ strcat (cvsadmdir, "/");
+ strcat (cvsadmdir, CVSADM_ENT);
+ if (!isfile (cvsadmdir))
+ {
+ /* Some commands like update may have printed "? foo" but
+ if we were planning to recurse, and don't on account of
+ CVS/Repository, we want to say why. */
+ error (0, 0, "ignoring %s (%s missing)", update_dir,
+ CVSADM_ENT);
+ dir_return = R_SKIP_ALL;
+ }
+ }
+ }
+ free (cvsadmdir);
+ }
+
/* call-back dir entry proc (if any) */
- if (frame->direntproc != NULL)
+ if (dir_return == R_SKIP_ALL)
+ ;
+ else if (frame->direntproc != NULL)
dir_return = frame->direntproc (frame->callerdat, dir, newrepos,
update_dir, frent->entries);
+ else
+ {
+ /* Generic behavior. I don't see a reason to make the caller specify
+ a direntproc just to get this. */
+ if ((frame->which & W_LOCAL) && !isdir (dir))
+ dir_return = R_SKIP_ALL;
+ }
+
free (newrepos);
/* only process the dir if the return code was 0 */
diff --git a/contrib/cvs/src/release.c b/contrib/cvs/src/release.c
index 702e903..82429e0 100644
--- a/contrib/cvs/src/release.c
+++ b/contrib/cvs/src/release.c
@@ -14,6 +14,7 @@ static const char *const release_usage[] =
{
"Usage: %s %s [-d] directories...\n",
"\t-d\tDelete the given directory.\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -46,7 +47,10 @@ release_server (argc, argv)
2. The fact that "cvs update" contacts the server slows things down;
it undermines the case for using "cvs release" rather than "rm -rf".
However, for correctly printing "? foo" and correctly handling
- CVSROOTADM_IGNORE, we currently need to contact the server.
+ CVSROOTADM_IGNORE, we currently need to contact the server. (One
+ idea for how to fix this is to stash a copy of CVSROOTADM_IGNORE in
+ the working directories; see comment at base_* in entries.c for a
+ few thoughts on that).
3. Would be nice to take processing things on the client side one step
further, and making it like edit/unedit in terms of working well if
@@ -156,6 +160,8 @@ release (argc, argv)
if (!really_quiet)
{
+ int line_length;
+
/* The "release" command piggybacks on "update", which
does the real work of finding out if anything is not
up-to-date with the repository. Then "release" prompts
@@ -163,14 +169,19 @@ release (argc, argv)
modified, and asking if she still wants to do the
release. */
fp = run_popen (update_cmd, "r");
+ if (fp == NULL)
+ error (1, 0, "cannot run command %s", update_cmd);
+
c = 0;
- while (getline (&line, &line_allocated, fp) >= 0)
+ while ((line_length = getline (&line, &line_allocated, fp)) >= 0)
{
if (strchr ("MARCZ", *line))
c++;
(void) printf (line);
}
+ if (line_length < 0 && !feof (fp))
+ error (0, errno, "cannot read from subprocess");
/* If the update exited with an error, then we just want to
complain and go on to the next arg. Especially, we do
@@ -270,9 +281,15 @@ release_delete (dir)
(void) CVS_STAT (dir, &st);
if (ino != st.st_ino)
{
+ /* This test does not work on cygwin32, because under cygwin32
+ the st_ino field is not the same when you refer to a file
+ by a different name. This is a cygwin32 bug, but then I
+ don't see what the point of this test is anyhow. */
+#ifndef __CYGWIN32__
error (0, 0,
"Parent dir on a different disk, delete of %s aborted", dir);
return;
+#endif
}
/*
* XXX - shouldn't this just delete the CVS-controlled files and, perhaps,
diff --git a/contrib/cvs/src/remove.c b/contrib/cvs/src/remove.c
index 46c4169..9ed32d7 100644
--- a/contrib/cvs/src/remove.c
+++ b/contrib/cvs/src/remove.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Remove a File
*
@@ -37,6 +37,7 @@ static const char *const remove_usage[] =
"\t-f\tDelete the file before removing it.\n",
"\t-l\tProcess this directory only (not recursive).\n",
"\t-R\tProcess directories recursively.\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -215,6 +216,22 @@ remove_fileproc (callerdat, finfo)
error (0, 0, "file `%s' already scheduled for removal",
finfo->fullname);
}
+ else if (vers->tag != NULL && isdigit (*vers->tag))
+ {
+ /* Commit will just give an error, and so there seems to be
+ little reason to allow the remove. I mean, conflicts that
+ arise out of parallel development are one thing, but conflicts
+ that arise from sticky tags are quite another.
+
+ I would have thought that non-branch sticky tags should be the
+ same but at least now, removing a file with a non-branch sticky
+ tag means to delete the tag from the file. I'm not sure that
+ is a good behavior, but until it is changed, we need to allow
+ it. */
+ error (0, 0, "\
+cannot remove file `%s' which has a numeric sticky tag of `%s'",
+ finfo->fullname, vers->tag);
+ }
else
{
char *fname;
diff --git a/contrib/cvs/src/repos.c b/contrib/cvs/src/repos.c
index 2590df5..2738665 100644
--- a/contrib/cvs/src/repos.c
+++ b/contrib/cvs/src/repos.c
@@ -3,9 +3,10 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*/
+#include <assert.h>
#include "cvs.h"
#include "getline.h"
@@ -86,7 +87,6 @@ Name_Repository (dir, update_dir)
error (1, save_errno, "cannot open %s", tmp);
}
- free (tmp);
if (getline (&repos, &repos_allocated, fpin) < 0)
{
@@ -94,7 +94,10 @@ Name_Repository (dir, update_dir)
error (0, 0, "in directory %s:", xupdate_dir);
error (1, errno, "cannot read %s", CVSADM_REP);
}
- (void) fclose (fpin);
+ if (fclose (fpin) < 0)
+ error (0, errno, "cannot close %s", tmp);
+ free (tmp);
+
if ((cp = strrchr (repos, '\n')) != NULL)
*cp = '\0'; /* strip the newline */
@@ -126,7 +129,8 @@ Name_Repository (dir, update_dir)
repos = newrepos;
}
- strip_trailing_slashes (repos);
+ Sanitize_Repository_Name (repos);
+
return repos;
}
@@ -152,3 +156,51 @@ Short_Repository (repository)
else
return (repository);
}
+
+/* Sanitize the repository name (in place) by removing trailing
+ * slashes and a trailing "." if present. It should be safe for
+ * callers to use strcat and friends to create repository names.
+ * Without this check, names like "/path/to/repos/./foo" and
+ * "/path/to/repos//foo" would be created. For example, one
+ * significant case is the CVSROOT-detection code in commit.c. It
+ * decides whether or not it needs to rebuild the administrative file
+ * database by doing a string compare. If we've done a `cvs co .' to
+ * get the CVSROOT files, "/path/to/repos/./CVSROOT" and
+ * "/path/to/repos/CVSROOT" are the arguments that are compared!
+ *
+ * This function ends up being called from the same places as
+ * strip_path, though what it does is much more conservative. Many
+ * comments about this operation (which was scattered around in
+ * several places in the source code) ran thus:
+ *
+ * ``repository ends with "/."; omit it. This sort of thing used
+ * to be taken care of by strip_path. Now we try to be more
+ * selective. I suspect that it would be even better to push it
+ * back further someday, so that the trailing "/." doesn't get into
+ * repository in the first place, but we haven't taken things that
+ * far yet.'' --Jim Kingdon (recurse.c, 07-Sep-97)
+ *
+ * Ahh, all too true. The major consideration is RELATIVE_REPOS. If
+ * the "/." doesn't end up in the repository while RELATIVE_REPOS is
+ * defined, there will be nothing in the CVS/Repository file. I
+ * haven't verified that the remote protocol will handle that
+ * correctly yet, so I've not made that change. */
+
+void
+Sanitize_Repository_Name (repository)
+ char *repository;
+{
+ size_t len;
+
+ assert (repository != NULL);
+
+ strip_trailing_slashes (repository);
+
+ len = strlen (repository);
+ if (len >= 2
+ && repository[len - 1] == '.'
+ && ISDIRSEP (repository[len - 2]))
+ {
+ repository[len - 2] = '\0';
+ }
+}
diff --git a/contrib/cvs/src/root.c b/contrib/cvs/src/root.c
index bf5c89e..050e168 100644
--- a/contrib/cvs/src/root.c
+++ b/contrib/cvs/src/root.c
@@ -2,7 +2,7 @@
* Copyright (c) 1992, Mark D. Baushke
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Name of Root
*
@@ -18,15 +18,15 @@
Watch out if the enum is changed in cvs.h! */
char *method_names[] = {
- "local", "server (rsh)", "pserver", "kserver", "ext"
+ "local", "server (rsh)", "pserver", "kserver", "gserver", "ext"
};
#ifndef DEBUG
char *
-Name_Root(dir, update_dir)
- char *dir;
- char *update_dir;
+Name_Root (dir, update_dir)
+ char *dir;
+ char *update_dir;
{
FILE *fpin;
char *ret, *xupdate_dir;
@@ -133,41 +133,14 @@ Name_Root(dir, update_dir)
}
/*
- * Returns non-zero if the two directories have the same stat values
- * which indicates that they are really the same directories.
- */
-int
-same_directories (dir1, dir2)
- char *dir1;
- char *dir2;
-{
- struct stat sb1;
- struct stat sb2;
- int ret;
-
- if ( CVS_STAT (dir1, &sb1) < 0)
- return (0);
- if ( CVS_STAT (dir2, &sb2) < 0)
- return (0);
-
- ret = 0;
- if ( (memcmp( &sb1.st_dev, &sb2.st_dev, sizeof(dev_t) ) == 0) &&
- (memcmp( &sb1.st_ino, &sb2.st_ino, sizeof(ino_t) ) == 0))
- ret = 1;
-
- return (ret);
-}
-
-
-/*
* Write the CVS/Root file so that the environment variable CVSROOT
* and/or the -d option to cvs will be validated or not necessary for
* future work.
*/
void
Create_Root (dir, rootdir)
- char *dir;
- char *rootdir;
+ char *dir;
+ char *rootdir;
{
FILE *fout;
char *tmp;
@@ -272,6 +245,23 @@ root_allow_ok (arg)
char *arg;
{
unsigned int i;
+
+ if (root_allow_count == 0)
+ {
+ /* Probably someone upgraded from CVS before 1.9.10 to 1.9.10
+ or later without reading the documentation about
+ --allow-root. Printing an error here doesn't disclose any
+ particularly useful information to an attacker because a
+ CVS server configured in this way won't let *anyone* in. */
+
+ /* Note that we are called from a context where we can spit
+ back "error" rather than waiting for the next request which
+ expects responses. */
+ printf ("\
+error 0 Server configuration missing --allow-root in inetd.conf\n");
+ error_exit ();
+ }
+
for (i = 0; i < root_allow_count; ++i)
if (strcmp (root_allow_vector[i], arg) == 0)
return 1;
@@ -327,6 +317,7 @@ parse_cvsroot (CVSroot)
{
static int cvsroot_parsed = 0;
char *cvsroot_copy, *p;
+ int check_hostname;
/* Don't go through the trouble twice. */
if (cvsroot_parsed)
@@ -366,6 +357,8 @@ parse_cvsroot (CVSroot)
CVSroot_method = pserver_method;
else if (strcmp (method, "kserver") == 0)
CVSroot_method = kserver_method;
+ else if (strcmp (method, "gserver") == 0)
+ CVSroot_method = gserver_method;
else if (strcmp (method, "server") == 0)
CVSroot_method = server_method;
else if (strcmp (method, "ext") == 0)
@@ -445,6 +438,7 @@ parse_cvsroot (CVSroot)
return 1;
}
+ check_hostname = 0;
switch (CVSroot_method)
{
case local_method:
@@ -471,15 +465,31 @@ parse_cvsroot (CVSroot)
error (0, 0, "(%s)", CVSroot);
return 1;
#endif
+ check_hostname = 1;
+ break;
+ case gserver_method:
+#ifndef HAVE_GSSAPI
+ error (0, 0, "Your CVSROOT is set for a GSSAPI access method");
+ error (0, 0, "but your CVS executable doesn't support it");
+ error (0, 0, "(%s)", CVSroot);
+ return 1;
+#endif
+ check_hostname = 1;
+ break;
case server_method:
case ext_method:
case pserver_method:
+ check_hostname = 1;
+ break;
+ }
+
+ if (check_hostname)
+ {
if (! CVSroot_hostname)
{
error (0, 0, "didn't specify hostname in CVSROOT: %s", CVSroot);
return 1;
}
- break;
}
if (*CVSroot_directory == '\0')
diff --git a/contrib/cvs/src/rtag.c b/contrib/cvs/src/rtag.c
index 934cd40..5a21786 100644
--- a/contrib/cvs/src/rtag.c
+++ b/contrib/cvs/src/rtag.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Rtag
*
@@ -72,8 +72,10 @@ static const char *const rtag_usage[] =
"\t-n\tNo execution of 'tag program'\n",
"\t-d\tDelete the given Tag.\n",
"\t-b\tMake the tag a \"branch\" tag, allowing concurrent development.\n",
- "\t-[rD]\tExisting tag or Date.\n",
+ "\t-r rev\tExisting revision/tag.\n",
+ "\t-D\tExisting date.\n",
"\t-F\tMove tag if it already exists\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -206,7 +208,8 @@ rtag (argc, argv)
/* XXX last arg should be repository, but doesn't make sense here */
history_write ('T', (delete_flag ? "D" : (numtag ? numtag :
(date ? date : "A"))), symtag, argv[i], "");
- err += do_module (db, argv[i], TAG, delete_flag ? "Untagging" : "Tagging",
+ err += do_module (db, argv[i], TAG,
+ delete_flag ? "Untagging" : "Tagging",
rtag_proc, (char *) NULL, 0, 0, run_module_prog,
symtag);
}
@@ -469,11 +472,10 @@ pretag_proc(repository, filter)
}
free(s);
}
- run_setup("%s %s %s %s",
- filter,
- symtag,
- delete_flag ? "del" : force_tag_move ? "mov" : "add",
- repository);
+ run_setup (filter);
+ run_arg (symtag);
+ run_arg (delete_flag ? "del" : force_tag_move ? "mov" : "add");
+ run_arg (repository);
walklist(tlist, pretag_list_proc, NULL);
return (run_exec(RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY));
}
@@ -594,6 +596,8 @@ rtag_fileproc (callerdat, finfo)
*/
rev = branch_mode ? RCS_magicrev (rcsfile, version) : numtag;
retcode = RCS_settag(rcsfile, symtag, numtag);
+ if (retcode == 0)
+ RCS_rewrite (rcsfile, NULL, NULL);
}
else
{
@@ -613,7 +617,7 @@ rtag_fileproc (callerdat, finfo)
(int *) NULL);
if (oversion != NULL)
{
- int isbranch = RCS_isbranch (finfo->rcs, symtag);
+ int isbranch = RCS_nodeisbranch (finfo->rcs, symtag);
/*
* if versions the same and neither old or new are branches don't
@@ -643,6 +647,8 @@ rtag_fileproc (callerdat, finfo)
free (oversion);
}
retcode = RCS_settag(rcsfile, symtag, rev);
+ if (retcode == 0)
+ RCS_rewrite (rcsfile, NULL, NULL);
}
if (retcode != 0)
@@ -694,7 +700,7 @@ rtag_delete (rcsfile)
return (0);
free (version);
- if ((retcode = RCS_deltag(rcsfile, symtag, 1)) != 0)
+ if ((retcode = RCS_deltag(rcsfile, symtag)) != 0)
{
if (!quiet)
error (0, retcode == -1 ? errno : 0,
@@ -702,6 +708,7 @@ rtag_delete (rcsfile)
rcsfile->path);
return (1);
}
+ RCS_rewrite (rcsfile, NULL, NULL);
return (0);
}
@@ -733,7 +740,8 @@ rtag_dirproc (callerdat, dir, repos, update_dir, entries)
List *entries;
{
if (!quiet)
- error (0, 0, "%s %s", delete_flag ? "Untagging" : "Tagging", update_dir);
+ error (0, 0, "%s %s", delete_flag ? "Untagging" : "Tagging",
+ update_dir);
return (R_PROCESS);
}
diff --git a/contrib/cvs/src/run.c b/contrib/cvs/src/run.c
index 5b59bca..dc35a78 100644
--- a/contrib/cvs/src/run.c
+++ b/contrib/cvs/src/run.c
@@ -14,30 +14,18 @@
#include "cvs.h"
-#ifdef HAVE_VPRINTF
-#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
-#include <stdarg.h>
-#define VA_START(args, lastarg) va_start(args, lastarg)
-#else
-#include <varargs.h>
-#define VA_START(args, lastarg) va_start(args)
-#endif
-#else
-#define va_alist a1, a2, a3, a4, a5, a6, a7, a8
-#define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
+#ifndef HAVE_UNISTD_H
+extern int execvp PROTO((char *file, char **argv));
#endif
static void run_add_arg PROTO((const char *s));
extern char *strtok ();
-extern int vasprintf ();
-
/*
- * To exec a program under CVS, first call run_setup() to setup any initial
- * arguments. The options to run_setup are essentially like printf(). The
- * arguments will be parsed into whitespace separated words and added to the
- * global run_argv list.
+ * To exec a program under CVS, first call run_setup() to setup initial
+ * arguments. The argument to run_setup will be parsed into whitespace
+ * separated words and added to the global run_argv list.
*
* Then, optionally call run_arg() for each additional argument that you'd like
* to pass to the executed program.
@@ -51,19 +39,10 @@ static int run_argc;
static int run_argc_allocated;
/* VARARGS */
-#if defined (HAVE_VPRINTF) && (defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__))
void
-run_setup (const char *fmt,...)
-#else
-void
-run_setup (fmt, va_alist)
- char *fmt;
- va_dcl
-#endif
+run_setup (prog)
+ const char *prog;
{
-#ifdef HAVE_VPRINTF
- va_list args;
-#endif
char *cp;
int i;
char *run_prog;
@@ -79,16 +58,7 @@ run_setup (fmt, va_alist)
}
run_argc = 0;
- /* process the varargs into run_prog */
-#ifdef HAVE_VPRINTF
- VA_START (args, fmt);
- (void) vasprintf (&run_prog, fmt, args);
- va_end (args);
-#else
- you lose
-#endif
- if (run_prog == NULL)
- error (1, 0, "out of memory");
+ run_prog = xstrdup (prog);
/* put each word into run_argv, allocating it as we go */
for (cp = strtok (run_prog, " \t"); cp; cp = strtok ((char *) NULL, " \t"))
@@ -103,38 +73,6 @@ run_arg (s)
run_add_arg (s);
}
-/* VARARGS */
-#if defined (HAVE_VPRINTF) && (defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__))
-void
-run_args (const char *fmt,...)
-#else
-void
-run_args (fmt, va_alist)
- char *fmt;
- va_dcl
-#endif
-{
-#ifdef HAVE_VPRINTF
- va_list args;
-#endif
- char *run_prog;
-
- /* process the varargs into run_prog */
-#ifdef HAVE_VPRINTF
- VA_START (args, fmt);
- (void) vasprintf (&run_prog, fmt, args);
- va_end (args);
-#else
- you lose
-#endif
- if (run_prog == NULL)
- error (1, 0, "out of memory");
-
- /* and add the (single) argument to the run_argv list */
- run_add_arg (run_prog);
- free (run_prog);
-}
-
static void
run_add_arg (s)
const char *s;
@@ -155,9 +93,9 @@ run_add_arg (s)
int
run_exec (stin, stout, sterr, flags)
- char *stin;
- char *stout;
- char *sterr;
+ const char *stin;
+ const char *stout;
+ const char *sterr;
int flags;
{
int shin, shout, sherr;
@@ -398,7 +336,13 @@ run_print (fp)
else if (fp == stdout)
outfn = cvs_output;
else
+ {
error (1, 0, "internal error: bad argument to run_print");
+ /* Solely to placate gcc -Wall.
+ FIXME: it'd be better to use a function named `fatal' that
+ is known never to return. Then kludges wouldn't be necessary. */
+ outfn = NULL;
+ }
for (i = 0; i < run_argc; i++)
{
@@ -410,6 +354,11 @@ run_print (fp)
}
}
+/* Return value is NULL for error, or if noexec was set. If there was an
+ error, return NULL and I'm not sure whether errno was set (the Red Hat
+ Linux 4.1 popen manpage was kind of vague but discouraging; and the noexec
+ case complicates this even aside from popen behavior). */
+
FILE *
run_popen (cmd, mode)
const char *cmd;
@@ -428,8 +377,6 @@ run_popen (cmd, mode)
return (popen (cmd, mode));
}
-extern int evecvp PROTO((char *file, char **argv));
-
int
piped_child (command, tofdp, fromfdp)
char **command;
diff --git a/contrib/cvs/src/sanity.sh b/contrib/cvs/src/sanity.sh
index a815fc0..4084b5f 100755
--- a/contrib/cvs/src/sanity.sh
+++ b/contrib/cvs/src/sanity.sh
@@ -2,7 +2,19 @@
:
# sanity.sh -- a growing testsuite for cvs.
#
-# Copyright (C) 1992, 1993 Cygnus Support
+# The copyright notice said: "Copyright (C) 1992, 1993 Cygnus Support"
+# I'm not adding new copyright notices for new years as our recent
+# practice has been to include copying terms without copyright notices.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
# Original Author: K. Richard Pixley
@@ -15,16 +27,38 @@
# You can't run CVS as root; print a nice error message here instead
# of somewhere later, after making a mess.
-case "`whoami`" in
- "root" )
- echo "sanity.sh: test suite does not work correctly when run as root" >&2
- exit 1
- ;;
-esac
+# Commented out because:
+# (1) whoami is not portable. If memory serves the POSIX way is "id -un".
+# ("logname" or "who am i" are similar but different--they have more to
+# do with who logged in on your tty than your uid).
+# (2) This definition of "root" doesn't quite match CVS's (which is based
+# on uid 0, not username "root").
+#case "`whoami`" in
+# "root" )
+# echo "sanity.sh: test suite does not work correctly when run as root" >&2
+# exit 1
+# ;;
+#esac
# required to make this script work properly.
unset CVSREAD
+# The default value of /tmp/cvs-sanity for TESTDIR is dubious,
+# because it loses if two people/scripts try to run the tests
+# at the same time. Some possible solutions:
+# 1. Use /tmp/cvs-test$$. One disadvantage is that the old
+# cvs-test* directories would pile up, because they wouldn't
+# necessarily get removed.
+# 2. Have everyone/everything running the testsuite set
+# TESTDIR to some appropriate directory.
+# 3. Have the default value of TESTDIR be some variation of
+# `pwd`/cvs-sanity. The biggest problem here is that we have
+# been fairly careful to test that CVS prints in messages the
+# actual pathnames that we pass to it, rather than a different
+# pathname for the same directory, as may come out of `pwd`.
+# So this would be lost if everything was `pwd`-based. I suppose
+# if we wanted to get baroque we could start making symlinks
+# to ensure the two are different.
TESTDIR=${TESTDIR:-/tmp/cvs-sanity}
# "debugger"
@@ -79,12 +113,22 @@ PROG=`basename ${testcvs}`
# Regexp to match an author name. I'm not really sure what characters
# should be here. a-zA-Z obviously. People complained when 0-9 were
# not allowed in usernames. Other than that I'm not sure.
-username="[a-zA-Z0-9][a-zA-Z0-9]*"
+username="[-a-zA-Z0-9][-a-zA-Z0-9]*"
# Regexp to match the name of a temporary file (from cvs_temp_name).
# This appears in certain diff output.
tempname="[-a-zA-Z0-9/.%_]*"
+# On cygwin32, we may not have /bin/sh.
+if [ -r /bin/sh ]; then
+ TESTSHELL="/bin/sh"
+else
+ TESTSHELL=`type -p sh 2>/dev/null`
+ if [ ! -r "$TESTSHELL" ]; then
+ TESTSHELL="/bin/sh"
+ fi
+fi
+
# FIXME: try things (what things? checkins?) without -m.
#
# Some of these tests are written to expect -Q. But testing with
@@ -452,6 +496,22 @@ dotest_status ()
dotest_internal "$1" "$3" "$4" "$5"
}
+# Like dotest except output is sorted.
+dotest_sort ()
+{
+ rm -f ${TESTDIR}/dotest.ex? 2>&1
+ if $2 >${TESTDIR}/dotest.tmp1 2>&1; then
+ : so far so good
+ else
+ status=$?
+ cat ${TESTDIR}/dotest.tmp1 >>${LOGFILE}
+ echo "exit status was $status" >>${LOGFILE}
+ fail "$1"
+ fi
+ sort < ${TESTDIR}/dotest.tmp1 > ${TESTDIR}/dotest.tmp
+ dotest_internal "$@"
+}
+
# clean any old remnants
rm -rf ${TESTDIR}
mkdir ${TESTDIR}
@@ -459,7 +519,17 @@ cd ${TESTDIR}
# This will show up in cvs history output where it prints the working
# directory. It should *not* appear in any cvs output referring to the
# repository; cvs should use the name of the repository as specified.
-TMPPWD=`/bin/pwd`
+#
+# Note that using pwd here rather than /bin/pwd will make it even less
+# likely that we test whether CVS is distinguishing between TMPPWD
+# and TESTDIR. However, there is no guarantee that will test it anyway.
+# If we really care, we should do something along the lines of:
+# cd /tmp/cvs-sanity # In reality, overridable with environment variable?
+# mkdir realdir
+# ln -s realdir testdir
+# TESTDIR=/tmp/cvs-sanity/testdir
+# TMPPWD=/tmp/cvs-sanity/realdir
+TMPPWD=`pwd`
# Avoid picking up any stray .cvsrc, etc., from the user running the tests
mkdir home
@@ -478,12 +548,19 @@ RCSINIT=; export RCSINIT
# tests.
if test x"$*" = x; then
- tests="basica basicb basic1 deep basic2 rdiff death death2 branches"
- tests="${tests} multibranch import join new newb conflicts conflicts2"
- tests="${tests} modules modules2 modules3 mflag errmsg1 devcom devcom2"
- tests="${tests} devcom3 ignore binfiles binfiles2 binwrap mwrap info"
- tests="${tests} serverpatch log log2 crerepos rcs big modes stamps"
- tests="${tests} sticky keyword toplevel"
+ tests="basica basicb basicc basic1 deep basic2"
+ tests="${tests} rdiff death death2 branches"
+ tests="${tests} rcslib multibranch import importb join join2 join3"
+ tests="${tests} new newb conflicts conflicts2 conflicts3"
+ tests="${tests} modules modules2 modules3 mflag editor errmsg1 errmsg2"
+ tests="${tests} devcom devcom2 devcom3 watch4"
+ tests="${tests} ignore binfiles binfiles2 mcopy binwrap binwrap2"
+ tests="${tests} binwrap3 mwrap info config"
+ tests="${tests} serverpatch log log2 ann crerepos rcs big modes stamps"
+ tests="${tests} sticky keyword keywordlog"
+ tests="${tests} toplevel head tagdate multibranch2"
+ tests="${tests} admin reserved"
+ tests="${tests} cvsadm diffmerge1 diffmerge2"
else
tests="$*"
fi
@@ -594,14 +671,14 @@ Directory ${TESTDIR}/cvsroot/first-dir/sdir added to the repository"
# that I consider to be more correct, but local cvs prints the
# "nothing known" message and noone has gotten around to fixing it.
dotest_fail basica-notadded "${testcvs} -q ci ssfile" \
-"${PROG} [a-z]*: use "'`cvs add'\'' to create an entry for ssfile
-'"${PROG}"' \[[a-z]* aborted\]: correct above errors first!' \
+"${PROG} [a-z]*: use .${PROG} add. to create an entry for ssfile
+${PROG}"' \[[a-z]* aborted\]: correct above errors first!' \
"${PROG}"' [a-z]*: nothing known about `ssfile'\''
'"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
dotest basica-4 "${testcvs} add ssfile" \
"${PROG}"' [a-z]*: scheduling file `ssfile'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
dotest_fail basica-4a "${testcvs} tag tag0 ssfile" \
"${PROG} [a-z]*: nothing known about ssfile
${PROG} "'\[[a-z]* aborted\]: correct the above errors first!'
@@ -701,6 +778,68 @@ diff -r1\.2 -r1\.3"
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
1\.1 .'"${username}"' *[0-9a-zA-Z-]*.: ssfile
1\.2 .'"${username}"' *[0-9a-zA-Z-]*.: ssfile line 2'
+
+ # As long as we have a file with a few revisions, test
+ # a few "cvs admin -o" invocations.
+ cd sdir/ssdir
+ dotest_fail basica-o1 "${testcvs} admin -o 1.2::1.2" \
+"${PROG} [a-z]*: while processing more than one file:
+${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
+ dotest basica-o2 "${testcvs} admin -o 1.2::1.2 ssfile" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
+done"
+ dotest basica-o2a "${testcvs} admin -o 1.1::NOT_RESERVED ssfile" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
+done"
+ dotest_fail basica-o2b "${testcvs} admin -o 1.1::NOT_EXIST ssfile" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
+${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v: Revision NOT_EXIST doesn't exist.
+${PROG} [a-z]*: cannot modify RCS file for .ssfile."
+ dotest basica-o3 "${testcvs} admin -o 1.2::1.3 ssfile" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
+done"
+ dotest basica-o4 "${testcvs} admin -o 3.1:: ssfile" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
+done"
+ dotest basica-o5 "${testcvs} admin -o ::1.1 ssfile" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
+done"
+ dotest basica-o5a "${testcvs} -n admin -o 1.2::3.1 ssfile" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
+deleting revision 2\.0
+deleting revision 1\.3
+done"
+ dotest basica-o6 "${testcvs} admin -o 1.2::3.1 ssfile" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
+deleting revision 2\.0
+deleting revision 1\.3
+done"
+ dotest basica-o7 "${testcvs} log -N ssfile" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/sdir/ssdir/ssfile,v
+Working file: ssfile
+head: 3\.1
+branch:
+locks: strict
+access list:
+keyword substitution: kv
+total revisions: 3; selected revisions: 3
+description:
+----------------------------
+revision 3\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}0 -0
+bump-it
+----------------------------
+revision 1\.2
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
+modify-it
+----------------------------
+revision 1\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
+add-it
+============================================================================="
+ dotest basica-o8 "${testcvs} -q update -p -r 1.1 ssfile" "ssfile"
+ cd ../..
+
cd ..
rm -rf ${CVSROOT_DIRNAME}/first-dir
@@ -714,18 +853,25 @@ diff -r1\.2 -r1\.3"
touch topfile
dotest basicb-0b "${testcvs} add topfile" \
"${PROG} [a-z]*: scheduling file .topfile. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest basicb-0c "${testcvs} -q ci -m add-it topfile" \
-"RCS file: ${TESTDIR}/cvsroot/\./topfile,v
+"RCS file: ${TESTDIR}/cvsroot/topfile,v
done
Checking in topfile;
-${TESTDIR}/cvsroot/\./topfile,v <-- topfile
+${TESTDIR}/cvsroot/topfile,v <-- topfile
initial revision: 1\.1
done"
cd ..
rm -r 1
mkdir 2; cd 2
dotest basicb-0d "${testcvs} -q co -l ." "U topfile"
+ # Now test the ability to run checkout on an existing working
+ # directory without having it lose its mind. I don't know
+ # whether this is tested elsewhere in sanity.sh. A more elaborate
+ # test might also have modified files, make sure it works if
+ # the modules file was modified to add new directories to the
+ # module, and such.
+ dotest basicb-0d0 "${testcvs} -q co -l ." ""
mkdir first-dir
dotest basicb-0e "${testcvs} add first-dir" \
"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
@@ -735,24 +881,33 @@ done"
: mkdir ${CVSROOT_DIRNAME}/first-dir
dotest basicb-1 "${testcvs} -q co first-dir" ''
dotest basicb-1a "test -d CVS" ''
- # See comment at modules3-7f for more on this behavior.
+
+ # In 1b and 1c, the first string matches if we're using absolute
+ # paths, while the second matches if RELATIVE_REPOS is defined
+ # (we're using relative paths).
+
dotest basicb-1b "cat CVS/Repository" \
-"${TESTDIR}/cvsroot/first-dir" "${TESTDIR}/cvsroot/\."
+"${TESTDIR}/cvsroot/\." \
+"\."
dotest basicb-1c "cat first-dir/CVS/Repository" \
-"${TESTDIR}/cvsroot/first-dir"
+"${TESTDIR}/cvsroot/first-dir" \
+"first-dir"
cd first-dir
- mkdir sdir1 sdir2
- dotest basicb-2 "${testcvs} add sdir1 sdir2" \
-"Directory ${TESTDIR}/cvsroot/first-dir/sdir1 added to the repository
+ # Note that the name Emptydir is chosen to test that CVS just
+ # treats it like any other directory name. It should be
+ # special only when it is directly in $CVSROOT/CVSROOT.
+ mkdir Emptydir sdir2
+ dotest basicb-2 "${testcvs} add Emptydir sdir2" \
+"Directory ${TESTDIR}/cvsroot/first-dir/Emptydir added to the repository
Directory ${TESTDIR}/cvsroot/first-dir/sdir2 added to the repository"
- cd sdir1
+ cd Emptydir
echo sfile1 starts >sfile1
dotest basicb-2a10 "${testcvs} -n add sfile1" \
"${PROG} [a-z]*: scheduling file .sfile1. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest basicb-2a11 "${testcvs} status sfile1" \
-"${PROG} [a-z]*: use .cvs add' to create an entry for sfile1
+"${PROG} [a-z]*: use .${PROG} add. to create an entry for sfile1
===================================================================
File: sfile1 Status: Unknown
@@ -760,7 +915,7 @@ File: sfile1 Status: Unknown
Repository revision: No revision control file"
dotest basicb-3 "${testcvs} add sfile1" \
"${PROG} [a-z]*: scheduling file .sfile1. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest basicb-3a1 "${testcvs} status sfile1" \
"===================================================================
File: sfile1 Status: Locally Added
@@ -775,16 +930,16 @@ File: sfile1 Status: Locally Added
echo sfile2 starts >sfile2
dotest basicb-4 "${testcvs} add sfile2" \
"${PROG} [a-z]*: scheduling file .sfile2. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest basicb-4a "${testcvs} -q ci CVS" \
"${PROG} [a-z]*: warning: directory CVS specified in argument
${PROG} [a-z]*: but CVS uses CVS for its own purposes; skipping CVS directory"
cd ..
dotest basicb-5 "${testcvs} -q ci -m add" \
-"RCS file: ${TESTDIR}/cvsroot/first-dir/sdir1/sfile1,v
+"RCS file: ${TESTDIR}/cvsroot/first-dir/Emptydir/sfile1,v
done
-Checking in sdir1/sfile1;
-${TESTDIR}/cvsroot/first-dir/sdir1/sfile1,v <-- sfile1
+Checking in Emptydir/sfile1;
+${TESTDIR}/cvsroot/first-dir/Emptydir/sfile1,v <-- sfile1
initial revision: 1\.1
done
RCS file: ${TESTDIR}/cvsroot/first-dir/sdir2/sfile2,v
@@ -793,13 +948,13 @@ Checking in sdir2/sfile2;
${TESTDIR}/cvsroot/first-dir/sdir2/sfile2,v <-- sfile2
initial revision: 1\.1
done"
- echo sfile1 develops >sdir1/sfile1
+ echo sfile1 develops >Emptydir/sfile1
dotest basicb-6 "${testcvs} -q ci -m modify" \
-"Checking in sdir1/sfile1;
-${TESTDIR}/cvsroot/first-dir/sdir1/sfile1,v <-- sfile1
+"Checking in Emptydir/sfile1;
+${TESTDIR}/cvsroot/first-dir/Emptydir/sfile1,v <-- sfile1
new revision: 1\.2; previous revision: 1\.1
done"
- dotest basicb-7 "${testcvs} -q tag release-1" 'T sdir1/sfile1
+ dotest basicb-7 "${testcvs} -q tag release-1" 'T Emptydir/sfile1
T sdir2/sfile2'
echo not in time for release-1 >sdir2/sfile2
dotest basicb-8 "${testcvs} -q ci -m modify-2" \
@@ -817,22 +972,48 @@ done"
# for existing files, even if co -d is in use.
touch first-dir/extra
dotest basicb-cod-1 "${testcvs} -q co -d first-dir1 first-dir" \
-'U first-dir1/sdir1/sfile1
+'U first-dir1/Emptydir/sfile1
U first-dir1/sdir2/sfile2'
rm -r first-dir1
rm -r first-dir
+
+ # FIXME? basicb-9 used to check things out like this:
+ # U newdir/Emptydir/sfile1
+ # U newdir/sdir2/sfile2
+ # but that's difficult to do. The whole "shorten" thing
+ # is pretty bogus, because it will break on things
+ # like "cvs co foo/bar baz/quux". Unless there's some
+ # pretty detailed expansion and analysis of the command-line
+ # arguments, we shouldn't do "shorten" stuff at all.
+
dotest basicb-9 \
-"${testcvs} -q co -d newdir -r release-1 first-dir/sdir1 first-dir/sdir2" \
-'U newdir/sdir1/sfile1
-U newdir/sdir2/sfile2'
+"${testcvs} -q co -d newdir -r release-1 first-dir/Emptydir first-dir/sdir2" \
+'U newdir/first-dir/Emptydir/sfile1
+U newdir/first-dir/sdir2/sfile2'
dotest basicb-9a "test -d CVS" ''
- # See comment at modules3-7f for more on this behavior.
+
+ # In 9b through 9f, the first string matches if we're using
+ # absolute paths, while the second matches if RELATIVE_REPOS
+ # is defined (we're using relative paths).
+
dotest basicb-9b "cat CVS/Repository" \
-"${TESTDIR}/cvsroot/first-dir" "${TESTDIR}/cvsroot/\."
+"${TESTDIR}/cvsroot/\." \
+"\."
dotest basicb-9c "cat newdir/CVS/Repository" \
-"${TESTDIR}/cvsroot/CVSROOT/Emptydir"
- dotest basicb-10 "cat newdir/sdir1/sfile1 newdir/sdir2/sfile2" \
+"${TESTDIR}/cvsroot/\." \
+"\."
+ dotest basicb-9d "cat newdir/first-dir/CVS/Repository" \
+"${TESTDIR}/cvsroot/first-dir" \
+"first-dir"
+ dotest basicb-9e "cat newdir/first-dir/Emptydir/CVS/Repository" \
+"${TESTDIR}/cvsroot/first-dir/Emptydir" \
+"first-dir/Emptydir"
+ dotest basicb-9f "cat newdir/first-dir/sdir2/CVS/Repository" \
+"${TESTDIR}/cvsroot/first-dir/sdir2" \
+"first-dir/sdir2"
+
+ dotest basicb-10 "cat newdir/first-dir/Emptydir/sfile1 newdir/first-dir/sdir2/sfile2" \
"sfile1 develops
sfile2 starts"
@@ -842,7 +1023,7 @@ sfile2 starts"
# seem to deal with it...
if false; then
dotest basicb-11 "${testcvs} -q co -d sub1/sub2 first-dir" \
-"U sub1/sub2/sdir1/sfile1
+"U sub1/sub2/Emptydir/sfile1
U sub1/sub2/sdir2/sfile2"
cd sub1
dotest basicb-12 "${testcvs} -q update" ''
@@ -864,7 +1045,7 @@ U sub1/sub2/sdir2/sfile2"
touch aa
dotest basicb-16 "${testcvs} add aa" \
"${PROG} [a-z]*: scheduling file .aa. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest basicb-17 "${testcvs} -q ci -m add" \
"RCS file: ${TESTDIR}/cvsroot/second-dir/aa,v
done
@@ -874,16 +1055,13 @@ initial revision: 1\.1
done"
cd ../..
rm -r 1
- # Now here is the kicker: note that the semantics of -d
- # are fundamentally different if we specify two or more directories
- # rather than one! I consider this to be seriously bogus,
- # but for the moment I am just trying to figure out what
- # CVS's current behaviors are.
- dotest basicb-18 "${testcvs} -q co -d test2 first-dir second-dir" \
-"U test2/first-dir/sdir1/sfile1
-U test2/first-dir/sdir2/sfile2
-U test2/second-dir/aa"
- cd test2
+
+ # Let's see if we can add something to Emptydir.
+ dotest basicb-18 "${testcvs} -q co -d t2/t3 first-dir second-dir" \
+"U t2/t3/first-dir/Emptydir/sfile1
+U t2/t3/first-dir/sdir2/sfile2
+U t2/t3/second-dir/aa"
+ cd t2
touch emptyfile
# The fact that CVS lets us add a file here is a CVS bug, right?
# I can just make this an error message (on the add and/or the
@@ -892,7 +1070,7 @@ U test2/second-dir/aa"
# Right?
dotest basicb-19 "${testcvs} add emptyfile" \
"${PROG} [a-z]*: scheduling file .emptyfile. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest basicb-20 "${testcvs} -q ci -m add" \
"RCS file: ${TESTDIR}/cvsroot/CVSROOT/Emptydir/emptyfile,v
done
@@ -901,32 +1079,75 @@ ${TESTDIR}/cvsroot/CVSROOT/Emptydir/emptyfile,v <-- emptyfile
initial revision: 1\.1
done"
cd ..
+ rm -r t2
mkdir 1; cd 1
- # "cvs admin" tests are scattered around a bit. Here we test
- # ability to reject an unrecognized option. The "keyword"
- # test has a test of "cvs admin -l" and the "binfiles" test
- # has a test of "cvs admin -k". Note that -H is an illegal
- # option. It probably should be an error message. But
- # currently it is one error message for each file operated on,
- # which in this case is zero files.
- dotest basicb-21 "${testcvs} -q admin -H" ""
+ # Note that -H is an illegal option.
+ # I suspect that the choice between "illegal" and "invalid"
+ # depends on the user's environment variables, the phase
+ # of the moon (weirdness with optind), and who knows what else.
+ # I've been seeing "illegal"...
+ dotest_fail basicb-21 "${testcvs} -q admin -H" \
+"admin: illegal option -- H
+${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information" \
+"admin: invalid option -- H
+${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information"
cd ..
rmdir 1
+ # OK, while we have an Emptydir around, test a few obscure
+ # things about it.
+ mkdir edir; cd edir
+ dotest basicb-edir-1 "${testcvs} -q co -l CVSROOT" \
+"U CVSROOT${DOTSTAR}"
+ cd CVSROOT
+ dotest_fail basicb-edir-2 "test -d Emptydir" ''
+ # This tests the code in find_dirs which skips Emptydir.
+ dotest basicb-edir-3 "${testcvs} -q -n update -d -P" ''
+ cd ../..
+ rm -r edir
+
if test "$keep" = yes; then
echo Keeping ${TESTDIR} and exiting due to --keep
exit 0
fi
- rm -r test2
-
rm -rf ${CVSROOT_DIRNAME}/first-dir
rm -rf ${CVSROOT_DIRNAME}/second-dir
rm -rf ${CVSROOT_DIRNAME}/CVSROOT/Emptydir
rm -f ${CVSROOT_DIRNAME}/topfile,v
;;
+ basicc)
+ # More tests of basic/miscellaneous functionality.
+ mkdir 1; cd 1
+ dotest_fail basicc-1 "${testcvs} diff" \
+"${PROG} [a-z]*: in directory \.:
+${PROG} \[[a-z]* aborted\]: there is no version here; run .${PROG} checkout. first"
+ dotest basicc-2 "${testcvs} -q co -l ." ''
+ mkdir first-dir second-dir
+ dotest basicc-3 "${testcvs} add first-dir second-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository
+Directory ${TESTDIR}/cvsroot/second-dir added to the repository"
+ # Old versions of CVS often didn't create this top-level CVS
+ # directory in the first place. I think that maybe the only
+ # way to get avoid it currently is to let CVS create it, and
+ # then blow it away. But that is perfectly legal; people who
+ # are used to the old behavior especially may be interested.
+ rm -r CVS
+ dotest basicc-4 "echo *" "first-dir second-dir"
+ dotest basicc-5 "${testcvs} update" \
+"${PROG} [a-z]*: Updating first-dir
+${PROG} [a-z]*: Updating second-dir" \
+"${PROG} [a-z]*: Updating \.
+${PROG} [a-z]*: Updating first-dir
+${PROG} [a-z]*: Updating second-dir"
+
+ cd ..
+ rm -r 1
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
basic1)
# first dive - add a files, first singly, then in a group.
mkdir ${CVSROOT_DIRNAME}/first-dir
@@ -945,7 +1166,7 @@ done"
${PROG} [a-z]*: scheduling file \`file3' for addition
${PROG} [a-z]*: scheduling file \`file4' for addition
${PROG} [a-z]*: scheduling file \`file5' for addition
-${PROG} [a-z]*: use 'cvs commit' to add these files permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
dotest basic1-15-add-add \
"${testcvs} -q update file2 file3 file4 file5" \
"A file2
@@ -1315,7 +1536,7 @@ done"
echo file1 >file1
dotest deep-3-$i "${testcvs} add file1" \
"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
done
cd ../../../../../../../../..
dotest_lit deep-4 "${testcvs} -q ci -m add-them first-dir" <<HERE
@@ -1391,6 +1612,8 @@ done"
# that "cvs release -d" is the way to delete the directory
# and have it stay gone -kingdon, Oct1996).
rm -r dir6
+ dotest deep-4b0a "${testcvs} -q diff" ''
+ dotest deep-4b0b "${testcvs} -q ci" ''
dotest deep-4b1 "${testcvs} -q update" ''
dotest deep-4b2 "${testcvs} -q update -d -P" \
'U dir6/file1
@@ -1462,9 +1685,9 @@ done"
if test ! -d $i ; then
mkdir $i
if ${CVS} add $i >> ${LOGFILE}; then
- echo "PASS: test 29-$i" >>${LOGFILE}
+ pass 29-$i
else
- echo "FAIL: test 29-$i" | tee -a ${LOGFILE} ; exit 1
+ fail 29-$i
fi
fi
@@ -1475,48 +1698,48 @@ done"
done
if ${CVS} add file6 file7 2>> ${LOGFILE}; then
- echo "PASS: test 30-$i-$j" >>${LOGFILE}
+ pass 30-$i-$j
else
- echo "FAIL: test 30-$i-$j" | tee -a ${LOGFILE} ; exit 1
+ fail 30-$i-$j
fi
done
cd ../../..
if ${CVS} update first-dir ; then
- echo "PASS: test 31" >>${LOGFILE}
+ pass 31
else
- echo "FAIL: test 31" | tee -a ${LOGFILE} ; exit 1
+ fail 31
fi
# fixme: doesn't work right for added files.
if ${CVS} log first-dir >> ${LOGFILE}; then
- echo "PASS: test 32" >>${LOGFILE}
+ pass 32
else
- echo "FAIL: test 32" | tee -a ${LOGFILE} # ; exit 1
+ fail 32
fi
if ${CVS} status first-dir >> ${LOGFILE}; then
- echo "PASS: test 33" >>${LOGFILE}
+ pass 33
else
- echo "FAIL: test 33" | tee -a ${LOGFILE} ; exit 1
+ fail 33
fi
# XXX why is this commented out???
# if ${CVS} diff -u first-dir >> ${LOGFILE} || test $? = 1 ; then
-# echo "PASS: test 34" >>${LOGFILE}
+# pass 34
# else
-# echo "FAIL: test 34" | tee -a ${LOGFILE} # ; exit 1
+# fail 34
# fi
if ${CVS} ci -m "second dive" first-dir >> ${LOGFILE} 2>&1; then
- echo "PASS: test 35" >>${LOGFILE}
+ pass 35
else
- echo "FAIL: test 35" | tee -a ${LOGFILE} ; exit 1
+ fail 35
fi
if ${CVS} tag second-dive first-dir ; then
- echo "PASS: test 36" >>${LOGFILE}
+ pass 36
else
- echo "FAIL: test 36" | tee -a ${LOGFILE} ; exit 1
+ fail 36
fi
# third dive - in bunch o' directories, add bunch o' files,
@@ -1532,137 +1755,137 @@ done"
rm file7
if ${CVS} rm file7 2>> ${LOGFILE}; then
- echo "PASS: test 37-$i" >>${LOGFILE}
+ pass 37-$i
else
- echo "FAIL: test 37-$i" | tee -a ${LOGFILE} ; exit 1
+ fail 37-$i
fi
# and add a new file
echo file14 >file14
if ${CVS} add file14 2>> ${LOGFILE}; then
- echo "PASS: test 38-$i" >>${LOGFILE}
+ pass 38-$i
else
- echo "FAIL: test 38-$i" | tee -a ${LOGFILE} ; exit 1
+ fail 38-$i
fi
done
cd ../../..
if ${CVS} update first-dir ; then
- echo "PASS: test 39" >>${LOGFILE}
+ pass 39
else
- echo "FAIL: test 39" | tee -a ${LOGFILE} ; exit 1
+ fail 39
fi
# FIXME: doesn't work right for added files
if ${CVS} log first-dir >> ${LOGFILE}; then
- echo "PASS: test 40" >>${LOGFILE}
+ pass 40
else
- echo "FAIL: test 40" | tee -a ${LOGFILE} # ; exit 1
+ fail 40
fi
if ${CVS} status first-dir >> ${LOGFILE}; then
- echo "PASS: test 41" >>${LOGFILE}
+ pass 41
else
- echo "FAIL: test 41" | tee -a ${LOGFILE} ; exit 1
+ fail 41
fi
# XXX why is this commented out?
# if ${CVS} diff -u first-dir >> ${LOGFILE} || test $? = 1 ; then
-# echo "PASS: test 42" >>${LOGFILE}
+# pass 42
# else
-# echo "FAIL: test 42" | tee -a ${LOGFILE} # ; exit 1
+# fail 42
# fi
if ${CVS} ci -m "third dive" first-dir >>${LOGFILE} 2>&1; then
- echo "PASS: test 43" >>${LOGFILE}
+ pass 43
else
- echo "FAIL: test 43" | tee -a ${LOGFILE} ; exit 1
+ fail 43
fi
dotest 43.5 "${testcvs} -q update first-dir" ''
if ${CVS} tag third-dive first-dir ; then
- echo "PASS: test 44" >>${LOGFILE}
+ pass 44
else
- echo "FAIL: test 44" | tee -a ${LOGFILE} ; exit 1
+ fail 44
fi
if echo "yes" | ${CVS} release -d first-dir ; then
- echo "PASS: test 45" >>${LOGFILE}
+ pass 45
else
- echo "FAIL: test 45" | tee -a ${LOGFILE} ; exit 1
+ fail 45
fi
# end of third dive
if test -d first-dir ; then
- echo "FAIL: test 45.5" | tee -a ${LOGFILE} ; exit 1
+ fail 45.5
else
- echo "PASS: test 45.5" >>${LOGFILE}
+ pass 45.5
fi
# now try some rtags
# rtag HEADS
if ${CVS} rtag rtagged-by-head first-dir ; then
- echo "PASS: test 46" >>${LOGFILE}
+ pass 46
else
- echo "FAIL: test 46" | tee -a ${LOGFILE} ; exit 1
+ fail 46
fi
# tag by tag
if ${CVS} rtag -r rtagged-by-head rtagged-by-tag first-dir ; then
- echo "PASS: test 47" >>${LOGFILE}
+ pass 47
else
- echo "FAIL: test 47" | tee -a ${LOGFILE} ; exit 1
+ fail 47
fi
# tag by revision
if ${CVS} rtag -r1.1 rtagged-by-revision first-dir ; then
- echo "PASS: test 48" >>${LOGFILE}
+ pass 48
else
- echo "FAIL: test 48" | tee -a ${LOGFILE} ; exit 1
+ fail 48
fi
# rdiff by revision
if ${CVS} rdiff -r1.1 -rrtagged-by-head first-dir >> ${LOGFILE} || test $? = 1 ; then
- echo "PASS: test 49" >>${LOGFILE}
+ pass 49
else
- echo "FAIL: test 49" | tee -a ${LOGFILE} ; exit 1
+ fail 49
fi
# now export by rtagged-by-head and rtagged-by-tag and compare.
if ${CVS} export -r rtagged-by-head first-dir ; then
- echo "PASS: test 50" >>${LOGFILE}
+ pass 50
else
- echo "FAIL: test 50" | tee -a ${LOGFILE} ; exit 1
+ fail 50
fi
mv first-dir 1dir
if ${CVS} export -r rtagged-by-tag first-dir ; then
- echo "PASS: test 51" >>${LOGFILE}
+ pass 51
else
- echo "FAIL: test 51" | tee -a ${LOGFILE} ; exit 1
+ fail 51
fi
directory_cmp 1dir first-dir
if $ISDIFF ; then
- echo "FAIL: test 52" | tee -a ${LOGFILE} ; exit 1
+ fail 52
else
- echo "PASS: test 52" >>${LOGFILE}
+ pass 52
fi
rm -r 1dir first-dir
# checkout by revision vs export by rtagged-by-revision and compare.
if ${CVS} export -rrtagged-by-revision -d export-dir first-dir ; then
- echo "PASS: test 53" >>${LOGFILE}
+ pass 53
else
- echo "FAIL: test 53" | tee -a ${LOGFILE} ; exit 1
+ fail 53
fi
if ${CVS} co -r1.1 first-dir ; then
- echo "PASS: test 54" >>${LOGFILE}
+ pass 54
else
- echo "FAIL: test 54" | tee -a ${LOGFILE} ; exit 1
+ fail 54
fi
# directory copies are done in an oblique way in order to avoid a bug in sun's tmp filesystem.
@@ -1671,9 +1894,9 @@ done"
directory_cmp first-dir export-dir
if $ISDIFF ; then
- echo "FAIL: test 55" | tee -a ${LOGFILE} ; exit 1
+ fail 55
else
- echo "PASS: test 55" >>${LOGFILE}
+ pass 55
fi
# interrupt, while we've got a clean 1.1 here, let's import it
@@ -1696,17 +1919,17 @@ No conflicts created by this import"
cd ..
if ${CVS} export -r HEAD second-dir ; then
- echo "PASS: test 57" >>${LOGFILE}
+ pass 57
else
- echo "FAIL: test 57" | tee -a ${LOGFILE} ; exit 1
+ fail 57
fi
directory_cmp first-dir second-dir
if $ISDIFF ; then
- echo "FAIL: test 58" | tee -a ${LOGFILE} ; exit 1
+ fail 58
else
- echo "PASS: test 58" >>${LOGFILE}
+ pass 58
fi
rm -r second-dir
@@ -1718,22 +1941,22 @@ No conflicts created by this import"
# update the top, cancelling sticky tags, retag, update other copy, compare.
cd first-dir
if ${CVS} update -A -l *file* 2>> ${LOGFILE}; then
- echo "PASS: test 59" >>${LOGFILE}
+ pass 59
else
- echo "FAIL: test 59" | tee -a ${LOGFILE} ; exit 1
+ fail 59
fi
# If we don't delete the tag first, cvs won't retag it.
# This would appear to be a feature.
if ${CVS} tag -l -d rtagged-by-revision ; then
- echo "PASS: test 60a" >>${LOGFILE}
+ pass 60a
else
- echo "FAIL: test 60a" | tee -a ${LOGFILE} ; exit 1
+ fail 60a
fi
if ${CVS} tag -l rtagged-by-revision ; then
- echo "PASS: test 60b" >>${LOGFILE}
+ pass 60b
else
- echo "FAIL: test 60b" | tee -a ${LOGFILE} ; exit 1
+ fail 60b
fi
cd ..
@@ -1744,9 +1967,9 @@ No conflicts created by this import"
dotest 61 "${testcvs} -q diff -u" ''
if ${CVS} update ; then
- echo "PASS: test 62" >>${LOGFILE}
+ pass 62
else
- echo "FAIL: test 62" | tee -a ${LOGFILE} ; exit 1
+ fail 62
fi
cd ..
@@ -1756,9 +1979,9 @@ No conflicts created by this import"
# directory_cmp 1dir first-dir
#
# if $ISDIFF ; then
-# echo "FAIL: test 63" | tee -a ${LOGFILE} # ; exit 1
+# fail 63
# else
-# echo "PASS: test 63" >>${LOGFILE}
+# pass 63
# fi
rm -r 1dir first-dir
@@ -1774,44 +1997,44 @@ No conflicts created by this import"
# which don't exist in the remote output? would seem to be
# a CVS bug.
dotest basic2-64 "${testcvs} his -x TOFWUCGMAR -a" \
-"O [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir =first-dir= ${TMPPWD}/\*
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file6 first-dir == ${TMPPWD}
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file7 first-dir == ${TMPPWD}
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file6 first-dir/dir1 == ${TMPPWD}
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file7 first-dir/dir1 == ${TMPPWD}
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file6 first-dir/dir1/dir2 == ${TMPPWD}
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file7 first-dir/dir1/dir2 == ${TMPPWD}
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file14 first-dir == ${TMPPWD}
-M [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file6 first-dir == ${TMPPWD}
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file14 first-dir/dir1 == ${TMPPWD}
-M [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file6 first-dir/dir1 == ${TMPPWD}
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file14 first-dir/dir1/dir2 == ${TMPPWD}
-M [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file6 first-dir/dir1/dir2 == ${TMPPWD}
-F [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* =first-dir= ${TMPPWD}/\*
-T [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-head:A\]
-T [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-tag:rtagged-by-head\]
-T [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-revision:1\.1\]
-O [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* \[1\.1\] first-dir =first-dir= ${TMPPWD}/\*
-U [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file6 first-dir == ${TMPPWD}/first-dir
-U [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file7 first-dir == ${TMPPWD}/first-dir" \
-"O [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir =first-dir= <remote>/\*
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file6 first-dir == <remote>
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file7 first-dir == <remote>
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file6 first-dir/dir1 == <remote>
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file7 first-dir/dir1 == <remote>
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file6 first-dir/dir1/dir2 == <remote>
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file7 first-dir/dir1/dir2 == <remote>
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file14 first-dir == <remote>
-M [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file6 first-dir == <remote>
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file14 first-dir/dir1 == <remote>
-M [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file6 first-dir/dir1 == <remote>
-A [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.1 file14 first-dir/dir1/dir2 == <remote>
-M [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* 1\.2 file6 first-dir/dir1/dir2 == <remote>
-F [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* =first-dir= <remote>/\*
-T [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-head:A\]
-T [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-tag:rtagged-by-head\]
-T [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-revision:1\.1\]
-O [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* \[1\.1\] first-dir =first-dir= <remote>/\*"
+"O [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir =first-dir= ${TMPPWD}/\*
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir == ${TMPPWD}
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir == ${TMPPWD}
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir/dir1 == ${TMPPWD}
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir/dir1 == ${TMPPWD}
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir/dir1/dir2 == ${TMPPWD}
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir/dir1/dir2 == ${TMPPWD}
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir == ${TMPPWD}
+M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir == ${TMPPWD}
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir/dir1 == ${TMPPWD}
+M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir/dir1 == ${TMPPWD}
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir/dir1/dir2 == ${TMPPWD}
+M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir/dir1/dir2 == ${TMPPWD}
+F [0-9/]* [0-9:]* ${PLUS}0000 ${username} =first-dir= ${TMPPWD}/\*
+T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\]
+T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\]
+T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\]
+O [0-9/]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir =first-dir= ${TMPPWD}/\*
+U [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir == ${TMPPWD}/first-dir
+U [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file7 first-dir == ${TMPPWD}/first-dir" \
+"O [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir =first-dir= <remote>/\*
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir == <remote>
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir == <remote>
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir/dir1 == <remote>
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir/dir1 == <remote>
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file6 first-dir/dir1/dir2 == <remote>
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file7 first-dir/dir1/dir2 == <remote>
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir == <remote>
+M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir == <remote>
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir/dir1 == <remote>
+M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir/dir1 == <remote>
+A [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.1 file14 first-dir/dir1/dir2 == <remote>
+M [0-9/]* [0-9:]* ${PLUS}0000 ${username} 1\.2 file6 first-dir/dir1/dir2 == <remote>
+F [0-9/]* [0-9:]* ${PLUS}0000 ${username} =first-dir= <remote>/\*
+T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-head:A\]
+T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-tag:rtagged-by-head\]
+T [0-9/]* [0-9:]* ${PLUS}0000 ${username} first-dir \[rtagged-by-revision:1\.1\]
+O [0-9/]* [0-9:]* ${PLUS}0000 ${username} \[1\.1\] first-dir =first-dir= <remote>/\*"
rm -rf ${CVSROOT_DIRNAME}/first-dir
rm -rf ${CVSROOT_DIRNAME}/second-dir
@@ -1828,11 +2051,12 @@ O [0-9/]* [0-9:]* ${PLUS}0000 [a-z0-9@][a-z0-9@]* \[1\.1\] first-dir =
echo '$''Name$' >> foo
echo '$''Id$' > bar
echo '$''Name$' >> bar
- dotest rdiff-1 \
+ dotest_sort rdiff-1 \
"${testcvs} import -I ! -m test-import-with-keyword trdiff TRDIFF T1" \
-'N trdiff/foo
-N trdiff/bar
+'
+N trdiff/bar
+N trdiff/foo
No conflicts created by this import'
dotest rdiff-2 \
"${testcvs} co -ko trdiff" \
@@ -1852,7 +2076,7 @@ done"
dotest rdiff-4 \
"${testcvs} add -m new-file-description new" \
"${PROG} [a-z]*: scheduling file \`new' for addition
-${PROG} [a-z]*: use 'cvs commit' to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest rdiff-5 \
"${testcvs} commit -m added-new-file new" \
"RCS file: ${TESTDIR}/cvsroot/trdiff/new,v
@@ -1932,9 +2156,9 @@ diff -c /dev/null trdiff/new:1\.1
mkdir ${CVSROOT_DIRNAME}/first-dir
if ${CVS} co first-dir ; then
- echo "PASS: test 65" >>${LOGFILE}
+ pass 65
else
- echo "FAIL: test 65" | tee -a ${LOGFILE} ; exit 1
+ fail 65
fi
cd first-dir
@@ -1948,7 +2172,7 @@ diff -c /dev/null trdiff/new:1\.1
echo file in subdir >sfile
dotest 65a1 "${testcvs} add sfile" \
"${PROG}"' [a-z]*: scheduling file `sfile'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
dotest 65a2 "${testcvs} -q ci -m add-it" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/subdir/sfile,v
done
@@ -1959,7 +2183,7 @@ done"
rm sfile
dotest 65a3 "${testcvs} rm sfile" \
"${PROG}"' [a-z]*: scheduling `sfile'\'' for removal
-'"${PROG}"' [a-z]*: use '\'"${PROG}"' commit'\'' to remove this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove this file permanently'
dotest 65a4 "${testcvs} -q ci -m remove-it" \
"Removing sfile;
${TESTDIR}/cvsroot/first-dir/subdir/sfile,v <-- sfile
@@ -1972,31 +2196,31 @@ done"
# add a file.
touch file1
if ${CVS} add file1 2>> ${LOGFILE}; then
- echo "PASS: test 66" >>${LOGFILE}
+ pass 66
else
- echo "FAIL: test 66" | tee -a ${LOGFILE} ; exit 1
+ fail 66
fi
# commit
if ${CVS} ci -m test >> ${LOGFILE} 2>&1; then
- echo "PASS: test 67" >>${LOGFILE}
+ pass 67
else
- echo "FAIL: test 67" | tee -a ${LOGFILE} ; exit 1
+ fail 67
fi
# remove
rm file1
if ${CVS} rm file1 2>> ${LOGFILE}; then
- echo "PASS: test 68" >>${LOGFILE}
+ pass 68
else
- echo "FAIL: test 68" | tee -a ${LOGFILE} ; exit 1
+ fail 68
fi
# commit
if ${CVS} ci -m test >>${LOGFILE} ; then
- echo "PASS: test 69" >>${LOGFILE}
+ pass 69
else
- echo "FAIL: test 69" | tee -a ${LOGFILE} ; exit 1
+ fail 69
fi
dotest_fail 69a0 "test -f file1" ''
@@ -2011,30 +2235,30 @@ done"
# create second file
touch file2
if ${CVS} add file1 file2 2>> ${LOGFILE}; then
- echo "PASS: test 70" >>${LOGFILE}
+ pass 70
else
- echo "FAIL: test 70" | tee -a ${LOGFILE} ; exit 1
+ fail 70
fi
# commit
if ${CVS} ci -m test >> ${LOGFILE} 2>&1; then
- echo "PASS: test 71" >>${LOGFILE}
+ pass 71
else
- echo "FAIL: test 71" | tee -a ${LOGFILE} ; exit 1
+ fail 71
fi
# log
if ${CVS} log file1 >> ${LOGFILE}; then
- echo "PASS: test 72" >>${LOGFILE}
+ pass 72
else
- echo "FAIL: test 72" | tee -a ${LOGFILE} ; exit 1
+ fail 72
fi
# file4 will be dead at the time of branching and stay dead.
echo file4 > file4
dotest death-file4-add "${testcvs} add file4" \
"${PROG}"' [a-z]*: scheduling file `file4'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
dotest death-file4-ciadd "${testcvs} -q ci -m add file4" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/file4,v
done
@@ -2045,7 +2269,7 @@ done"
rm file4
dotest death-file4-rm "${testcvs} remove file4" \
"${PROG}"' [a-z]*: scheduling `file4'\'' for removal
-'"${PROG}"' [a-z]*: use '\'"${PROG}"' commit'\'' to remove this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove this file permanently'
dotest death-file4-cirm "${testcvs} -q ci -m remove file4" \
"Removing file4;
${TESTDIR}/cvsroot/first-dir/file4,v <-- file4
@@ -2058,16 +2282,16 @@ T file2'
# branch1
if ${CVS} tag -b branch1 ; then
- echo "PASS: test 73" >>${LOGFILE}
+ pass 73
else
- echo "FAIL: test 73" | tee -a ${LOGFILE} ; exit 1
+ fail 73
fi
# and move to the branch.
if ${CVS} update -r branch1 ; then
- echo "PASS: test 74" >>${LOGFILE}
+ pass 74
else
- echo "FAIL: test 74" | tee -a ${LOGFILE} ; exit 1
+ fail 74
fi
dotest_fail death-file4-3 "test -f file4" ''
@@ -2075,16 +2299,16 @@ T file2'
# add a file in the branch
echo line1 from branch1 >> file3
if ${CVS} add file3 2>> ${LOGFILE}; then
- echo "PASS: test 75" >>${LOGFILE}
+ pass 75
else
- echo "FAIL: test 75" | tee -a ${LOGFILE} ; exit 1
+ fail 75
fi
# commit
if ${CVS} ci -m test >> ${LOGFILE} 2>&1; then
- echo "PASS: test 76" >>${LOGFILE}
+ pass 76
else
- echo "FAIL: test 76" | tee -a ${LOGFILE} ; exit 1
+ fail 76
fi
dotest death-76a0 \
@@ -2111,31 +2335,31 @@ diff -c first-dir/file3:1\.1\.2\.1 first-dir/file3:removed
# remove
rm file3
if ${CVS} rm file3 2>> ${LOGFILE}; then
- echo "PASS: test 77" >>${LOGFILE}
+ pass 77
else
- echo "FAIL: test 77" | tee -a ${LOGFILE} ; exit 1
+ fail 77
fi
# commit
if ${CVS} ci -m test >>${LOGFILE} ; then
- echo "PASS: test 78" >>${LOGFILE}
+ pass 78
else
- echo "FAIL: test 78" | tee -a ${LOGFILE} ; exit 1
+ fail 78
fi
# add again
echo line1 from branch1 >> file3
if ${CVS} add file3 2>> ${LOGFILE}; then
- echo "PASS: test 79" >>${LOGFILE}
+ pass 79
else
- echo "FAIL: test 79" | tee -a ${LOGFILE} ; exit 1
+ fail 79
fi
# commit
if ${CVS} ci -m test >> ${LOGFILE} 2>&1; then
- echo "PASS: test 80" >>${LOGFILE}
+ pass 80
else
- echo "FAIL: test 80" | tee -a ${LOGFILE} ; exit 1
+ fail 80
fi
# change the first file
@@ -2143,39 +2367,39 @@ diff -c first-dir/file3:1\.1\.2\.1 first-dir/file3:removed
# commit
if ${CVS} ci -m test >> ${LOGFILE} 2>&1; then
- echo "PASS: test 81" >>${LOGFILE}
+ pass 81
else
- echo "FAIL: test 81" | tee -a ${LOGFILE} ; exit 1
+ fail 81
fi
# remove the second
rm file2
if ${CVS} rm file2 2>> ${LOGFILE}; then
- echo "PASS: test 82" >>${LOGFILE}
+ pass 82
else
- echo "FAIL: test 82" | tee -a ${LOGFILE} ; exit 1
+ fail 82
fi
# commit
if ${CVS} ci -m test >>${LOGFILE}; then
- echo "PASS: test 83" >>${LOGFILE}
+ pass 83
else
- echo "FAIL: test 83" | tee -a ${LOGFILE} ; exit 1
+ fail 83
fi
# back to the trunk.
if ${CVS} update -A 2>> ${LOGFILE}; then
- echo "PASS: test 84" >>${LOGFILE}
+ pass 84
else
- echo "FAIL: test 84" | tee -a ${LOGFILE} ; exit 1
+ fail 84
fi
dotest_fail death-file4-4 "test -f file4" ''
if test -f file3 ; then
- echo "FAIL: test 85" | tee -a ${LOGFILE} ; exit 1
+ fail 85
else
- echo "PASS: test 85" >>${LOGFILE}
+ pass 85
fi
# join
@@ -2190,24 +2414,23 @@ U file3"
dotest_fail death-file4-5 "test -f file4" ''
if test -f file3 ; then
- echo "PASS: test 87" >>${LOGFILE}
+ pass 87
else
- echo "FAIL: test 87" | tee -a ${LOGFILE} ; exit 1
+ fail 87
fi
# Make sure that we joined the correct change to file1
if echo line2 from branch1 | cmp - file1 >/dev/null; then
- echo 'PASS: test 87a' >>${LOGFILE}
+ pass 87a
else
- echo 'FAIL: test 87a' | tee -a ${LOGFILE}
- exit 1
+ fail 87a
fi
# update
if ${CVS} update ; then
- echo "PASS: test 88" >>${LOGFILE}
+ pass 88
else
- echo "FAIL: test 88" | tee -a ${LOGFILE} ; exit 1
+ fail 88
fi
# commit
@@ -2236,22 +2459,22 @@ U first-dir/file3'
# remove first file.
rm file1
if ${CVS} rm file1 2>> ${LOGFILE}; then
- echo "PASS: test 90" >>${LOGFILE}
+ pass 90
else
- echo "FAIL: test 90" | tee -a ${LOGFILE} ; exit 1
+ fail 90
fi
# commit
if ${CVS} ci -m test >>${LOGFILE}; then
- echo "PASS: test 91" >>${LOGFILE}
+ pass 91
else
- echo "FAIL: test 91" | tee -a ${LOGFILE} ; exit 1
+ fail 91
fi
if test -f file1 ; then
- echo "FAIL: test 92" | tee -a ${LOGFILE} ; exit 1
+ fail 92
else
- echo "PASS: test 92" >>${LOGFILE}
+ pass 92
fi
# typo; try to get to the branch and fail
@@ -2259,29 +2482,29 @@ U first-dir/file3'
"${PROG}"' \[[a-z]* aborted\]: no such tag brnach1'
# Make sure we are still on the trunk
if test -f file1 ; then
- echo "FAIL: 92.1b" | tee -a ${LOGFILE} ; exit 1
+ fail 92.1b
else
- echo "PASS: 92.1b" >>${LOGFILE}
+ pass 92.1b
fi
if test -f file3 ; then
- echo "PASS: 92.1c" >>${LOGFILE}
+ pass 92.1c
else
- echo "FAIL: 92.1c" | tee -a ${LOGFILE} ; exit 1
+ fail 92.1c
fi
# back to branch1
if ${CVS} update -r branch1 2>> ${LOGFILE}; then
- echo "PASS: test 93" >>${LOGFILE}
+ pass 93
else
- echo "FAIL: test 93" | tee -a ${LOGFILE} ; exit 1
+ fail 93
fi
dotest_fail death-file4-6 "test -f file4" ''
if test -f file1 ; then
- echo "PASS: test 94" >>${LOGFILE}
+ pass 94
else
- echo "FAIL: test 94" | tee -a ${LOGFILE} ; exit 1
+ fail 94
fi
# and join
@@ -2312,7 +2535,7 @@ U first-dir/file3'
echo "first revision" > file1
dotest death2-2 "${testcvs} add file1" \
"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
dotest death2-3 "${testcvs} -q commit -m add" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
@@ -2339,6 +2562,9 @@ ${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
dotest_fail death2-diff-1 "${testcvs} -q diff file1" \
"${PROG} [a-z]*: file1 was removed, no comparison available"
+ # If the DIFF that CVS is using (options.h) is Sun diff, this
+ # test is said to fail (I think the /dev/null is the part
+ # that differs), along with a number of the other similar tests.
dotest_fail death2-diff-2 "${testcvs} -q diff -N -c file1" \
"Index: file1
===================================================================
@@ -2408,7 +2634,7 @@ diff -c first-dir/file1:1\.1 first-dir/file1:removed
echo "second revision" > file1
dotest death2-9 "${testcvs} add file1" \
"${PROG}"' [a-z]*: file `file1'\'' will be added on branch `branch'\'' from version 1\.1\.2\.1
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
# Test diff of the added file before it is committed.
dotest_fail death2-diff-7 "${testcvs} -q diff file1" \
@@ -2439,7 +2665,7 @@ done"
echo "first revision" > file2
dotest death2-12 "${testcvs} add file2" \
"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
dotest death2-13 "${testcvs} -q commit -m add" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
done
@@ -2462,7 +2688,7 @@ ${PROG} [a-z]*: file2 is no longer in the repository"
echo "branch revision" > file2
dotest death2-15 "${testcvs} add file2" \
"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition on branch `branch'\''
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
dotest death2-16 "${testcvs} -q commit -m add" \
"Checking in file2;
${TESTDIR}/cvsroot/first-dir/file2,v <-- file2
@@ -2473,7 +2699,7 @@ done"
echo "first revision" > file3
dotest death2-17 "${testcvs} add file3" \
"${PROG}"' [a-z]*: scheduling file `file3'\'' for addition on branch `branch'\''
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
dotest death2-18 "${testcvs} -q commit -m add" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/Attic/file3,v
done
@@ -2594,7 +2820,8 @@ ${PLUS} first revision"
'"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
'"${PROG}"' [a-z]*: scheduling file `file3'\'' for addition
'"${PROG}"' [a-z]*: scheduling file `file4'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
+ dotest branches-2a "${testcvs} -n -q ci -m dont-commit" ""
dotest_lit branches-3 "${testcvs} -q ci -m add-it" <<HERE
RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
done
@@ -2627,6 +2854,13 @@ HERE
${TESTDIR}/cvsroot/first-dir/file4,v <-- file4
new revision: 1\.2; previous revision: 1\.1
done"
+ # The "cvs log file4" in test branches-14.3 will test that we
+ # didn't really add the tag.
+ dotest branches-3.3 "${testcvs} -qn tag dont-tag" \
+"T file1
+T file2
+T file3
+T file4"
dotest branches-4 "${testcvs} tag -b br1" "${PROG}"' [a-z]*: Tagging \.
T file1
T file2
@@ -2713,29 +2947,29 @@ total revisions: 6; selected revisions: 6
description:
----------------------------
revision 1\.3
-date: [0-9/: ]*; author: [a-z0-9@][a-z0-9@]*; state: Exp; lines: ${PLUS}1 -1
+date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1
trunk-change-after-branch
----------------------------
revision 1\.2
-date: [0-9/: ]*; author: [a-z0-9@][a-z0-9@]*; state: Exp; lines: ${PLUS}1 -1
+date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1
branches: 1\.2\.2;
trunk-before-branch
----------------------------
revision 1\.1
-date: [0-9/: ]*; author: [a-z0-9@][a-z0-9@]*; state: Exp;
+date: [0-9/: ]*; author: ${username}; state: Exp;
add-it
----------------------------
revision 1\.2\.2\.2
-date: [0-9/: ]*; author: [a-z0-9@][a-z0-9@]*; state: Exp; lines: ${PLUS}1 -1
+date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1
change-on-br1
----------------------------
revision 1\.2\.2\.1
-date: [0-9/: ]*; author: [a-z0-9@][a-z0-9@]*; state: Exp; lines: ${PLUS}1 -1
+date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1
branches: 1\.2\.2\.1\.2;
modify
----------------------------
revision 1\.2\.2\.1\.2\.1
-date: [0-9/: ]*; author: [a-z0-9@][a-z0-9@]*; state: Exp; lines: ${PLUS}1 -1
+date: [0-9/: ]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1
modify
============================================================================="
dotest_status branches-14.4 1 \
@@ -2780,6 +3014,232 @@ rcsmerge: warning: conflicts during merge"
=======
1:brbr
[>]>>>>>> 1\.1\.2\.1\.2\.1'
+
+ dotest branches-o1 "${testcvs} -q admin -o ::brbr" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/file3,v
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/file4,v
+done"
+ cd ..
+
+ if test "$keep" = yes; then
+ echo Keeping ${TESTDIR} and exiting due to --keep
+ exit 0
+ fi
+
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ rm -r first-dir
+ ;;
+
+ rcslib)
+ # Test librarification of RCS.
+ # First: test whether `cvs diff' handles $Name expansion
+ # correctly. We diff two revisions with their symbolic tags;
+ # neither tag should be expanded in the output. Also diff
+ # one revision with the working copy.
+
+ mkdir ${CVSROOT_DIRNAME}/first-dir
+ dotest rcsdiff-1 "${testcvs} -q co first-dir" ''
+ cd first-dir
+ echo "I am the first foo, and my name is $""Name$." > foo.c
+ dotest rcsdiff-2 "${testcvs} add -m new-file foo.c" \
+"${PROG} [a-z]*: scheduling file .foo\.c. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest rcsdiff-3 "${testcvs} commit -m rev1 foo.c" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/foo\.c,v
+done
+Checking in foo\.c;
+${TESTDIR}/cvsroot/first-dir/foo.c,v <-- foo\.c
+initial revision: 1\.1
+done"
+ dotest rcsdiff-4 "${testcvs} tag first foo.c" "T foo\.c"
+ dotest rcsdiff-5 "${testcvs} update -p -r first foo.c" \
+"===================================================================
+Checking out foo\.c
+RCS: ${TESTDIR}/cvsroot/first-dir/foo\.c,v
+VERS: 1\.1
+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
+I am the first foo, and my name is \$""Name: first \$\."
+
+ echo "I am the second foo, and my name is $""Name$." > foo.c
+ dotest rcsdiff-6 "${testcvs} commit -m rev2 foo.c" \
+"Checking in foo\.c;
+${TESTDIR}/cvsroot/first-dir/foo\.c,v <-- foo\.c
+new revision: 1\.2; previous revision: 1\.1
+done"
+ dotest rcsdiff-7 "${testcvs} tag second foo.c" "T foo\.c"
+ dotest rcsdiff-8 "${testcvs} update -p -r second foo.c" \
+"===================================================================
+Checking out foo\.c
+RCS: ${TESTDIR}/cvsroot/first-dir/foo\.c,v
+VERS: 1\.2
+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
+I am the second foo, and my name is \$""Name: second \$\."
+
+ dotest_fail rcsdiff-9 "${testcvs} diff -r first -r second" \
+"${PROG} [a-z]*: Diffing \.
+Index: foo\.c
+===================================================================
+RCS file: ${TESTDIR}/cvsroot/first-dir/foo\.c,v
+retrieving revision 1\.1
+retrieving revision 1\.2
+diff -r1\.1 -r1\.2
+1c1
+< I am the first foo, and my name is \$""Name: \$\.
+---
+> I am the second foo, and my name is \$""Name: \$\."
+
+ echo "I am the once and future foo, and my name is $""Name$." > foo.c
+ dotest_fail rcsdiff-10 "${testcvs} diff -r first" \
+"${PROG} [a-z]*: Diffing \.
+Index: foo\.c
+===================================================================
+RCS file: ${TESTDIR}/cvsroot/first-dir/foo\.c,v
+retrieving revision 1\.1
+diff -r1\.1 foo\.c
+1c1
+< I am the first foo, and my name is \$""Name: \$\.
+---
+> I am the once and future foo, and my name is \$""Name\$\."
+
+ # Test handling of libdiff options. diff gets quite enough
+ # of a workout elsewhere in sanity.sh, so we assume that it's
+ # mostly working properly if it passes all the other tests.
+ # The main one we want to try is regex handling, since we are
+ # using CVS's regex matcher and not diff's.
+
+ cat >rgx.c <<EOF
+test_regex (whiz, bang)
+{
+foo;
+bar;
+baz;
+grumble;
+}
+EOF
+
+ dotest rcslib-diffrgx-1 "${testcvs} -q add -m '' rgx.c" \
+"${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest rcslib-diffrgx-2 "${testcvs} -q ci -m '' rgx.c" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/rgx\.c,v
+done
+Checking in rgx\.c;
+${TESTDIR}/cvsroot/first-dir/rgx\.c,v <-- rgx\.c
+initial revision: 1\.1
+done"
+ cat >rgx.c <<EOF
+test_regex (whiz, bang)
+{
+foo;
+bar;
+baz;
+mumble;
+}
+EOF
+ # Use dotest_fail because exit status from `cvs diff' must be 1.
+ dotest_fail rcslib-diffrgx-3 "${testcvs} diff -c -F.*( rgx.c" \
+"Index: rgx\.c
+===================================================================
+RCS file: ${TESTDIR}/cvsroot/first-dir/rgx\.c,v
+retrieving revision 1\.1
+diff -c -F\.\*( -r1\.1 rgx\.c
+\*\*\* rgx\.c [0-9/]* [0-9:]* 1\.1
+--- rgx\.c [0-9/]* [0-9:]*
+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* test_regex (whiz, bang)
+\*\*\* 3,7 \*\*\*\*
+ foo;
+ bar;
+ baz;
+! grumble;
+ }
+--- 3,7 ----
+ foo;
+ bar;
+ baz;
+! mumble;
+ }"
+
+ # Tests of rcsmerge/diff3. Merge operations get a good general
+ # workout elsewhere; we want to make sure that options are still
+ # handled properly. Try merging two branches with -kv, to test
+ # both -j and -k switches.
+
+ cd ..
+
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ rm -r first-dir
+
+ mkdir 1; cd 1
+ dotest rcslib-merge-1 "${testcvs} -q co -l ." ""
+ mkdir first-dir
+ dotest rcslib-merge-2 "${testcvs} -q add first-dir" \
+"Directory ${TESTDIR}/cvsroot.*/first-dir added to the repository"
+ cd ..; rm -r 1
+
+ dotest rcslib-merge-3 "${testcvs} -q co first-dir" ""
+ cd first-dir
+
+ echo '$''Revision$' > file1
+ echo '2' >> file1
+ echo '3' >> file1
+ dotest rcslib-merge-4 "${testcvs} -q add file1" \
+"${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest rcslib-merge-5 "${testcvs} -q commit -m '' file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done
+Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+initial revision: 1\.1
+done"
+ sed -e 's/2/two/' file1 > f; mv f file1
+ dotest rcslib-merge-6 "${testcvs} -q commit -m '' file1" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.2; previous revision: 1\.1
+done"
+ dotest rcslib-merge-7 "${testcvs} -q tag -b -r 1.1 patch1" "T file1"
+ dotest rcslib-merge-8 "${testcvs} -q update -r patch1" "[UP] file1"
+ dotest rcslib-merge-9 "${testcvs} -q status" \
+"===================================================================
+File: file1 Status: Up-to-date
+
+ Working revision: 1\.1.*
+ Repository revision: 1\.1 ${TESTDIR}/cvsroot/first-dir/file1,v
+ Sticky Tag: patch1 (branch: 1\.1\.2)
+ Sticky Date: (none)
+ Sticky Options: (none)"
+ dotest rcslib-merge-10 "cat file1" \
+'$''Revision: 1\.1 $
+2
+3'
+ sed -e 's/3/three/' file1 > f; mv f file1
+ dotest rcslib-merge-11 "${testcvs} -q commit -m '' file1" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.1\.2\.1; previous revision: 1\.1
+done"
+ dotest rcslib-merge-12 "${testcvs} -q update -kv -j1.2" \
+"U file1
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+retrieving revision 1\.1
+retrieving revision 1\.2
+Merging differences between 1\.1 and 1\.2 into file1
+rcsmerge: warning: conflicts during merge"
+ dotest rcslib-merge-13 "cat file1" \
+"<<<<<<< file1
+1\.1\.2\.1
+2
+three
+[=]======
+1\.2
+two
+3
+[>]>>>>>> 1\.2"
+
cd ..
if test "$keep" = yes; then
@@ -2800,7 +3260,7 @@ rcsmerge: warning: conflicts during merge"
echo 1:trunk-1 >file1
dotest multibranch-2 "${testcvs} add file1" \
"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
dotest_lit multibranch-3 "${testcvs} -q ci -m add-it" <<HERE
RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
done
@@ -2875,6 +3335,19 @@ modify-on-br1
;;
import) # test death after import
+ # Tests of "cvs import":
+ # basic2
+ # rdiff -- imports with keywords
+ # import -- more tests of imports with keywords
+ # importb -- -b option.
+ # modules3
+ # mflag -- various -m messages
+ # ignore -- import and cvsignore
+ # binwrap -- import and -k wrappers
+ # info -- imports which are rejected by verifymsg
+ # head -- intended to test vendor branches and HEAD,
+ # although it doesn't really do it yet.
+
# import
mkdir import-dir ; cd import-dir
@@ -2891,9 +3364,9 @@ modify-on-br1
cp imported-f2 ../imported-f2-orig.tmp
if ${CVS} import -m first-import first-dir vendor-branch junk-1_0 ; then
- echo "PASS: test 96" >>${LOGFILE}
+ pass 96
else
- echo "FAIL: test 96" | tee -a ${LOGFILE} ; exit 1
+ fail 96
fi
if cmp ../imported-f2-orig.tmp imported-f2; then
@@ -2905,31 +3378,31 @@ modify-on-br1
# co
if ${CVS} co first-dir ; then
- echo "PASS: test 97" >>${LOGFILE}
+ pass 97
else
- echo "FAIL: test 97" | tee -a ${LOGFILE} ; exit 1
+ fail 97
fi
cd first-dir
for i in 1 2 3 4 ; do
if test -f imported-f"$i" ; then
- echo "PASS: test 98-$i" >>${LOGFILE}
+ pass 98-$i
else
- echo "FAIL: test 98-$i" | tee -a ${LOGFILE} ; exit 1
+ fail 98-$i
fi
done
if test -d RCS; then
- echo "FAIL: test 98.5" | tee -a ${LOGFILE} ; exit 1
+ fail 98.5
else
- echo "PASS: test 98.5" >>${LOGFILE}
+ pass 98.5
fi
# remove
rm imported-f1
if ${CVS} rm imported-f1 2>> ${LOGFILE}; then
- echo "PASS: test 99" >>${LOGFILE}
+ pass 99
else
- echo "FAIL: test 99" | tee -a ${LOGFILE} ; exit 1
+ fail 99
fi
# change
@@ -2937,46 +3410,46 @@ modify-on-br1
# commit
if ${CVS} ci -m local-changes >> ${LOGFILE} 2>&1; then
- echo "PASS: test 100" >>${LOGFILE}
+ pass 100
else
- echo "FAIL: test 100" | tee -a ${LOGFILE} ; exit 1
+ fail 100
fi
# log
if ${CVS} log imported-f1 | grep '1.1.1.2 (dead)' ; then
- echo "FAIL: test 101" | tee -a ${LOGFILE} ; exit 1
+ fail 101
else
- echo "PASS: test 101" >>${LOGFILE}
+ pass 101
fi
# update into the vendor branch.
if ${CVS} update -rvendor-branch ; then
- echo "PASS: test 102" >>${LOGFILE}
+ pass 102
else
- echo "FAIL: test 102" | tee -a ${LOGFILE} ; exit 1
+ fail 102
fi
# remove file4 on the vendor branch
rm imported-f4
if ${CVS} rm imported-f4 2>> ${LOGFILE}; then
- echo "PASS: test 103" >>${LOGFILE}
+ pass 103
else
- echo "FAIL: test 103" | tee -a ${LOGFILE} ; exit 1
+ fail 103
fi
# commit
if ${CVS} ci -m vendor-removed imported-f4 >>${LOGFILE}; then
- echo "PASS: test 104" >>${LOGFILE}
+ pass 104
else
- echo "FAIL: test 104" | tee -a ${LOGFILE} ; exit 1
+ fail 104
fi
# update to main line
if ${CVS} update -A 2>> ${LOGFILE}; then
- echo "PASS: test 105" >>${LOGFILE}
+ pass 105
else
- echo "FAIL: test 105" | tee -a ${LOGFILE} ; exit 1
+ fail 105
fi
# second import - file4 deliberately unchanged
@@ -2987,9 +3460,9 @@ modify-on-br1
cp imported-f2 ../imported-f2-orig.tmp
if ${CVS} import -m second-import first-dir vendor-branch junk-2_0 ; then
- echo "PASS: test 106" >>${LOGFILE}
+ pass 106
else
- echo "FAIL: test 106" | tee -a ${LOGFILE} ; exit 1
+ fail 106
fi
if cmp ../imported-f2-orig.tmp imported-f2; then
pass 106.5
@@ -3000,45 +3473,45 @@ modify-on-br1
# co
if ${CVS} co first-dir ; then
- echo "PASS: test 107" >>${LOGFILE}
+ pass 107
else
- echo "FAIL: test 107" | tee -a ${LOGFILE} ; exit 1
+ fail 107
fi
cd first-dir
if test -f imported-f1 ; then
- echo "FAIL: test 108" | tee -a ${LOGFILE} ; exit 1
+ fail 108
else
- echo "PASS: test 108" >>${LOGFILE}
+ pass 108
fi
for i in 2 3 ; do
if test -f imported-f"$i" ; then
- echo "PASS: test 109-$i" >>${LOGFILE}
+ pass 109-$i
else
- echo "FAIL: test 109-$i" | tee -a ${LOGFILE} ; exit 1
+ fail 109-$i
fi
done
# check vendor branch for file4
if ${CVS} update -rvendor-branch ; then
- echo "PASS: test 110" >>${LOGFILE}
+ pass 110
else
- echo "FAIL: test 110" | tee -a ${LOGFILE} ; exit 1
+ fail 110
fi
if test -f imported-f4 ; then
- echo "PASS: test 111" >>${LOGFILE}
+ pass 111
else
- echo "FAIL: test 111" | tee -a ${LOGFILE} ; exit 1
+ fail 111
fi
# update to main line
if ${CVS} update -A 2>> ${LOGFILE}; then
- echo "PASS: test 112" >>${LOGFILE}
+ pass 112
else
- echo "FAIL: test 112" | tee -a ${LOGFILE} ; exit 1
+ fail 112
fi
cd ..
@@ -3055,26 +3528,26 @@ rcsmerge: warning: conflicts during merge"
cd first-dir
if test -f imported-f1 ; then
- echo "FAIL: test 114" | tee -a ${LOGFILE} ; exit 1
+ fail 114
else
- echo "PASS: test 114" >>${LOGFILE}
+ pass 114
fi
for i in 2 3 ; do
if test -f imported-f"$i" ; then
- echo "PASS: test 115-$i" >>${LOGFILE}
+ pass 115-$i
else
- echo "FAIL: test 115-$i" | tee -a ${LOGFILE} ; exit 1
+ fail 115-$i
fi
done
dotest import-116 'cat imported-f2' \
'imported file2
[<]<<<<<< imported-f2
-import should not expand \$''Id: imported-f2,v 1\.2 [0-9/]* [0-9:]* [a-z0-9@][a-z0-9@]* Exp \$
+import should not expand \$''Id: imported-f2,v 1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
local-change
[=]======
-import should not expand \$''Id: imported-f2,v 1\.1\.1\.2 [0-9/]* [0-9:]* [a-z0-9@][a-z0-9@]* Exp \$
+import should not expand \$''Id: imported-f2,v 1\.1\.1\.2 [0-9/]* [0-9:]* '"${username}"' Exp \$
rev 2 of file 2
[>]>>>>>> 1\.1\.1\.2'
@@ -3084,9 +3557,128 @@ rev 2 of file 2
rm -r import-dir
;;
+ importb)
+ # More cvs import tests, especially -b option.
+
+ # OK, first we get some sources from the NetMunger project, and
+ # import them into the 1.1.1 vendor branch.
+ mkdir imp-dir
+ cd imp-dir
+ echo 'OpenMunger sources' >file1
+ echo 'OpenMunger sources' >file2
+ dotest importb-1 \
+"${testcvs} import -m add first-dir openmunger openmunger-1_0" \
+"N first-dir/file1
+N first-dir/file2
+
+No conflicts created by this import"
+ cd ..
+ rm -r imp-dir
+
+ # Now we put the sources we get from FreeMunger into 1.1.3
+ mkdir imp-dir
+ cd imp-dir
+ echo 'FreeMunger sources' >file1
+ echo 'FreeMunger sources' >file2
+ # Not completely sure how the conflict detection is supposed to
+ # be working here (haven't really thought about it).
+ dotest importb-2 \
+"${testcvs} import -m add -b 1.1.3 first-dir freemunger freemunger-1_0" \
+"C first-dir/file1
+C first-dir/file2
+
+2 conflicts created by this import.
+Use the following command to help the merge:
+
+ ${PROG} checkout -jfreemunger:yesterday -jfreemunger first-dir"
+ cd ..
+ rm -r imp-dir
+
+ # Now a test of main branch import (into second-dir, not first-dir).
+ mkdir imp-dir
+ cd imp-dir
+ echo 'my own stuff' >mine1.c
+ echo 'my own stuff' >mine2.c
+ dotest_fail importb-3 \
+"${testcvs} import -m add -b 1 second-dir dummy really_dumb_y" \
+"${PROG} \[[a-z]* aborted\]: Only branches with two dots are supported: 1"
+ : when we implement main-branch import, should be \
+"N second-dir/mine1\.c
+N second-dir/mine2\.c
+
+No conflicts created by this import"
+ cd ..
+ rm -r imp-dir
+
+ mkdir 1
+ cd 1
+ # when we implement main branch import, will want to
+ # add "second-dir" here.
+ dotest importb-4 "${testcvs} -q co first-dir" \
+"U first-dir/file1
+U first-dir/file2"
+ cd first-dir
+ dotest importb-5 "${testcvs} -q log file1" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+Working file: file1
+head: 1\.1
+branch: 1\.1\.1
+locks: strict
+access list:
+symbolic names:
+ freemunger-1_0: 1\.1\.3\.1
+ freemunger: 1\.1\.3
+ openmunger-1_0: 1\.1\.1\.1
+ openmunger: 1\.1\.1
+keyword substitution: kv
+total revisions: 3; selected revisions: 3
+description:
+----------------------------
+revision 1\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
+branches: 1\.1\.1; 1\.1\.3;
+Initial revision
+----------------------------
+revision 1\.1\.3\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -1
+add
+----------------------------
+revision 1\.1\.1\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}0 -0
+add
+============================================================================="
+
+ cd ../..
+ rm -r 1
+ rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir
+ ;;
+
join)
# Test doing joins which involve adding and removing files.
+ # Variety of scenarios (see list below), in the context of:
+ # * merge changes from T1 to T2 into the main line
+ # * merge changes from branch 'branch' into the main line
+ # * merge changes from branch 'branch' into branch 'br2'.
# See also binfile2, which does similar things with binary files.
+ # See also join2, which tests joining (and update -A) on only
+ # a single file, rather than a directory.
+ # See also join3, which tests some cases involving the greatest
+ # common ancestor. Here is a list of tests according to branch
+ # topology:
+ #
+ # --->bp---->trunk too many to mention
+ # \----->branch
+ #
+ # /----->branch1
+ # --->bp---->trunk multibranch
+ # \----->branch2
+ #
+ # --->bp1----->bp2---->trunk join3
+ # \->br1 \->br2
+ #
+ # --->bp1----->trunk
+ # \----bp2---->branch branches
+ # \------>branch-of-branch
# We check merging changes from T1 to T2 into the main line.
# Here are the interesting cases I can think of:
@@ -3147,7 +3739,7 @@ rev 2 of file 2
'"${PROG}"' [a-z]*: scheduling file `file4'\'' for addition
'"${PROG}"' [a-z]*: scheduling file `file6'\'' for addition
'"${PROG}"' [a-z]*: scheduling file `file8'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
dotest join-3 "${testcvs} -q commit -m add" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/file3,v
@@ -3190,11 +3782,11 @@ T file8'
dotest join-5 "${testcvs} add file2 file7" \
"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
'"${PROG}"' [a-z]*: scheduling file `file7'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
dotest join-6 "${testcvs} rm file6 file8" \
"${PROG}"' [a-z]*: scheduling `file6'\'' for removal
'"${PROG}"' [a-z]*: scheduling `file8'\'' for removal
-'"${PROG}"' [a-z]*: use '\'"${PROG} commit"\'' to remove these files permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove these files permanently'
dotest join-7 "${testcvs} -q ci -mx ." \
"RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
done
@@ -3241,7 +3833,7 @@ U first-dir/file8'
echo 'first branch revision of file5' > file5
dotest join-9 "${testcvs} add file5" \
"${PROG}"' [a-z]*: scheduling file `file5'\'' for addition on branch `branch'\''
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
dotest join-10 "${testcvs} -q ci -mx ." \
"Checking in file3;
${TESTDIR}/cvsroot/first-dir/file3,v <-- file3
@@ -3277,13 +3869,13 @@ T file8'
dotest join-12 "${testcvs} add file1 file2" \
"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition on branch `branch'\''
'"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition on branch `branch'\''
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
dotest join-13 "${testcvs} rm file3 file4 file5 file6" \
"${PROG}"' [a-z]*: scheduling `file3'\'' for removal
'"${PROG}"' [a-z]*: scheduling `file4'\'' for removal
'"${PROG}"' [a-z]*: scheduling `file5'\'' for removal
'"${PROG}"' [a-z]*: scheduling `file6'\'' for removal
-'"${PROG}"' [a-z]*: use '\'"${PROG} commit"\'' to remove these files permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to remove these files permanently'
dotest join-14 "${testcvs} -q ci -mx ." \
"RCS file: ${TESTDIR}/cvsroot/first-dir/Attic/file1,v
done
@@ -3421,59 +4013,323 @@ M file2
R file3
M file4'
+ cd ..
+
+ # Checkout the main line again and make a new branch which we
+ # merge to.
+ rm -r first-dir
+ dotest join-25 "${testcvs} -q co first-dir" \
+'U first-dir/file2
+U first-dir/file3
+U first-dir/file4
+U first-dir/file7'
+ cd first-dir
+ dotest join-26 "${testcvs} -q tag -b br2" \
+"T file2
+T file3
+T file4
+T file7"
+ dotest join-27 "${testcvs} -q update -r br2" ""
+ # The handling of file8 here looks fishy to me. I don't see
+ # why it should be different from the case where we merge to
+ # the trunk (e.g. join-23).
+ dotest join-28 "${testcvs} -q update -j branch" \
+"U file1
+RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+retrieving revision 1.1
+retrieving revision 1.1.2.1
+Merging differences between 1.1 and 1.1.2.1 into file2
+${PROG} [a-z]*: scheduling file3 for removal
+${PROG} [a-z]*: file file4 has been modified, but has been removed in revision branch
+U file8"
+ # Verify that the right changes have been scheduled.
+ dotest join-29 "${testcvs} -q update" \
+"A file1
+M file2
+R file3
+A file8"
+
cd ../..
+
rm -r 1 2 3
rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
+ join2)
+ # More joining tests.
+
+ # First the usual setup; create a directory first-dir, a file
+ # first-dir/file1, and a branch br1.
+ mkdir 1; cd 1
+ dotest join2-1 "${testcvs} -q co -l ." ''
+ mkdir first-dir
+ dotest join2-2 "${testcvs} add first-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
+ cd first-dir
+ echo 'initial contents of file1' >file1
+ dotest join2-3 "${testcvs} add file1" \
+"${PROG} [a-z]*: scheduling file .file1. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest join2-4 "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done
+Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+initial revision: 1\.1
+done"
+ dotest join2-5 "${testcvs} -q tag -b br1" "T file1"
+ dotest join2-6 "${testcvs} -q update -r br1" ""
+ echo 'modify on branch' >>file1
+ touch bradd
+ dotest join2-6a "${testcvs} add bradd" \
+"${PROG} [a-z]*: scheduling file .bradd. for addition on branch .br1.
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest join2-7 "${testcvs} -q ci -m modify" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/Attic/bradd,v
+done
+Checking in bradd;
+${TESTDIR}/cvsroot/first-dir/Attic/bradd,v <-- bradd
+new revision: 1\.1\.2\.1; previous revision: 1\.1
+done
+Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.1\.2\.1; previous revision: 1\.1
+done"
+
+ # Here is the unusual/pathological part. We switch back to
+ # the trunk *for file1 only*, not for the whole directory.
+ dotest join2-8 "${testcvs} -q update -A file1" '[UP] file1'
+ dotest join2-9 "${testcvs} -q status file1" \
+"===================================================================
+File: file1 Status: Up-to-date
+
+ Working revision: 1\.1.*
+ Repository revision: 1\.1 ${TESTDIR}/cvsroot/first-dir/file1,v
+ Sticky Tag: (none)
+ Sticky Date: (none)
+ Sticky Options: (none)"
+ dotest join2-10 "cat CVS/Tag" "Tbr1"
+
+ dotest join2-11 "${testcvs} -q update -j br1 file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+retrieving revision 1\.1
+retrieving revision 1\.1\.2\.1
+Merging differences between 1\.1 and 1\.1\.2\.1 into file1"
+ dotest join2-12 "cat file1" "initial contents of file1
+modify on branch"
+ # We should have no sticky tag on file1
+ dotest join2-13 "${testcvs} -q status file1" \
+"===================================================================
+File: file1 Status: Locally Modified
+
+ Working revision: 1\.1.*
+ Repository revision: 1\.1 ${TESTDIR}/cvsroot/first-dir/file1,v
+ Sticky Tag: (none)
+ Sticky Date: (none)
+ Sticky Options: (none)"
+ dotest join2-14 "cat CVS/Tag" "Tbr1"
+ # And the checkin should go to the trunk
+ dotest join2-15 "${testcvs} -q ci -m modify file1" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.2; previous revision: 1\.1
+done"
+
+ # OK, the above is all well and good and has worked for some
+ # time. Now try the case where the file had been added on
+ # the branch.
+ dotest join2-16 "${testcvs} -q update -r br1" "[UP] file1"
+ # The workaround is to update the whole directory.
+ # The non-circumvented version won't work. The reason is that
+ # update removes the entry from CVS/Entries, so of course we get
+ # the tag from CVS/Tag and not Entries. I suppose maybe
+ # we could invent some new format in Entries which would handle
+ # this, but doing so, and handling it properly throughout
+ # CVS, would be a lot of work and I'm not sure this case justifies
+ # it.
+ dotest join2-17-circumvent "${testcvs} -q update -A" \
+"${PROG} [a-z]*: warning: bradd is not (any longer) pertinent
+[UP] file1"
+: dotest join2-17 "${testcvs} -q update -A bradd" \
+"${PROG} [a-z]*: warning: bradd is not (any longer) pertinent"
+ dotest join2-18 "${testcvs} -q update -j br1 bradd" "U bradd"
+ dotest join2-19 "${testcvs} -q status bradd" \
+"===================================================================
+File: bradd Status: Locally Added
+
+ Working revision: New file!
+ Repository revision: 1\.1 ${TESTDIR}/cvsroot/first-dir/Attic/bradd,v
+ Sticky Tag: (none)
+ Sticky Date: (none)
+ Sticky Options: (none)"
+ dotest join2-20 "${testcvs} -q ci -m modify bradd" \
+"Checking in bradd;
+${TESTDIR}/cvsroot/first-dir/bradd,v <-- bradd
+new revision: 1\.2; previous revision: 1\.1
+done"
+
+ cd ../..
+ rm -r 1
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
+ join3)
+ # See "join" for a list of other joining/branching tests.
+ # First the usual setup; create a directory first-dir, a file
+ # first-dir/file1, and a branch br1.
+ mkdir 1; cd 1
+ dotest join3-1 "${testcvs} -q co -l ." ''
+ mkdir first-dir
+ dotest join3-2 "${testcvs} add first-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
+ cd first-dir
+ echo 'initial contents of file1' >file1
+ dotest join3-3 "${testcvs} add file1" \
+"${PROG} [a-z]*: scheduling file .file1. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest join3-4 "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done
+Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+initial revision: 1\.1
+done"
+ dotest join3-5 "${testcvs} -q tag -b br1" "T file1"
+ dotest join3-6 "${testcvs} -q update -r br1" ""
+ echo 'br1:line1' >>file1
+ dotest join3-7 "${testcvs} -q ci -m modify" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.1\.2\.1; previous revision: 1\.1
+done"
+
+ # Now back to the trunk for:
+ # another revision and another branch for file1.
+ # add file2, which will exist on trunk and br2 but not br1.
+ dotest join3-8 "${testcvs} -q update -A" "[UP] file1"
+ echo 'trunk:line1' > file2
+ dotest join3-8a "${testcvs} add file2" \
+"${PROG} [a-z]*: scheduling file .file2. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ echo 'trunk:line1' >>file1
+ dotest join3-9 "${testcvs} -q ci -m modify" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.2; previous revision: 1\.1
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+done
+Checking in file2;
+${TESTDIR}/cvsroot/first-dir/file2,v <-- file2
+initial revision: 1\.1
+done"
+ dotest join3-10 "${testcvs} -q tag -b br2" "T file1
+T file2"
+
+ # Before we actually have any revision on br2, let's try a join
+ dotest join3-11 "${testcvs} -q update -r br1" "[UP] file1
+${PROG} [a-z]*: file2 is no longer in the repository"
+ dotest join3-12 "${testcvs} -q update -j br2" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+retrieving revision 1\.1
+retrieving revision 1\.2
+Merging differences between 1\.1 and 1\.2 into file1
+rcsmerge: warning: conflicts during merge
+U file2"
+ dotest join3-13 "cat file1" \
+"initial contents of file1
+[<]<<<<<< file1
+br1:line1
+[=]======
+trunk:line1
+[>]>>>>>> 1\.2"
+ rm file1
+
+ # OK, we'll try the same thing with a revision on br2.
+ dotest join3-14 "${testcvs} -q update -r br2 file1" \
+"${PROG} [a-z]*: warning: file1 was lost
+U file1" "U file1"
+ echo 'br2:line1' >>file1
+ dotest join3-15 "${testcvs} -q ci -m modify file1" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.2\.2\.1; previous revision: 1\.2
+done"
+
+ # OK, now we can join br2 to br1
+ dotest join3-16 "${testcvs} -q update -r br1 file1" "[UP] file1"
+ # It may seem odd, to merge a higher branch into a lower
+ # branch, but in fact CVS defines the ancestor as 1.1
+ # and so it merges both the 1.1->1.2 and 1.2->1.2.2.1 changes.
+ # This seems like a reasonably plausible behavior.
+ dotest join3-17 "${testcvs} -q update -j br2 file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+retrieving revision 1\.1
+retrieving revision 1\.2\.2\.1
+Merging differences between 1\.1 and 1\.2\.2\.1 into file1
+rcsmerge: warning: conflicts during merge"
+ dotest join3-18 "cat file1" \
+"initial contents of file1
+[<]<<<<<< file1
+br1:line1
+[=]======
+trunk:line1
+br2:line1
+[>]>>>>>> 1\.2\.2\.1"
+
+ cd ../..
+ rm -r 1
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
new) # look for stray "no longer pertinent" messages.
mkdir ${CVSROOT_DIRNAME}/first-dir
if ${CVS} co first-dir ; then
- echo "PASS: test 117" >>${LOGFILE}
+ pass 117
else
- echo "FAIL: test 117" | tee -a ${LOGFILE} ; exit 1
+ fail 117
fi
cd first-dir
touch a
if ${CVS} add a 2>>${LOGFILE}; then
- echo "PASS: test 118" >>${LOGFILE}
+ pass 118
else
- echo "FAIL: test 118" | tee -a ${LOGFILE} ; exit 1
+ fail 118
fi
if ${CVS} ci -m added >>${LOGFILE} 2>&1; then
- echo "PASS: test 119" >>${LOGFILE}
+ pass 119
else
- echo "FAIL: test 119" | tee -a ${LOGFILE} ; exit 1
+ fail 119
fi
rm a
if ${CVS} rm a 2>>${LOGFILE}; then
- echo "PASS: test 120" >>${LOGFILE}
+ pass 120
else
- echo "FAIL: test 120" | tee -a ${LOGFILE} ; exit 1
+ fail 120
fi
if ${CVS} ci -m removed >>${LOGFILE} ; then
- echo "PASS: test 121" >>${LOGFILE}
+ pass 121
else
- echo "FAIL: test 121" | tee -a ${LOGFILE} ; exit 1
+ fail 121
fi
if ${CVS} update -A 2>&1 | grep longer ; then
- echo "FAIL: test 122" | tee -a ${LOGFILE} ; exit 1
+ fail 122
else
- echo "PASS: test 122" >>${LOGFILE}
+ pass 122
fi
if ${CVS} update -rHEAD 2>&1 | grep longer ; then
- echo "FAIL: test 123" | tee -a ${LOGFILE} ; exit 1
+ fail 123
else
- echo "PASS: test 123" >>${LOGFILE}
+ pass 123
fi
cd ..
@@ -3495,7 +4351,7 @@ M file4'
touch a
dotest newb-123b "${testcvs} add a" \
"${PROG} [a-z]*: scheduling file .a. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest newb-123c "${testcvs} -q ci -m added" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/a,v
done
@@ -3548,7 +4404,15 @@ done"
# --disable-server.
dotest newb-123j0 "${testcvs} status a" \
"===================================================================
-File: a Status: Needs \(Patch\|Checkout\)
+File: a Status: Needs Patch
+
+ Working revision: 1\.1.*
+ Repository revision: 1\.1\.2\.1 ${TESTDIR}/cvsroot/first-dir/a,v
+ Sticky Tag: branch (branch: 1\.1\.2)
+ Sticky Date: (none)
+ Sticky Options: (none)" \
+"===================================================================
+File: a Status: Needs Checkout
Working revision: 1\.1.*
Repository revision: 1\.1\.2\.1 ${TESTDIR}/cvsroot/first-dir/a,v
@@ -3582,7 +4446,7 @@ File: a Status: Needs \(Patch\|Checkout\)
dotest conflicts-125 "${testcvs} add a" \
"${PROG} [a-z]*: scheduling file .a. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest conflicts-126 "${testcvs} -q ci -m added" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/a,v
done
@@ -3605,15 +4469,15 @@ RCS: ${TMPPWD}/cvsroot/first-dir/a,v
VERS: 1\.1
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*"
if ${CVS} co first-dir ; then
- echo 'PASS: test 127' >>${LOGFILE}
+ pass 127
else
- echo 'FAIL: test 127' | tee -a ${LOGFILE}
+ fail 127
fi
cd first-dir
if test -f a; then
- echo 'PASS: test 127a' >>${LOGFILE}
+ pass 127a
else
- echo 'FAIL: test 127a' | tee -a ${LOGFILE}
+ fail 127a
fi
cd ../../1/first-dir
@@ -3708,31 +4572,36 @@ File: a Status: File had conflicts on merge
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: (none)"
- dotest_fail conflicts-132 "${testcvs} -q ci -m try" \
-"${PROG} [a-z]*: file .a. still contains conflict indicators
-${PROG} \[[a-z]* aborted\]: correct above errors first!"
+ dotest conflicts-132 "${testcvs} -q ci -m try" \
+"${PROG} [a-z]*: warning: file .a. seems to still contain conflict indicators
+Checking in a;
+${TESTDIR}/cvsroot/first-dir/a,v <-- a
+new revision: 1\.3; previous revision: 1\.2
+done"
+ # OK, the user saw the warning (good user), and now
+ # resolves it for real.
echo resolve conflict >a
dotest conflicts-status-3 "${testcvs} status a" \
"===================================================================
-File: a Status: File had conflicts on merge
+File: a Status: Locally Modified
- Working revision: 1\.2.*
- Repository revision: 1\.2 ${TESTDIR}/cvsroot/first-dir/a,v
+ Working revision: 1\.3.*
+ Repository revision: 1\.3 ${TESTDIR}/cvsroot/first-dir/a,v
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: (none)"
dotest conflicts-133 "${testcvs} -q ci -m resolved" \
"Checking in a;
${TESTDIR}/cvsroot/first-dir/a,v <-- a
-new revision: 1\.3; previous revision: 1\.2
+new revision: 1\.4; previous revision: 1\.3
done"
dotest conflicts-status-4 "${testcvs} status a" \
"===================================================================
File: a Status: Up-to-date
- Working revision: 1\.3.*
- Repository revision: 1\.3 ${TESTDIR}/cvsroot/first-dir/a,v
+ Working revision: 1\.4.*
+ Repository revision: 1\.4 ${TESTDIR}/cvsroot/first-dir/a,v
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: (none)"
@@ -3742,14 +4611,14 @@ File: a Status: Up-to-date
cd ../../1/first-dir
echo abc >abc
if ${testcvs} add abc >>${LOGFILE} 2>&1; then
- echo 'PASS: test 134' >>${LOGFILE}
+ pass 134
else
- echo 'FAIL: test 134' | tee -a ${LOGFILE}
+ fail 134
fi
if ${testcvs} ci -m 'add abc' abc >>${LOGFILE} 2>&1; then
- echo 'PASS: test 135' >>${LOGFILE}
+ pass 135
else
- echo 'FAIL: test 135' | tee -a ${LOGFILE}
+ fail 135
fi
cd ../../2
mkdir first-dir/dir1 first-dir/sdir
@@ -3769,41 +4638,41 @@ File: a Status: Up-to-date
cd ../1/first-dir
mkdir subdir
if ${testcvs} add subdir >>${LOGFILE}; then
- echo 'PASS: test 138' >>${LOGFILE}
+ pass 138
else
- echo 'FAIL: test 138' | tee -a ${LOGFILE}
+ fail 138
fi
cd ../..
mkdir 3
cd 3
if ${testcvs} -q co first-dir/abc first-dir/subdir \
>>${LOGFILE}; then
- echo 'PASS: test 139' >>${LOGFILE}
+ pass 139
else
- echo 'FAIL: test 139' | tee -a ${LOGFILE}
+ fail 139
fi
cd ../1/first-dir/subdir
echo sss >sss
if ${testcvs} add sss >>${LOGFILE} 2>&1; then
- echo 'PASS: test 140' >>${LOGFILE}
+ pass 140
else
- echo 'FAIL: test 140' | tee -a ${LOGFILE}
+ fail 140
fi
if ${testcvs} ci -m adding sss >>${LOGFILE} 2>&1; then
- echo 'PASS: test 140' >>${LOGFILE}
+ pass 140
else
- echo 'FAIL: test 140' | tee -a ${LOGFILE}
+ fail 140
fi
cd ../../../3/first-dir
if ${testcvs} -q update >>${LOGFILE}; then
- echo 'PASS: test 141' >>${LOGFILE}
+ pass 141
else
- echo 'FAIL: test 141' | tee -a ${LOGFILE}
+ fail 141
fi
if test -f subdir/sss; then
- echo 'PASS: test 142' >>${LOGFILE}
+ pass 142
else
- echo 'FAIL: test 142' | tee -a ${LOGFILE}
+ fail 142
fi
cd ../..
rm -r 1 2 3 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
@@ -3825,7 +4694,7 @@ File: a Status: Up-to-date
dotest conflicts2-142a2 "${testcvs} add a abc" \
"${PROG} [a-z]*: scheduling file .a. for addition
${PROG} [a-z]*: scheduling file .abc. for addition
-${PROG} [a-z]*: use .cvs commit. to add these files permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
dotest conflicts2-142a3 "${testcvs} -q ci -m added" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/a,v
done
@@ -3899,48 +4768,301 @@ ${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
# party has a file of the same name, cvs notices
cd 1/first-dir
touch aa.c
- dotest conflicts2-142d0 "${testcvs} add aa.c" \
+ echo 'contents unchanged' >same.c
+ dotest conflicts2-142d0 "${testcvs} add aa.c same.c" \
"${PROG} [a-z]*: scheduling file .aa\.c. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: scheduling file .same\.c. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
dotest conflicts2-142d1 "${testcvs} -q ci -m added" \
-"RCS file: ${TESTDIR}/cvsroot/first-dir/aa.c,v
+"RCS file: ${TESTDIR}/cvsroot/first-dir/aa\.c,v
done
-Checking in aa.c;
-${TESTDIR}/cvsroot/first-dir/aa.c,v <-- aa.c
+Checking in aa\.c;
+${TESTDIR}/cvsroot/first-dir/aa\.c,v <-- aa\.c
+initial revision: 1\.1
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/same\.c,v
+done
+Checking in same\.c;
+${TESTDIR}/cvsroot/first-dir/same\.c,v <-- same\.c
initial revision: 1\.1
done"
cd ../../2/first-dir
echo "don't you dare obliterate this text" >aa.c
- # Doing this test separately for remote and local is a fair
- # bit of a kludge, but the exit status differs. I'm not sure
- # which exit status is the more appropriate one.
+ echo 'contents unchanged' >same.c
+ # Note the discrepancy between local and remote in the handling
+ # of same.c. I kind
+ # of suspect that the local CVS behavior is the more useful one
+ # although I do sort of wonder whether we should make people run
+ # cvs add just to get them in that habit (also, trying to implement
+ # the local CVS behavior for remote without the cvs add seems
+ # pretty difficult).
if test "$remote" = yes; then
- dotest conflicts2-142d2 "${testcvs} -q update" \
+ dotest_fail conflicts2-142d2 "${testcvs} -q update" \
"${QUESTION} aa\.c
-U aa\.c
-${PROG} update: move away \./aa\.c; it is in the way"
+${QUESTION} same\.c
+${PROG} update: move away \./aa\.c; it is in the way
+C aa\.c
+${PROG} update: move away \./same\.c; it is in the way
+C same\.c"
else
dotest_fail conflicts2-142d2 "${testcvs} -q update" \
"${PROG} [a-z]*: move away aa\.c; it is in the way
-C aa\.c"
+C aa\.c
+U same\.c"
fi
+ dotest conflicts2-142d3 "${testcvs} -q status aa.c" \
+"${PROG} [a-z]*: move away aa\.c; it is in the way
+===================================================================
+File: aa\.c Status: Unresolved Conflict
+
+ Working revision: No entry for aa\.c
+ Repository revision: 1\.1 ${TESTDIR}/cvsroot/first-dir/aa\.c,v"
+
+ # Could also be testing the case in which the cvs add happened
+ # before the commit by the other user.
+ # This message seems somewhat bogus. I mean, parallel development
+ # means that we get to work in parallel if we choose, right? And
+ # then at commit time it would be a conflict.
+ dotest_fail conflicts2-142d4 "${testcvs} -q add aa.c" \
+"${PROG} [a-z]*: aa.c added independently by second party"
+
+ # The user might want to see just what the conflict is.
+ # Don't bother, diff seems to kind of lose its mind, with or
+ # without -N. This is a CVS bug(s).
+ #dotest conflicts2-142d5 "${testcvs} -q diff -r HEAD -N aa.c" fixme
+
+ # Now: "how can the user resolve this conflict", I hear you cry.
+ # Well, one way is to forget about the file in the working
+ # directory.
+ # Since it didn't let us do the add in conflicts2-142d4, there
+ # is no need to run cvs rm here.
+ #dotest conflicts2-142d6 "${testcvs} -q rm -f aa.c" fixme
+ dotest conflicts2-142d6 "rm aa.c" ''
+ dotest conflicts2-142d7 "${testcvs} -q update aa.c" "U aa\.c"
+ dotest conflicts2-142d8 "cat aa.c" ''
+
+ # The other way is to use the version from the working directory
+ # instead of the version from the repository. Unfortunately,
+ # there doesn't seem to be any particularly clear way to do
+ # this (?).
+
cd ../..
rm -r 1 2 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
+ conflicts3)
+ # More tests of conflicts and/or multiple working directories
+ # in general.
+
+ mkdir 1; cd 1
+ dotest conflicts3-1 "${testcvs} -q co -l ." ''
+ mkdir first-dir
+ dotest conflicts3-2 "${testcvs} add first-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
+ cd ..
+ mkdir 2; cd 2
+ dotest conflicts3-3 "${testcvs} -q co -l first-dir" ''
+ cd ../1/first-dir
+ touch file1 file2
+ dotest conflicts3-4 "${testcvs} add file1 file2" \
+"${PROG} [a-z]*: scheduling file .file1. for addition
+${PROG} [a-z]*: scheduling file .file2. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
+ dotest conflicts3-5 "${testcvs} -q ci -m add-them" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done
+Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+initial revision: 1\.1
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+done
+Checking in file2;
+${TESTDIR}/cvsroot/first-dir/file2,v <-- file2
+initial revision: 1\.1
+done"
+ cd ../../2/first-dir
+ # Check that -n doesn't make CVS lose its mind as it creates
+ # (or rather, doesn't) a new file.
+ dotest conflicts3-6 "${testcvs} -nq update" \
+"U file1
+U file2"
+ dotest_fail conflicts3-7 "test -f file1" ''
+ dotest conflicts3-8 "${testcvs} -q update" \
+"U file1
+U file2"
+ dotest conflicts3-9 "test -f file2" ''
+
+ # OK, now remove two files at once
+ dotest conflicts3-10 "${testcvs} rm -f file1 file2" \
+"${PROG} [a-z]*: scheduling .file1. for removal
+${PROG} [a-z]*: scheduling .file2. for removal
+${PROG} [a-z]*: use .${PROG} commit. to remove these files permanently"
+ dotest conflicts3-11 "${testcvs} -q ci -m remove-them" \
+"Removing file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: delete; previous revision: 1\.1
+done
+Removing file2;
+${TESTDIR}/cvsroot/first-dir/file2,v <-- file2
+new revision: delete; previous revision: 1\.1
+done"
+ cd ../../1/first-dir
+ dotest conflicts3-12 "${testcvs} -n -q update" \
+"${PROG} [a-z]*: warning: file1 is not (any longer) pertinent
+${PROG} [a-z]*: warning: file2 is not (any longer) pertinent"
+ dotest conflicts3-13 "${testcvs} -q update" \
+"${PROG} [a-z]*: warning: file1 is not (any longer) pertinent
+${PROG} [a-z]*: warning: file2 is not (any longer) pertinent"
+
+ # OK, now add a directory to both working directories
+ # and see that CVS doesn't lose its mind.
+ mkdir sdir
+ dotest conficts3-14 "${testcvs} add sdir" \
+"Directory ${TESTDIR}/cvsroot/first-dir/sdir added to the repository"
+ cd ../../2/first-dir
+
+ # Create a CVS directory without the proper administrative
+ # files in it. This can happen for example if you hit ^C
+ # in the middle of a checkout.
+ mkdir sdir
+ mkdir sdir/CVS
+ # OK, in the local case CVS sees that the directory exists
+ # in the repository and recurses into it. In the remote case
+ # CVS can't see the repository and has no way of knowing
+ # that sdir is even a directory (stat'ing everything would be
+ # too slow). The remote behavior makes more sense to me (but
+ # would this affect other cases?).
+ if test "$remote" = yes; then
+ dotest conflicts3-15 "${testcvs} -q update" \
+"${QUESTION} sdir"
+ else
+ dotest conflicts3-15 "${testcvs} -q update" \
+"${QUESTION} sdir
+${PROG} [a-z]*: ignoring sdir (CVS/Repository missing)"
+ touch sdir/CVS/Repository
+ dotest conflicts3-16 "${testcvs} -q update" \
+"${QUESTION} sdir
+${PROG} [a-z]*: ignoring sdir (CVS/Entries missing)"
+ fi
+ rm -r sdir
+
+ # OK, now the same thing, but the directory doesn't exist
+ # in the repository.
+ mkdir newdir
+ mkdir newdir/CVS
+ dotest conflicts3-17 "${testcvs} -q update" "${QUESTION} newdir"
+ echo "D/newdir////" >> CVS/Entries
+ dotest conflicts3-18 "${testcvs} -q update" \
+"${PROG} [a-z]*: ignoring newdir (CVS/Repository missing)"
+ touch newdir/CVS/Repository
+ dotest conflicts3-19 "${testcvs} -q update" \
+"${PROG} [a-z]*: ignoring newdir (CVS/Entries missing)"
+ rm -r newdir
+
+ cd ../..
+
+ rm -r 1 2
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
modules)
# Tests of various ways to define and use modules.
+
+ ############################################################
+ # These tests are to make sure that administrative files get
+ # rebuilt, regardless of how and where files are checked
+ # out.
+ ############################################################
+ # Check out the whole repository
+ mkdir 1; cd 1
+ dotest modules-1 "${testcvs} -q co ." 'U CVSROOT/checkoutlist
+U CVSROOT/commitinfo
+U CVSROOT/config
+U CVSROOT/cvswrappers
+U CVSROOT/editinfo
+U CVSROOT/loginfo
+U CVSROOT/modules
+U CVSROOT/notify
+U CVSROOT/rcsinfo
+U CVSROOT/taginfo
+U CVSROOT/verifymsg'
+ echo "# made a change" >>CVSROOT/modules
+ dotest modules-1d "${testcvs} -q ci -m add-modules" \
+"Checking in CVSROOT/modules;
+${TESTDIR}/cvsroot/CVSROOT/modules,v <-- modules
+new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
+done
+${PROG} [a-z]*: Rebuilding administrative file database"
+ cd ..
+ rm -rf 1
+
+ ############################################################
+ # Check out CVSROOT
+ mkdir 1; cd 1
+ dotest modules-2 "${testcvs} -q co CVSROOT" 'U CVSROOT/checkoutlist
+U CVSROOT/commitinfo
+U CVSROOT/config
+U CVSROOT/cvswrappers
+U CVSROOT/editinfo
+U CVSROOT/loginfo
+U CVSROOT/modules
+U CVSROOT/notify
+U CVSROOT/rcsinfo
+U CVSROOT/taginfo
+U CVSROOT/verifymsg'
+ echo "# made a change" >>CVSROOT/modules
+ dotest modules-2d "${testcvs} -q ci -m add-modules" \
+"Checking in CVSROOT/modules;
+${TESTDIR}/cvsroot/CVSROOT/modules,v <-- modules
+new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
+done
+${PROG} [a-z]*: Rebuilding administrative file database"
+ cd ..
+ rm -rf 1
+
+ ############################################################
+ # Check out CVSROOT in some other directory
+ mkdir ${CVSROOT_DIRNAME}/somedir
+ mkdir 1; cd 1
+ dotest modules-3 "${testcvs} -q co somedir" ''
+ cd somedir
+ dotest modules-3d "${testcvs} -q co CVSROOT" 'U CVSROOT/checkoutlist
+U CVSROOT/commitinfo
+U CVSROOT/config
+U CVSROOT/cvswrappers
+U CVSROOT/editinfo
+U CVSROOT/loginfo
+U CVSROOT/modules
+U CVSROOT/notify
+U CVSROOT/rcsinfo
+U CVSROOT/taginfo
+U CVSROOT/verifymsg'
+ echo "# made a change" >>CVSROOT/modules
+ dotest modules-3g "${testcvs} -q ci -m add-modules" \
+"Checking in CVSROOT/modules;
+${TESTDIR}/cvsroot/CVSROOT/modules,v <-- modules
+new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
+done
+${PROG} [a-z]*: Rebuilding administrative file database"
+ cd ../..
+ rm -rf 1
+ rm -rf ${CVSROOT_DIRNAME}/somedir
+ ############################################################
+ # end rebuild tests
+ ############################################################
+
+
mkdir ${CVSROOT_DIRNAME}/first-dir
mkdir 1
cd 1
if ${testcvs} -q co first-dir; then
- echo 'PASS: test 143' >>${LOGFILE}
+ pass 143
else
- echo 'FAIL: test 143' | tee -a ${LOGFILE}
- exit 1
+ fail 143
fi
cd first-dir
@@ -3954,25 +5076,22 @@ C aa\.c"
touch a b
if ${testcvs} add a b 2>>${LOGFILE} ; then
- echo 'PASS: test 144' >>${LOGFILE}
+ pass 144
else
- echo 'FAIL: test 144' | tee -a ${LOGFILE}
- exit 1
+ fail 144
fi
if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
- echo 'PASS: test 145' >>${LOGFILE}
+ pass 145
else
- echo 'FAIL: test 145' | tee -a ${LOGFILE}
- exit 1
+ fail 145
fi
cd ..
if ${testcvs} -q co CVSROOT >>${LOGFILE}; then
- echo 'PASS: test 146' >>${LOGFILE}
+ pass 146
else
- echo 'FAIL: test 146' | tee -a ${LOGFILE}
- exit 1
+ fail 146
fi
# Here we test that CVS can deal with CVSROOT (whose repository
@@ -3980,10 +5099,9 @@ C aa\.c"
# is a subdirectory of first-dir). TODO: Might want to check that
# files can actually get updated in this state.
if ${testcvs} -q update; then
- echo 'PASS: test 147' >>${LOGFILE}
+ pass 147
else
- echo 'FAIL: test 147' | tee -a ${LOGFILE}
- exit 1
+ fail 147
fi
echo realmodule first-dir/subdir a >CVSROOT/modules
@@ -3993,6 +5111,7 @@ C aa\.c"
echo aliasnested -a first-dir/subdir/ssdir >>CVSROOT/modules
echo topfiles -a first-dir/file1 first-dir/file2 >>CVSROOT/modules
echo world -a . >>CVSROOT/modules
+ echo statusmod -s Mungeable >>CVSROOT/modules
# Options must come before arguments. It is possible this should
# be relaxed at some point (though the result would be bizarre for
@@ -4000,85 +5119,86 @@ C aa\.c"
echo bogusalias first-dir/subdir/a -a >>CVSROOT/modules
if ${testcvs} ci -m 'add modules' CVSROOT/modules \
>>${LOGFILE} 2>&1; then
- echo 'PASS: test 148' >>${LOGFILE}
+ pass 148
else
- echo 'FAIL: test 148' | tee -a ${LOGFILE}
- exit 1
+ fail 148
fi
cd ..
+ # The "statusmod" module contains an error; trying to use it
+ # will produce "modules file missing directory" I think.
+ # However, that shouldn't affect the ability of "cvs co -c" or
+ # "cvs co -s" to do something reasonable with it.
dotest 148a0 "${testcvs} co -c" 'aliasmodule -a first-dir/subdir/a
aliasnested -a first-dir/subdir/ssdir
bogusalias first-dir/subdir/a -a
dirmodule first-dir/subdir
namedmodule -d nameddir first-dir/subdir
realmodule first-dir/subdir a
+statusmod -s Mungeable
topfiles -a first-dir/file1 first-dir/file2
-world -a .'
- # I don't know why aliasmodule isn't printed (I would have thought
- # that it gets printed without the -a; although I'm not sure that
- # printing expansions without options is useful).
+world -a \.'
+ # There is code in modules.c:save_d which explicitly skips
+ # modules defined with -a, which is why aliasmodule is not
+ # listed.
dotest 148a1 "${testcvs} co -s" \
-'bogusalias NONE first-dir/subdir/a -a
+'statusmod Mungeable
+bogusalias NONE first-dir/subdir/a -a
dirmodule NONE first-dir/subdir
namedmodule NONE first-dir/subdir
realmodule NONE first-dir/subdir a'
# Test that real modules check out to realmodule/a, not subdir/a.
if ${testcvs} co realmodule >>${LOGFILE}; then
- echo 'PASS: test 149a1' >>${LOGFILE}
+ pass 149a1
else
- echo 'FAIL: test 149a1' | tee -a ${LOGFILE}
- exit 1
+ fail 149a1
fi
if test -d realmodule && test -f realmodule/a; then
- echo 'PASS: test 149a2' >>${LOGFILE}
+ pass 149a2
else
- echo 'FAIL: test 149a2' | tee -a ${LOGFILE}
- exit 1
+ fail 149a2
fi
if test -f realmodule/b; then
- echo 'FAIL: test 149a3' | tee -a ${LOGFILE}
- exit 1
+ fail 149a3
else
- echo 'PASS: test 149a3' >>${LOGFILE}
+ pass 149a3
fi
if ${testcvs} -q co realmodule; then
- echo 'PASS: test 149a4' >>${LOGFILE}
+ pass 149a4
else
- echo 'FAIL: test 149a4' | tee -a ${LOGFILE}
- exit 1
+ fail 149a4
fi
if echo "yes" | ${testcvs} release -d realmodule >>${LOGFILE} ; then
- echo 'PASS: test 149a5' >>${LOGFILE}
+ pass 149a5
else
- echo 'FAIL: test 149a5' | tee -a ${LOGFILE}
- exit 1
+ fail 149a5
fi
+ dotest_fail 149b1 "${testcvs} co realmodule/a" \
+"${PROG}"' [a-z]*: module `realmodule/a'\'' is a request for a file in a module which is not a directory' \
+"${PROG}"' [a-z]*: module `realmodule/a'\'' is a request for a file in a module which is not a directory
+'"${PROG}"' \[[a-z]* aborted\]: cannot expand modules'
+
# Now test the ability to check out a single file from a directory
if ${testcvs} co dirmodule/a >>${LOGFILE}; then
- echo 'PASS: test 150c' >>${LOGFILE}
+ pass 150c
else
- echo 'FAIL: test 150c' | tee -a ${LOGFILE}
- exit 1
+ fail 150c
fi
if test -d dirmodule && test -f dirmodule/a; then
- echo 'PASS: test 150d' >>${LOGFILE}
+ pass 150d
else
- echo 'FAIL: test 150d' | tee -a ${LOGFILE}
- exit 1
+ fail 150d
fi
if test -f dirmodule/b; then
- echo 'FAIL: test 150e' | tee -a ${LOGFILE}
- exit 1
+ fail 150e
else
- echo 'PASS: test 150e' >>${LOGFILE}
+ pass 150e
fi
if echo "yes" | ${testcvs} release -d dirmodule >>${LOGFILE} ; then
- echo 'PASS: test 150f' >>${LOGFILE}
+ pass 150f
else
- echo 'FAIL: test 150f' | tee -a ${LOGFILE}
- exit 1
+ fail 150f
fi
# Now test the ability to correctly reject a non-existent filename.
# For maximum studliness we would check that an error message is
@@ -4087,18 +5207,17 @@ realmodule NONE first-dir/subdir a'
# We accept a zero exit status because it is what CVS does
# (Dec 95). Probably the exit status should be nonzero,
# however.
- echo 'PASS: test 150g1' >>${LOGFILE}
+ pass 150g1
else
- echo 'PASS: test 150g1' >>${LOGFILE}
+ pass 150g1
fi
# We tolerate the creation of the dirmodule directory, since that
# is what CVS does, not because we view that as preferable to not
# creating it.
if test -f dirmodule/a || test -f dirmodule/b; then
- echo 'FAIL: test 150g2' | tee -a ${LOGFILE}
- exit 1
+ fail 150g2
else
- echo 'PASS: test 150g2' >>${LOGFILE}
+ pass 150g2
fi
rm -r dirmodule
@@ -4124,31 +5243,27 @@ U nameddir/b'
# Now test that alias modules check out to subdir/a, not
# aliasmodule/a.
if ${testcvs} co aliasmodule >>${LOGFILE}; then
- echo 'PASS: test 151' >>${LOGFILE}
+ pass 151
else
- echo 'FAIL: test 151' | tee -a ${LOGFILE}
- exit 1
+ fail 151
fi
if test -d aliasmodule; then
- echo 'FAIL: test 152' | tee -a ${LOGFILE}
- exit 1
+ fail 152
else
- echo 'PASS: test 152' >>${LOGFILE}
+ pass 152
fi
echo abc >>first-dir/subdir/a
if (${testcvs} -q co aliasmodule | tee test153.tmp) \
>>${LOGFILE}; then
- echo 'PASS: test 153' >>${LOGFILE}
+ pass 153
else
- echo 'FAIL: test 153' | tee -a ${LOGFILE}
- exit 1
+ fail 153
fi
echo 'M first-dir/subdir/a' >ans153.tmp
if cmp test153.tmp ans153.tmp; then
- echo 'PASS: test 154' >>${LOGFILE}
+ pass 154
else
- echo 'FAIL: test 154' | tee -a ${LOGFILE}
- exit 1
+ fail 154
fi
cd ..
@@ -4193,7 +5308,7 @@ U first-dir/subdir/b"
dotest modules-155c2 "${testcvs} add file1 file2" \
"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
'"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add these files permanently'
dotest modules-155c3 "${testcvs} -q ci -m add-it" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
done
@@ -4214,6 +5329,22 @@ done"
"U first-dir/file1
U first-dir/file2"
dotest modules-155c5 "${testcvs} -q co topfiles" ""
+
+ # Make sure the right thing happens if we remove a file.
+ cd first-dir
+ dotest modules-155c6 "${testcvs} -q rm -f file1" \
+"${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
+ dotest modules-155c7 "${testcvs} -q ci -m remove-it" \
+"Removing file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: delete; previous revision: 1\.1
+done"
+ cd ..
+ rm -r first-dir
+ dotest modules-155c8 "${testcvs} -q co topfiles" \
+"${PROG} [a-z]*: warning: first-dir/file1 is not (any longer) pertinent
+U first-dir/file2"
+
cd ..
rm -r 1
@@ -4222,8 +5353,28 @@ U first-dir/file2"
modules2)
# More tests of modules, in particular the & feature.
- mkdir ${CVSROOT_DIRNAME}/first-dir
- mkdir ${CVSROOT_DIRNAME}/second-dir
+ mkdir 1; cd 1
+ dotest modules2-setup-1 "${testcvs} -q co -l ." ''
+ mkdir first-dir second-dir third-dir
+ dotest modules2-setup-2 \
+"${testcvs} add first-dir second-dir third-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository
+Directory ${TESTDIR}/cvsroot/second-dir added to the repository
+Directory ${TESTDIR}/cvsroot/third-dir added to the repository"
+ cd third-dir
+ touch file3
+ dotest modules2-setup-3 "${testcvs} add file3" \
+"${PROG} [a-z]*: scheduling file .file3. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest modules2-setup-4 "${testcvs} -q ci -m add file3" \
+"RCS file: ${TESTDIR}/cvsroot/third-dir/file3,v
+done
+Checking in file3;
+${TESTDIR}/cvsroot/third-dir/file3,v <-- file3
+initial revision: 1\.1
+done"
+ cd ../..
+ rm -r 1
mkdir 1
cd 1
@@ -4232,6 +5383,7 @@ U first-dir/file2"
'U CVSROOT/modules'
cd CVSROOT
echo 'ampermodule &first-dir &second-dir' > modules
+ echo 'combmodule third-dir file3 &first-dir' >> modules
# Depending on whether the user also ran the modules test
# we will be checking in revision 1.2 or 1.3.
dotest modules2-2 "${testcvs} -q ci -m add-modules" \
@@ -4263,8 +5415,98 @@ EOF
cd ..
+ # Now we create another directory named first-dir and make
+ # sure that CVS doesn't get them mixed up.
+ mkdir first-dir
+ # Note that this message should say "Updating ampermodule/first-dir"
+ # I suspect. This is a long-standing behavior/bug....
+ dotest modules2-9 "${testcvs} co ampermodule" \
+"${PROG} [a-z]*: Updating first-dir
+${PROG} [a-z]*: Updating second-dir"
+ touch ampermodule/first-dir/amper1
+ dotest modules2-10 "${testcvs} add ampermodule/first-dir/amper1" \
+"${PROG} [a-z]*: scheduling file .ampermodule/first-dir/amper1. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+
+ # As with the "Updating xxx" message, the "U first-dir/amper1"
+ # message (instead of "U ampermodule/first-dir/amper1") is
+ # rather fishy.
+ dotest modules2-12 "${testcvs} co ampermodule" \
+"${PROG} [a-z]*: Updating first-dir
+A first-dir/amper1
+${PROG} [a-z]*: Updating second-dir"
+
+ if test "$remote" = no; then
+ dotest modules2-13 "${testcvs} -q ci -m add-it ampermodule" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/amper1,v
+done
+Checking in ampermodule/first-dir/amper1;
+${TESTDIR}/cvsroot/first-dir/amper1,v <-- amper1
+initial revision: 1\.1
+done"
+ else
+ # Trying this as above led to a "protocol error" message.
+ # Work around this bug.
+ cd ampermodule
+ dotest modules2-13 "${testcvs} -q ci -m add-it" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/amper1,v
+done
+Checking in first-dir/amper1;
+${TESTDIR}/cvsroot/first-dir/amper1,v <-- amper1
+initial revision: 1\.1
+done"
+ cd ..
+ fi
+
+ # Now test the "combmodule" module (combining regular modules
+ # and ampersand modules in the same module definition).
+ cd ..
+ rm -r 1
+ mkdir 1; cd 1
+ dotest modules2-14 "${testcvs} co combmodule" \
+"U combmodule/file3
+${PROG} [a-z]*: Updating first-dir
+U first-dir/amper1"
+ dotest modules2-15 "test -f combmodule/file3" ""
+ dotest modules2-16 "test -f combmodule/first-dir/amper1" ""
+ cd combmodule
+ rm -r first-dir
+ # Might be possible to have a more graceful error message,
+ # but at least for now there is no way to tell CVS that
+ # some files/subdirectories come from one repository directory,
+ # and others from another.
+ if test "$remote" = no; then
+ dotest_fail modules2-17 "${testcvs} update -d" \
+"${PROG} [a-z]*: Updating \.
+${PROG} [a-z]*: Updating first-dir
+${PROG} \[[a-z]* aborted\]: cannot open directory ${TESTDIR}/cvsroot/third-dir/first-dir: No such file or directory"
+ # Clean up the droppings left by the previous command.
+ # This should definitely not be necessary (I think).
+ rm -r first-dir
+ else
+ # This seems like a pretty sensible behavior to me, in the
+ # sense that first-dir doesn't "really" exist within
+ # third-dir, so CVS just acts as if there is nothing there
+ # to do.
+ dotest modules2-17 "${testcvs} update -d" \
+"${PROG} server: Updating \."
+ fi
+
+ cd ..
+ dotest modules2-18 "${testcvs} -q co combmodule" \
+"U first-dir/amper1"
+ dotest modules2-19 "test -f combmodule/first-dir/amper1" ""
+ cd ..
+ rm -r 1
+
# Test that CVS gives an error if one combines -a with
# other options.
+ # Probably would be better to break this out into a separate
+ # test. Although it is short, it shares no files/state with
+ # the rest of the modules2 tests.
+ mkdir 1; cd 1
+ dotest modules2-a0.5 "${testcvs} -q co CVSROOT/modules" \
+'U CVSROOT/modules'
cd CVSROOT
echo 'aliasopt -a -d onedir first-dir' >modules
dotest modules2-a0 "${testcvs} -q ci -m add-modules" \
@@ -4285,6 +5527,7 @@ ${PROG} \[[a-z]* aborted\]: cannot expand modules"
rm -r 1
rm -rf ${CVSROOT_DIRNAME}/first-dir
rm -rf ${CVSROOT_DIRNAME}/second-dir
+ rm -rf ${CVSROOT_DIRNAME}/third-dir
;;
modules3)
@@ -4303,7 +5546,7 @@ ${PROG} \[[a-z]* aborted\]: cannot expand modules"
echo file1 >file1
dotest modules3-2 "${testcvs} add file1" \
"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
dotest modules3-3 "${testcvs} -q ci -m add-it" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
done
@@ -4313,8 +5556,8 @@ initial revision: 1\.1
done"
cd ..
- dotest modules3-4 "${testcvs} -q co CVSROOT/modules" \
-'U CVSROOT/modules'
+ dotest modules3-4 "${testcvs} -q update -d CVSROOT" \
+"U CVSROOT${DOTSTAR}"
cd CVSROOT
cat >modules <<EOF
mod1 -a first-dir/file1
@@ -4323,6 +5566,7 @@ namednest -d src/sub/dir first-dir
nestdeeper -d src/sub1/sub2/sub3/dir first-dir
nestshallow -d src/dir second-dir/suba/subb
path/in/modules &mod1
+another/path/test -d another/path/test first-dir
EOF
dotest modules3-5 "${testcvs} -q ci -m add-modules" \
"Checking in modules;
@@ -4375,7 +5619,7 @@ ${PROG} [a-z]*: Updating second-dir/suba/subb" \
touch fileb
dotest modules3-7c "${testcvs} add fileb" \
"${PROG} [a-z]*: scheduling file .fileb. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest modules3-7d "${testcvs} -q ci -m add-it" \
"RCS file: ${TESTDIR}/cvsroot/second-dir/suba/subb/fileb,v
done
@@ -4386,26 +5630,6 @@ done"
cd ../../..
cd ..; rm -r 1
- mkdir 1; cd 1
- dotest modules3-7e "${testcvs} -q co nestshallow" \
-"U src/dir/fileb"
-
- # Using ${TESTDIR}/cvsroot/second-dir/suba instead of
- # ${TESTDIR}/cvsroot/second-dir seems wrong, it seems like the
- # 30 Dec 1996 change to build_dirs_and_chdir simply failed
- # to consider what to put in CVS/Repository.
- # Remote does "${TESTDIR}/cvsroot/\." which seems equally wrong,
- # if in a different way, but variety is the spice of life,
- # eh?
- dotest modules3-7f "cat CVS/Repository" \
-"${TESTDIR}/cvsroot/second-dir/suba" "${TESTDIR}/cvsroot/\."
-
- dotest modules3-7g "cat src/CVS/Repository" \
-"${TESTDIR}/cvsroot/second-dir/suba"
- dotest modules3-7h "cat src/dir/CVS/Repository" \
-"${TESTDIR}/cvsroot/second-dir/suba/subb"
- cd ..; rm -r 1
-
mkdir 1
cd 1
dotest modules3-8 "${testcvs} -q co namednest" \
@@ -4442,10 +5666,11 @@ done"
# need to keep doing it, but it is what CVS currently does...
# Skip it for remote; the remote code has the good sense to
# not deal with it (on the minus side it gives
- # "internal error: repository string too short." instead of a
- # real error).
- # I kind of suspect that it would be OK to just make it a fatal
- # error to have '/' in a module name.
+ # "internal error: repository string too short." (CVS 1.9) or
+ # "warning: server is not creating directories one at a time" (now)
+ # instead of a real error).
+ # I'm tempted to just make it a fatal error to have '/' in a
+ # module name. But see comments at modules3-16.
if test "x$remote" = xno; then
mkdir 1; cd 1
dotest modules3-12 "${testcvs} -q co path/in/modules" \
@@ -4465,6 +5690,16 @@ done"
cd ..; rm -r 1
fi # end of tests skipped for remote
+ # Some people seem to want this to work. I still suspect there
+ # are dark corners in slashes in module names. This probably wants
+ # more thought before we start hacking on CVS (one way or the other)
+ # or documenting this.
+ mkdir 2; cd 2
+ dotest modules3-16 "${testcvs} -q co another/path/test" \
+"U another/path/test/file1"
+ dotest modules3-17 "cat another/path/test/file1" 'file1'
+ cd ..; rm -r 2
+
rm -rf ${CVSROOT_DIRNAME}/first-dir
rm -rf ${CVSROOT_DIRNAME}/second-dir
;;
@@ -4477,49 +5712,43 @@ done"
# Test handling of -m during import
echo testa >>test
if ${testcvs} import -m "$message" a-dir A A1 >>${LOGFILE} 2>&1;then
- echo 'PASS: test 156' >>${LOGFILE}
+ pass 156
else
- echo 'FAIL: test 156' | tee -a ${LOGFILE}
- exit 1
+ fail 156
fi
# Must import twice since the first time uses inline code that
# avoids RCS call.
echo testb >>test
if ${testcvs} import -m "$message" a-dir A A2 >>${LOGFILE} 2>&1;then
- echo 'PASS: test 157' >>${LOGFILE}
+ pass 157
else
- echo 'FAIL: test 157' | tee -a ${LOGFILE}
- exit 1
+ fail 157
fi
# Test handling of -m during ci
cd ..; rm -r a-dir
if ${testcvs} co a-dir >>${LOGFILE} 2>&1; then
- echo 'PASS: test 158' >>${LOGFILE}
+ pass 158
else
- echo 'FAIL: test 158' | tee -a ${LOGFILE}
- exit 1
+ fail 158
fi
cd a-dir
echo testc >>test
if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
- echo 'PASS: test 159' >>${LOGFILE}
+ pass 159
else
- echo 'FAIL: test 159' | tee -a ${LOGFILE}
- exit 1
+ fail 159
fi
# Test handling of -m during rm/ci
rm test;
if ${testcvs} rm test >>${LOGFILE} 2>&1; then
- echo 'PASS: test 160' >>${LOGFILE}
+ pass 160
else
- echo 'FAIL: test 160' | tee -a ${LOGFILE}
- exit 1
+ fail 160
fi
if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
- echo 'PASS: test 161' >>${LOGFILE}
+ pass 161
else
- echo 'FAIL: test 161' | tee -a ${LOGFILE}
- exit 1
+ fail 161
fi
# Clean up
cd ..
@@ -4527,70 +5756,245 @@ done"
rm -rf ${CVSROOT_DIRNAME}/a-dir
done
;;
+
+ editor)
+ # More tests of log messages, in this case the ability to
+ # run an external editor.
+ # TODO:
+ # * also test $EDITOR, $CVSEDITOR, &c.
+ # * test what happens if up-to-date check fails.
+
+ # Our "editor" puts "x" at the start of each line, so we
+ # can see the "CVS:" lines.
+ cat >${TESTDIR}/editme <<EOF
+#!${TESTSHELL}
+sleep 1
+sed <\$1 -e 's/^/x&/g' >${TESTDIR}/edit.new
+mv ${TESTDIR}/edit.new \$1
+exit 0
+EOF
+ chmod +x ${TESTDIR}/editme
+
+ mkdir 1; cd 1
+ dotest editor-1 "${testcvs} -q co -l ." ''
+ mkdir first-dir
+ dotest editor-2 "${testcvs} add first-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
+ cd first-dir
+ touch file1 file2
+ dotest editor-3 "${testcvs} add file1 file2" \
+"${PROG} [a-z]*: scheduling file .file1. for addition
+${PROG} [a-z]*: scheduling file .file2. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
+ dotest editor-4 "${testcvs} -e ${TESTDIR}/editme -q ci" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done
+Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+initial revision: 1\.1
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+done
+Checking in file2;
+${TESTDIR}/cvsroot/first-dir/file2,v <-- file2
+initial revision: 1\.1
+done"
+ dotest editor-5 "${testcvs} -q tag -b br" "T file1
+T file2"
+ dotest editor-6 "${testcvs} -q update -r br" ''
+ echo modify >>file1
+ dotest editor-7 "${testcvs} -e ${TESTDIR}/editme -q ci" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.1\.2\.1; previous revision: 1\.1
+done"
+ # OK, now we want to make sure "ci -r" puts in the branch
+ # where appropriate. Note that we can check in on the branch
+ # without being on the branch, because there is not a revision
+ # already on the branch. If there were a revision on the branch,
+ # CVS would correctly give an up-to-date check failed.
+ dotest editor-8 "${testcvs} -q update -A" "U file1"
+ echo add a line >>file2
+ dotest editor-9 "${testcvs} -q -e ${TESTDIR}/editme ci -rbr file2" \
+"Checking in file2;
+${TESTDIR}/cvsroot/first-dir/file2,v <-- file2
+new revision: 1\.1\.2\.1; previous revision: 1\.1
+done"
+
+ dotest editor-log-file1 "${testcvs} log -N file1" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+Working file: file1
+head: 1\.1
+branch:
+locks: strict
+access list:
+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;
+x
+xCVS: ----------------------------------------------------------------------
+xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically
+xCVS:
+xCVS: Committing in .
+xCVS:
+xCVS: Added Files:
+xCVS: file1 file2
+xCVS: ----------------------------------------------------------------------
+----------------------------
+revision 1\.1\.2\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
+x
+xCVS: ----------------------------------------------------------------------
+xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically
+xCVS:
+xCVS: Committing in .
+xCVS:
+xCVS: Modified Files:
+xCVS: Tag: br
+xCVS: file1
+xCVS: ----------------------------------------------------------------------
+============================================================================="
+
+ # The only difference between the two expect strings is the
+ # presence or absence of "Committing in ." for 1.1.2.1.
+ dotest editor-log-file2 "${testcvs} log -N file2" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+Working file: file2
+head: 1\.1
+branch:
+locks: strict
+access list:
+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;
+x
+xCVS: ----------------------------------------------------------------------
+xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically
+xCVS:
+xCVS: Committing in .
+xCVS:
+xCVS: Added Files:
+xCVS: file1 file2
+xCVS: ----------------------------------------------------------------------
+----------------------------
+revision 1\.1\.2\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
+x
+xCVS: ----------------------------------------------------------------------
+xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically
+xCVS:
+xCVS: Modified Files:
+xCVS: Tag: br
+xCVS: file2
+xCVS: ----------------------------------------------------------------------
+=============================================================================" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+Working file: file2
+head: 1\.1
+branch:
+locks: strict
+access list:
+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;
+x
+xCVS: ----------------------------------------------------------------------
+xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically
+xCVS:
+xCVS: Committing in .
+xCVS:
+xCVS: Added Files:
+xCVS: file1 file2
+xCVS: ----------------------------------------------------------------------
+----------------------------
+revision 1\.1\.2\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
+x
+xCVS: ----------------------------------------------------------------------
+xCVS: Enter Log. Lines beginning with .CVS:. are removed automatically
+xCVS:
+xCVS: Committing in .
+xCVS:
+xCVS: Modified Files:
+xCVS: Tag: br
+xCVS: file2
+xCVS: ----------------------------------------------------------------------
+============================================================================="
+ cd ../..
+ rm -r 1
+ rm ${TESTDIR}/editme
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
errmsg1)
mkdir ${CVSROOT_DIRNAME}/1dir
mkdir 1
cd 1
if ${testcvs} -q co 1dir; then
- echo 'PASS: test 162' >>${LOGFILE}
+ pass 162
else
- echo 'FAIL: test 162' | tee -a ${LOGFILE}
- exit 1
+ fail 162
fi
cd 1dir
touch foo
if ${testcvs} add foo 2>>${LOGFILE}; then
- echo 'PASS: test 163' >>${LOGFILE}
+ pass 163
else
- echo 'FAIL: test 163' | tee -a ${LOGFILE}
- exit 1
+ fail 163
fi
if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
- echo 'PASS: test 164' >>${LOGFILE}
+ pass 164
else
- echo 'FAIL: test 164' | tee -a ${LOGFILE}
- exit 1
+ fail 164
fi
cd ../..
mkdir 2
cd 2
if ${testcvs} -q co 1dir >>${LOGFILE}; then
- echo 'PASS: test 165' >>${LOGFILE}
+ pass 165
else
- echo 'FAIL: test 165' | tee -a ${LOGFILE}
- exit 1
+ fail 165
fi
chmod a-w 1dir
cd ../1/1dir
rm foo;
if ${testcvs} rm foo >>${LOGFILE} 2>&1; then
- echo 'PASS: test 166' >>${LOGFILE}
+ pass 166
else
- echo 'FAIL: test 166' | tee -a ${LOGFILE}
- exit 1
+ fail 166
fi
if ${testcvs} ci -m removed >>${LOGFILE} 2>&1; then
- echo 'PASS: test 167' >>${LOGFILE}
+ pass 167
else
- echo 'FAIL: test 167' | tee -a ${LOGFILE}
- exit 1
+ fail 167
fi
cd ../../2/1dir
- # FIXME: should be using dotest and PROG.
+ # FIXME: should be using dotest.
${testcvs} -q update 2>../tst167.err
- CVSBASE=`basename $testcvs` # Get basename of CVS executable.
+ cat ../tst167.err >>${LOGFILE}
cat <<EOF >../tst167.ans
-$CVSBASE server: warning: foo is not (any longer) pertinent
-$CVSBASE update: unable to remove ./foo: Permission denied
+${PROG} server: warning: foo is not (any longer) pertinent
+${PROG} update: unable to remove ./foo: Permission denied
EOF
if cmp ../tst167.ans ../tst167.err >/dev/null ||
- ( echo "$CVSBASE [update aborted]: cannot rename file foo to CVS/,,foo: Permission denied" | cmp - ../tst167.err >/dev/null )
+ ( echo "${PROG} [update aborted]: cannot rename file foo to CVS/,,foo: Permission denied" | cmp - ../tst167.err >/dev/null )
then
- echo 'PASS: test 168' >>${LOGFILE}
+ pass 168
else
- echo 'FAIL: test 168' | tee -a ${LOGFILE}
- exit 1
+ fail 168
fi
cd ..
@@ -4600,47 +6004,166 @@ EOF
rm -rf ${CVSROOT_DIRNAME}/1dir
;;
+ errmsg2)
+ # More tests of various miscellaneous error handling,
+ # and cvs add behavior in general.
+ # See also test basicb-4a, concerning "cvs ci CVS".
+ # Too many tests to mention test the simple cases of
+ # adding files and directories.
+ # Test basicb-2a10 tests cvs -n add.
+
+ # First the usual setup; create a directory first-dir.
+ mkdir 1; cd 1
+ dotest errmsg2-1 "${testcvs} -q co -l ." ''
+ mkdir first-dir
+ dotest errmsg2-2 "${testcvs} add first-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
+ cd first-dir
+ dotest_fail errmsg2-3 "${testcvs} add CVS" \
+"${PROG} [a-z]*: cannot add special file .CVS.; skipping"
+ touch file1
+ # For the most part add returns a failure exitstatus if
+ # there are any errors, even if the remaining files are
+ # processed without incident. The "cannot add
+ # special file" message fits this pattern, at
+ # least currently.
+ dotest_fail errmsg2-4 "${testcvs} add CVS file1" \
+"${PROG} [a-z]*: cannot add special file .CVS.; skipping
+${PROG} [a-z]*: scheduling file .file1. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ # I'm not sure these tests completely convey the various strange
+ # behaviors that CVS had before it specially checked for "." and
+ # "..". Suffice it to say that these are unlikely to work right
+ # without a special case.
+ dotest_fail errmsg2-5 "${testcvs} add ." \
+"${PROG} [a-z]*: cannot add special file .\..; skipping"
+ dotest_fail errmsg2-6 "${testcvs} add .." \
+"${PROG} [a-z]*: cannot add special file .\.\..; skipping"
+ # Make sure that none of the error messages left droppings
+ # which interfere with normal operation.
+ dotest errmsg2-7 "${testcvs} -q ci -m add-file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done
+Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+initial revision: 1\.1
+done"
+ mkdir sdir
+ cd ..
+ dotest errmsg2-8 "${testcvs} add first-dir/sdir" \
+"Directory ${TESTDIR}/cvsroot/first-dir/sdir added to the repository"
+
+ cd first-dir
+
+ touch file10
+ mkdir sdir10
+ dotest errmsg2-10 "${testcvs} add file10 sdir10" \
+"${PROG} [a-z]*: scheduling file .file10. for addition
+Directory ${TESTDIR}/cvsroot/first-dir/sdir10 added to the repository
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest errmsg2-11 "${testcvs} -q ci -m add-file10" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file10,v
+done
+Checking in file10;
+${TESTDIR}/cvsroot/first-dir/file10,v <-- file10
+initial revision: 1\.1
+done"
+ # Try to see that there are no droppings left by
+ # any of the previous tests.
+ dotest errmsg2-12 "${testcvs} -q update" ""
+
+ # Now test adding files with '/' in the name, both one level
+ # down and more than one level down.
+ cd ..
+ mkdir first-dir/sdir10/ssdir
+ dotest errmsg2-13 "${testcvs} add first-dir/sdir10/ssdir" \
+"Directory ${TESTDIR}/cvsroot/first-dir/sdir10/ssdir added to the repository"
+
+ touch first-dir/sdir10/ssdir/ssfile
+ dotest errmsg2-14 \
+ "${testcvs} add first-dir/sdir10/ssdir/ssfile" \
+"${PROG} [a-z]*: scheduling file .first-dir/sdir10/ssdir/ssfile. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ touch first-dir/file15
+ dotest errmsg2-15 "${testcvs} add first-dir/file15" \
+"${PROG} [a-z]*: scheduling file .first-dir/file15. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+
+ # Now the case where we try to give it a directory which is not
+ # under CVS control.
+ mkdir bogus-dir
+ touch bogus-dir/file16
+ # The first message, from local CVS, is nice. The second one
+ # is not nice; would be good to fix remote CVS to give a clearer
+ # message (e.g. the one from local CVS). But at least it is an
+ # error message.
+ dotest_fail errmsg2-16 "${testcvs} add bogus-dir/file16" \
+"${PROG} [a-z]*: in directory bogus-dir:
+${PROG} \[[a-z]* aborted\]: there is no version here; do .${PROG} checkout. first" \
+"${PROG} [a-z]*: cannot open CVS/Entries for reading: No such file or directory
+${PROG} \[add aborted\]: no repository"
+ rm -r bogus-dir
+
+ # One error condition we don't test for is trying to add a file
+ # or directory which already is there.
+
+ dotest errmsg2-17 "${testcvs} -q ci -m checkin" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file15,v
+done
+Checking in first-dir/file15;
+${TESTDIR}/cvsroot/first-dir/file15,v <-- file15
+initial revision: 1\.1
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/sdir10/ssdir/ssfile,v
+done
+Checking in first-dir/sdir10/ssdir/ssfile;
+${TESTDIR}/cvsroot/first-dir/sdir10/ssdir/ssfile,v <-- ssfile
+initial revision: 1\.1
+done"
+
+ cd ..
+ rm -r 1
+ rm -rf ${TESTDIR}/cvsroot/first-dir
+ ;;
+
devcom)
mkdir ${CVSROOT_DIRNAME}/first-dir
mkdir 1
cd 1
if ${testcvs} -q co first-dir >>${LOGFILE} ; then
- echo 'PASS: test 169' >>${LOGFILE}
+ pass 169
else
- echo 'FAIL: test 169' | tee -a ${LOGFILE}
- exit 1
+ fail 169
fi
cd first-dir
echo abb >abb
if ${testcvs} add abb 2>>${LOGFILE}; then
- echo 'PASS: test 170' >>${LOGFILE}
+ pass 170
else
- echo 'FAIL: test 170' | tee -a ${LOGFILE}
- exit 1
+ fail 170
fi
if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
- echo 'PASS: test 171' >>${LOGFILE}
+ pass 171
else
- echo 'FAIL: test 171' | tee -a ${LOGFILE}
- exit 1
+ fail 171
fi
dotest_fail 171a0 "${testcvs} watch" "Usage${DOTSTAR}"
if ${testcvs} watch on; then
- echo 'PASS: test 172' >>${LOGFILE}
+ pass 172
else
- echo 'FAIL: test 172' | tee -a ${LOGFILE}
+ fail 172
fi
echo abc >abc
if ${testcvs} add abc 2>>${LOGFILE}; then
- echo 'PASS: test 173' >>${LOGFILE}
+ pass 173
else
- echo 'FAIL: test 173' | tee -a ${LOGFILE}
+ fail 173
fi
if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
- echo 'PASS: test 174' >>${LOGFILE}
+ pass 174
else
- echo 'FAIL: test 174' | tee -a ${LOGFILE}
+ fail 174
fi
cd ../..
@@ -4648,119 +6171,117 @@ EOF
cd 2
if ${testcvs} -q co first-dir >>${LOGFILE}; then
- echo 'PASS: test 175' >>${LOGFILE}
+ pass 175
else
- echo 'FAIL: test 175' | tee -a ${LOGFILE}
+ fail 175
fi
cd first-dir
if test -w abb; then
- echo 'FAIL: test 176' | tee -a ${LOGFILE}
+ fail 176
else
- echo 'PASS: test 176' >>${LOGFILE}
+ pass 176
fi
if test -w abc; then
- echo 'FAIL: test 177' | tee -a ${LOGFILE}
+ fail 177
else
- echo 'PASS: test 177' >>${LOGFILE}
+ pass 177
fi
if ${testcvs} editors >../ans178.tmp; then
- echo 'PASS: test 178' >>${LOGFILE}
+ pass 178
else
- echo 'FAIL: test 178' | tee -a ${LOGFILE}
+ fail 178
fi
cat ../ans178.tmp >>${LOGFILE}
if test -s ../ans178.tmp; then
- echo 'FAIL: test 178a' | tee -a ${LOGFILE}
+ fail 178a
else
- echo 'PASS: test 178a' >>${LOGFILE}
+ pass 178a
fi
if ${testcvs} edit abb; then
- echo 'PASS: test 179' >>${LOGFILE}
+ pass 179
else
- echo 'FAIL: test 179' | tee -a ${LOGFILE}
- exit 1
+ fail 179
fi
if ${testcvs} editors >../ans180.tmp; then
- echo 'PASS: test 180' >>${LOGFILE}
+ pass 180
else
- echo 'FAIL: test 180' | tee -a ${LOGFILE}
- exit 1
+ fail 180
fi
cat ../ans180.tmp >>${LOGFILE}
if test -s ../ans180.tmp; then
- echo 'PASS: test 181' >>${LOGFILE}
+ pass 181
else
- echo 'FAIL: test 181' | tee -a ${LOGFILE}
+ fail 181
fi
echo aaaa >>abb
if ${testcvs} ci -m modify abb >>${LOGFILE} 2>&1; then
- echo 'PASS: test 182' >>${LOGFILE}
+ pass 182
else
- echo 'FAIL: test 182' | tee -a ${LOGFILE}
+ fail 182
fi
# Unedit of a file not being edited should be a noop.
dotest 182.5 "${testcvs} unedit abb" ''
if ${testcvs} editors >../ans183.tmp; then
- echo 'PASS: test 183' >>${LOGFILE}
+ pass 183
else
- echo 'FAIL: test 183' | tee -a ${LOGFILE}
+ fail 183
fi
cat ../ans183.tmp >>${LOGFILE}
if test -s ../ans183.tmp; then
- echo 'FAIL: test 184' | tee -a ${LOGFILE}
+ fail 184
else
- echo 'PASS: test 184' >>${LOGFILE}
+ pass 184
fi
if test -w abb; then
- echo 'FAIL: test 185' | tee -a ${LOGFILE}
+ fail 185
else
- echo 'PASS: test 185' >>${LOGFILE}
+ pass 185
fi
if ${testcvs} edit abc; then
- echo 'PASS: test 186a1' >>${LOGFILE}
+ pass 186a1
else
- echo 'FAIL: test 186a1' | tee -a ${LOGFILE}
+ fail 186a1
fi
# Unedit of an unmodified file.
if ${testcvs} unedit abc; then
- echo 'PASS: test 186a2' >>${LOGFILE}
+ pass 186a2
else
- echo 'FAIL: test 186a2' | tee -a ${LOGFILE}
+ fail 186a2
fi
if ${testcvs} edit abc; then
- echo 'PASS: test 186a3' >>${LOGFILE}
+ pass 186a3
else
- echo 'FAIL: test 186a3' | tee -a ${LOGFILE}
+ fail 186a3
fi
echo changedabc >abc
# Try to unedit a modified file; cvs should ask for confirmation
if (echo no | ${testcvs} unedit abc) >>${LOGFILE}; then
- echo 'PASS: test 186a4' >>${LOGFILE}
+ pass 186a4
else
- echo 'FAIL: test 186a4' | tee -a ${LOGFILE}
+ fail 186a4
fi
if echo changedabc | cmp - abc; then
- echo 'PASS: test 186a5' >>${LOGFILE}
+ pass 186a5
else
- echo 'FAIL: test 186a5' | tee -a ${LOGFILE}
+ fail 186a5
fi
# OK, now confirm the unedit
if (echo yes | ${testcvs} unedit abc) >>${LOGFILE}; then
- echo 'PASS: test 186a6' >>${LOGFILE}
+ pass 186a6
else
- echo 'FAIL: test 186a6' | tee -a ${LOGFILE}
+ fail 186a6
fi
if echo abc | cmp - abc; then
- echo 'PASS: test 186a7' >>${LOGFILE}
+ pass 186a7
else
- echo 'FAIL: test 186a7' | tee -a ${LOGFILE}
+ fail 186a7
fi
dotest devcom-a0 "${testcvs} watchers" ''
@@ -4771,11 +6292,11 @@ EOF
dotest devcom-a1 "${testcvs} watch add" ''
dotest devcom-a2 "${testcvs} watchers" \
-'abb [a-z0-9]* edit unedit commit
-abc [a-z0-9]* edit unedit commit'
+"abb ${username} edit unedit commit
+abc ${username} edit unedit commit"
dotest devcom-a3 "${testcvs} watch remove -a unedit abb" ''
dotest devcom-a4 "${testcvs} watchers abb" \
-'abb [a-z0-9]* edit commit'
+"abb ${username} edit commit"
# Check tagging and checking out while we have a CVS
# directory in the repository.
@@ -4798,6 +6319,29 @@ T abc'
# Since first-dir/abb is readonly, use -f.
rm -rf 3
+ # Test checking out the directory rather than the file.
+ mkdir 3
+ cd 3
+ dotest devcom-t2 "${testcvs} -q co -rtag first-dir" \
+'U first-dir/abb
+U first-dir/abc'
+ cd ..
+ # Since the files are readonly, use -f.
+ rm -rf 3
+
+ # Now do it again, after removing the val-tags file created
+ # by devcom-t1 to force CVS to search the repository
+ # containing CVS directories.
+ rm ${CVSROOT_DIRNAME}/CVSROOT/val-tags
+ mkdir 3
+ cd 3
+ dotest devcom-t3 "${testcvs} -q co -rtag first-dir" \
+'U first-dir/abb
+U first-dir/abc'
+ cd ..
+ # Since the files are readonly, use -f.
+ rm -rf 3
+
# Now remove all the file attributes
cd 2/first-dir
dotest devcom-b0 "${testcvs} watch off" ''
@@ -4872,6 +6416,26 @@ U first-dir/w3'
dotest_fail devcom2-9 "test -w first-dir/w1" ''
dotest_fail devcom2-10 "test -w first-dir/w2" ''
dotest_fail devcom2-11 "test -w first-dir/w3" ''
+
+ cd first-dir
+ # OK, now we want to try files in various states with cvs edit.
+ dotest devcom2-12 "${testcvs} edit w4" \
+"${PROG} edit: no such file w4; ignored"
+ # Try the same thing with a per-directory watch set.
+ dotest devcom2-13 "${testcvs} watch on" ''
+ dotest devcom2-14 "${testcvs} edit w5" \
+"${PROG} edit: no such file w5; ignored"
+ dotest devcom2-15 "${testcvs} editors" ''
+ dotest devcom2-16 "${testcvs} editors w4" ''
+ # Make sure there are no droppings lying around
+ dotest devcom2-17 "cat ${CVSROOT_DIRNAME}/first-dir/CVS/fileattr" \
+"Fw1 _watched=
+Fw2 _watched=
+Fw3 _watched=
+Fnw1 _watched=
+D _watched="
+ cd ..
+
cd ..
# Use -f because of the readonly files.
@@ -4936,17 +6500,114 @@ G@#..!@#=&"
rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
+ watch4)
+ # More watch tests, including adding directories.
+ mkdir 1; cd 1
+ dotest watch4-0a "${testcvs} -q co -l ." ''
+ mkdir first-dir
+ dotest watch4-0b "${testcvs} add first-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
+
+ cd first-dir
+ dotest watch4-1 "${testcvs} watch on" ''
+ # This is just like the 173 test
+ touch file1
+ dotest watch4-2 "${testcvs} add file1" \
+"${PROG} [a-z]*: scheduling file .file1. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest watch4-3 "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done
+Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+initial revision: 1\.1
+done"
+ # Now test the analogous behavior for directories.
+ mkdir subdir
+ dotest watch4-4 "${testcvs} add subdir" \
+"Directory ${TESTDIR}/cvsroot/first-dir/subdir added to the repository"
+ cd subdir
+ touch sfile
+ dotest watch4-5 "${testcvs} add sfile" \
+"${PROG} [a-z]*: scheduling file .sfile. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest watch4-6 "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/subdir/sfile,v
+done
+Checking in sfile;
+${TESTDIR}/cvsroot/first-dir/subdir/sfile,v <-- sfile
+initial revision: 1\.1
+done"
+ cd ../../..
+ mkdir 2; cd 2
+ dotest watch4-7 "${testcvs} -q co first-dir" "U first-dir/file1
+U first-dir/subdir/sfile"
+ dotest_fail watch4-8 "test -w first-dir/file1" ''
+ dotest_fail watch4-9 "test -w first-dir/subdir/sfile" ''
+ cd first-dir
+ dotest watch4-10 "${testcvs} edit file1" ''
+ echo 'edited in 2' >file1
+ cd ../..
+
+ cd 1/first-dir
+ dotest watch4-11 "${testcvs} edit file1" ''
+ echo 'edited in 1' >file1
+ dotest watch4-12 "${testcvs} -q ci -m edit-in-1" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.2; previous revision: 1\.1
+done"
+ cd ../..
+ cd 2/first-dir
+ dotest watch4-13 "${testcvs} -q update" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+retrieving revision 1\.1
+retrieving revision 1\.2
+Merging differences between 1\.1 and 1\.2 into file1
+rcsmerge: warning: conflicts during merge
+${PROG} [a-z]*: conflicts found in file1
+C file1"
+ if (echo yes | ${testcvs} unedit file1) >>${LOGFILE}; then
+ pass watch4-14
+ else
+ fail watch4-15
+ fi
+ # This could plausibly be defined to either go back to the revision
+ # which was cvs edit'd (the status quo), or back to revision 1.2
+ # (that is, the merge could update CVS/Base/file1). We pick the
+ # former because it is easier to implement, not because we have
+ # thought much about which is better.
+ dotest watch4-16 "cat file1" ''
+ # Make sure CVS really thinks we are at 1.1.
+ dotest watch4-17 "${testcvs} -q update" "U file1"
+ dotest watch4-18 "cat file1" "edited in 1"
+ cd ../..
+
+ # As a sanity check, make sure we are in the right place.
+ dotest watch4-cleanup-1 "test -d 1" ''
+ dotest watch4-cleanup-1 "test -d 2" ''
+ # Specify -f because of the readonly files.
+ rm -rf 1 2
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
ignore)
+ # On Windows, we can't check out CVSROOT, because the case
+ # insensitivity means that this conflicts with cvsroot.
+ mkdir wnt
+ cd wnt
+
dotest 187a1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
cd CVSROOT
echo rootig.c >cvsignore
dotest 187a2 "${testcvs} add cvsignore" "${PROG}"' [a-z]*: scheduling file `cvsignore'"'"' for addition
-'"${PROG}"' [a-z]*: use '"'"'cvs commit'"'"' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
# As of Jan 96, local CVS prints "Examining ." and remote doesn't.
# Accept either.
dotest 187a3 " ${testcvs} ci -m added" \
-"${DOTSTAR}CS file: ${TESTDIR}/cvsroot/CVSROOT/cvsignore,v
+"${PROG} [a-z]*: Examining \.
+RCS file: ${TESTDIR}/cvsroot/CVSROOT/cvsignore,v
done
Checking in cvsignore;
${TESTDIR}/cvsroot/CVSROOT/cvsignore,v <-- cvsignore
@@ -4956,10 +6617,9 @@ ${PROG} [a-z]*: Rebuilding administrative file database"
cd ..
if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then
- echo 'PASS: test 187a4' >>${LOGFILE}
+ pass 187a4
else
- echo 'FAIL: test 187a4' | tee -a ${LOGFILE}
- exit 1
+ fail 187a4
fi
# CVS looks at the home dir from getpwuid, not HOME (is that correct
@@ -4969,32 +6629,27 @@ ${PROG} [a-z]*: Rebuilding administrative file database"
mkdir dir-to-import
cd dir-to-import
touch foobar.c bar.c rootig.c defig.o envig.c optig.c
- # We really should allow the files to be listed in any order.
- # But we (kludgily) just list the orders which have been observed.
- dotest 188a "${testcvs} import -m m -I optig.c first-dir tag1 tag2" \
- 'N first-dir/foobar.c
-N first-dir/bar.c
-I first-dir/rootig.c
-I first-dir/defig.o
-I first-dir/envig.c
-I first-dir/optig.c
+ # We use sort because we can't predict the order in which
+ # the files will be listed.
+ dotest_sort 188a "${testcvs} import -m m -I optig.c first-dir tag1 tag2" \
+'
-No conflicts created by this import' 'I first-dir/defig.o
+I first-dir/defig.o
I first-dir/envig.c
I first-dir/optig.c
-N first-dir/foobar.c
-N first-dir/bar.c
I first-dir/rootig.c
-
+N first-dir/bar.c
+N first-dir/foobar.c
No conflicts created by this import'
- dotest 188b "${testcvs} import -m m -I ! second-dir tag3 tag4" \
- 'N second-dir/foobar.c
+ dotest_sort 188b "${testcvs} import -m m -I ! second-dir tag3 tag4" \
+'
+
N second-dir/bar.c
-N second-dir/rootig.c
N second-dir/defig.o
N second-dir/envig.c
+N second-dir/foobar.c
N second-dir/optig.c
-
+N second-dir/rootig.c
No conflicts created by this import'
cd ..
rm -r dir-to-import
@@ -5015,11 +6670,12 @@ U first-dir/foobar.c'
dotest 189c "${testcvs} -q update -I optig.c" "${QUESTION} notig.c"
# The fact that CVS requires us to specify -I CVS here strikes me
# as a bug.
- dotest 189d "${testcvs} -q update -I ! -I CVS" "${QUESTION} rootig.c
-${QUESTION} defig.o
+ dotest_sort 189d "${testcvs} -q update -I ! -I CVS" \
+"${QUESTION} defig.o
${QUESTION} envig.c
+${QUESTION} notig.c
${QUESTION} optig.c
-${QUESTION} notig.c"
+${QUESTION} rootig.c"
# Now test that commands other than update also print "? notig.c"
# where appropriate. Only test this for remote, because local
@@ -5045,26 +6701,17 @@ ${QUESTION} notig.c"
echo notig.c >first-dir/.cvsignore
echo foobar.c >second-dir/.cvsignore
touch first-dir/notig.c second-dir/notig.c second-dir/foobar.c
- dotest 190 "${testcvs} -qn update" \
+ dotest_sort 190 "${testcvs} -qn update" \
"${QUESTION} first-dir/.cvsignore
${QUESTION} second-dir/.cvsignore
-${QUESTION} second-dir/notig.c" \
+${QUESTION} second-dir/notig.c"
+ dotest_sort 191 "${testcvs} -qn update -I! -I CVS" \
"${QUESTION} first-dir/.cvsignore
-${QUESTION} second-dir/notig.c
-${QUESTION} second-dir/.cvsignore"
- dotest 191 "${testcvs} -qn update -I! -I CVS" \
-"${QUESTION} first-dir/rootig.c
${QUESTION} first-dir/defig.o
${QUESTION} first-dir/envig.c
-${QUESTION} first-dir/.cvsignore
+${QUESTION} first-dir/rootig.c
${QUESTION} second-dir/.cvsignore
-${QUESTION} second-dir/notig.c" \
-"${QUESTION} first-dir/rootig.c
-${QUESTION} first-dir/defig.o
-${QUESTION} first-dir/envig.c
-${QUESTION} first-dir/.cvsignore
-${QUESTION} second-dir/notig.c
-${QUESTION} second-dir/.cvsignore"
+${QUESTION} second-dir/notig.c"
if echo yes | ${testcvs} release -d first-dir \
>${TESTDIR}/ignore.tmp; then
@@ -5091,6 +6738,8 @@ You have \[1\] altered files in this repository.
Are you sure you want to release (and delete) directory .second-dir': "
cd ..
rm -r 1
+ cd ..
+ rm -r wnt
rm ${TESTDIR}/ignore.tmp
rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir
;;
@@ -5107,7 +6756,7 @@ Are you sure you want to release (and delete) directory .second-dir': "
cp ../binfile.dat binfile
dotest binfiles-2 "${testcvs} add -kb binfile" \
"${PROG}"' [a-z]*: scheduling file `binfile'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
dotest binfiles-3 "${testcvs} -q ci -m add-it" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/binfile,v
done
@@ -5175,7 +6824,7 @@ done"
echo 'edits in dir 2' >binfile
dotest binfiles-con1 "${testcvs} -q update" \
"U binfile
-${PROG} [a-z]*: binary file needs merge
+${PROG} [a-z]*: nonmergeable file needs merge
${PROG} [a-z]*: revision 1\.3 from repository is now in binfile
${PROG} [a-z]*: file from working directory is now in \.#binfile\.1\.2
C binfile"
@@ -5191,14 +6840,11 @@ done"
cd ../../1/first-dir
dotest binfiles-con5 "${testcvs} -q update" '[UP] binfile'
- # The bugs which these test for are apparently not fixed for remote.
- if test "$remote" = no; then
- dotest binfiles-9 "${testcvs} -q update -A" ''
- dotest binfiles-10 "${testcvs} -q update -kk" '[UP] binfile'
- dotest binfiles-11 "${testcvs} -q update" ''
- dotest binfiles-12 "${testcvs} -q update -A" '[UP] binfile'
- dotest binfiles-13 "${testcvs} -q update -A" ''
- fi
+ dotest binfiles-9 "${testcvs} -q update -A" ''
+ dotest binfiles-10 "${testcvs} -q update -kk" '[UP] binfile'
+ dotest binfiles-11 "${testcvs} -q update" ''
+ dotest binfiles-12 "${testcvs} -q update -A" '[UP] binfile'
+ dotest binfiles-13 "${testcvs} -q update -A" ''
cd ../..
rm -r 1
@@ -5270,7 +6916,7 @@ File: binfile Status: Up-to-date
# Do sticky options work when used with 'cvs update'?
echo "Not a binary file." > nibfile
dotest binfiles-sticky1 "${testcvs} -q add nibfile" \
-"${PROG} [a-z]*: use "\''cvs commit'\'' to add this file permanently'
+"${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest binfiles-sticky2 "${testcvs} -q ci -m add-it nibfile" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/nibfile,v
done
@@ -5289,7 +6935,53 @@ File: nibfile Status: Up-to-date
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: -kb"
- # Eventually we should test that -A removes the -kb here...
+
+ # Now test that -A can clear the sticky option.
+ dotest binfiles-sticky5 "${testcvs} -q update -A nibfile" \
+"[UP] nibfile"
+ dotest binfiles-sticky6 "${testcvs} -q status nibfile" \
+"===================================================================
+File: nibfile Status: Up-to-date
+
+ Working revision: 1\.1.*
+ Repository revision: 1\.1 ${TESTDIR}/cvsroot/first-dir/nibfile,v
+ Sticky Tag: (none)
+ Sticky Date: (none)
+ Sticky Options: (none)"
+ dotest binfiles-15 "${testcvs} -q admin -kb nibfile" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/nibfile,v
+done"
+ dotest binfiles-16 "${testcvs} -q update nibfile" "[UP] nibfile"
+ dotest binfiles-17 "${testcvs} -q status nibfile" \
+"===================================================================
+File: nibfile Status: Up-to-date
+
+ Working revision: 1\.1.*
+ Repository revision: 1\.1 ${TESTDIR}/cvsroot/first-dir/nibfile,v
+ Sticky Tag: (none)
+ Sticky Date: (none)
+ Sticky Options: -kb"
+
+ dotest binfiles-o1 "${testcvs} admin -o1.3:: binfile" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/binfile,v
+deleting revision 1\.5
+deleting revision 1\.4
+done"
+ dotest binfiles-o2 "${testcvs} admin -o::1.3 binfile" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/binfile,v
+deleting revision 1\.2
+deleting revision 1\.1
+done"
+ dotest binfiles-o3 "${testcvs} -q log -h -N binfile" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/binfile,v
+Working file: binfile
+head: 1\.3
+branch:
+locks: strict
+access list:
+keyword substitution: v
+total revisions: 1
+============================================================================="
cd ../..
rm -rf ${CVSROOT_DIRNAME}/first-dir
@@ -5302,56 +6994,342 @@ File: nibfile Status: Up-to-date
# doesn't print "cannot merge binary files" or some such, in
# situations where no merging is required.
# See also "join" which does this with non-binary files.
+ #
+ # Cases (we are merging from the branch to the trunk):
+ # binfile.dat) File added on branch, not on trunk.
+ # File should be marked for addition.
+ # brmod) File modified on branch, not on trunk.
+ # File should be copied over to trunk (no merging is needed).
+ # brmod-trmod) File modified on branch, also on trunk.
+ # This is a conflict. Present the user with both files and
+ # let them figure it out.
+ # brmod-wdmod) File modified on branch, not modified in the trunk
+ # repository, but modified in the (trunk) working directory.
+ # This is also a conflict.
mkdir ${CVSROOT_DIRNAME}/first-dir
mkdir 1; cd 1
dotest binfiles2-1 "${testcvs} -q co first-dir" ''
cd first-dir
+
+ # The most important thing here is that binfile, binfile2, &c
+ # each be distinct from each other. We also make sure to include
+ # a few likely end-of-line patterns to make sure nothing is
+ # being munged as if in text mode.
+ awk 'BEGIN { printf "%c%c%c%c%c%c", 2, 10, 137, 0, 13, 10 }' \
+ </dev/null >../binfile
+ cat ../binfile ../binfile >../binfile2
+ cat ../binfile2 ../binfile >../binfile3
+
# FIXCVS: unless a branch has at least one file on it,
- # tag_check_valid won't know it exists. So creating a
- # file here is a workaround.
- touch dummy
- dotest binfiles2-1a "${testcvs} add dummy" \
-"${PROG} [a-z]*: scheduling file .dummy. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
- dotest binfiles2-1b "${testcvs} -q ci -m add-it" \
-"RCS file: ${TESTDIR}/cvsroot/first-dir/dummy,v
-done
-Checking in dummy;
-${TESTDIR}/cvsroot/first-dir/dummy,v <-- dummy
+ # tag_check_valid won't know it exists. So if brmod didn't
+ # exist, we would have to invent it.
+ cp ../binfile brmod
+ cp ../binfile brmod-trmod
+ cp ../binfile brmod-wdmod
+ dotest binfiles2-1a \
+"${testcvs} add -kb brmod brmod-trmod brmod-wdmod" \
+"${PROG} [a-z]*: scheduling file .brmod. for addition
+${PROG} [a-z]*: scheduling file .brmod-trmod. for addition
+${PROG} [a-z]*: scheduling file .brmod-wdmod. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
+ dotest binfiles2-1b "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/brmod,v
+done
+Checking in brmod;
+${TESTDIR}/cvsroot/first-dir/brmod,v <-- brmod
+initial revision: 1\.1
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v
+done
+Checking in brmod-trmod;
+${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod
+initial revision: 1\.1
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v
+done
+Checking in brmod-wdmod;
+${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v <-- brmod-wdmod
initial revision: 1\.1
done"
- dotest binfiles2-2 "${testcvs} -q tag -b br" 'T dummy'
+ dotest binfiles2-2 "${testcvs} -q tag -b br" 'T brmod
+T brmod-trmod
+T brmod-wdmod'
dotest binfiles2-3 "${testcvs} -q update -r br" ''
- awk 'BEGIN { printf "%c%c%c%c%c%c", 2, 10, 137, 0, 13, 10 }' \
- </dev/null >../binfile
cp ../binfile binfile.dat
dotest binfiles2-4 "${testcvs} add -kb binfile.dat" \
"${PROG} [a-z]*: scheduling file .binfile\.dat. for addition on branch .br.
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
- dotest binfiles2-5 "${testcvs} -q ci -m add-it" \
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ cp ../binfile2 brmod
+ cp ../binfile2 brmod-trmod
+ cp ../binfile2 brmod-wdmod
+ dotest binfiles2-5 "${testcvs} -q ci -m br-changes" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/Attic/binfile\.dat,v
done
Checking in binfile\.dat;
${TESTDIR}/cvsroot/first-dir/Attic/binfile\.dat,v <-- binfile\.dat
new revision: 1\.1\.2\.1; previous revision: 1\.1
+done
+Checking in brmod;
+${TESTDIR}/cvsroot/first-dir/brmod,v <-- brmod
+new revision: 1\.1\.2\.1; previous revision: 1\.1
+done
+Checking in brmod-trmod;
+${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod
+new revision: 1\.1\.2\.1; previous revision: 1\.1
+done
+Checking in brmod-wdmod;
+${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v <-- brmod-wdmod
+new revision: 1\.1\.2\.1; previous revision: 1\.1
done"
dotest binfiles2-6 "${testcvs} -q update -A" \
-"${PROG} [a-z]*: warning: binfile\.dat is not (any longer) pertinent"
+"${PROG} [a-z]*: warning: binfile\.dat is not (any longer) pertinent
+[UP] brmod
+[UP] brmod-trmod
+[UP] brmod-wdmod"
dotest_fail binfiles2-7 "test -f binfile.dat" ''
- dotest binfiles2-8 "${testcvs} -q update -j br" "U binfile.dat"
+ dotest binfiles2-7-brmod "cmp ../binfile brmod"
+ cp ../binfile3 brmod-trmod
+ dotest binfiles2-7a "${testcvs} -q ci -m tr-modify" \
+"Checking in brmod-trmod;
+${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod
+new revision: 1\.2; previous revision: 1\.1
+done"
+ cp ../binfile3 brmod-wdmod
+
+ dotest binfiles2-8 "${testcvs} -q update -j br" \
+"U binfile\.dat
+U brmod
+${PROG} [a-z]*: nonmergeable file needs merge
+${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-trmod
+${PROG} [a-z]*: file from working directory is now in .#brmod-trmod.1.2
+C brmod-trmod
+M brmod-wdmod
+${PROG} [a-z]*: nonmergeable file needs merge
+${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-wdmod
+${PROG} [a-z]*: file from working directory is now in .#brmod-wdmod.1.1
+C brmod-wdmod"
+
dotest binfiles2-9 "cmp ../binfile binfile.dat"
+ dotest binfiles2-9-brmod "cmp ../binfile2 brmod"
+ dotest binfiles2-9-brmod-trmod "cmp ../binfile2 brmod-trmod"
+ dotest binfiles2-9-brmod-trmod "cmp ../binfile2 brmod-wdmod"
+ dotest binfiles2-9a-brmod-trmod "cmp ../binfile3 .#brmod-trmod.1.2"
+ dotest binfiles2-9a-brmod-wdmod "cmp ../binfile3 .#brmod-wdmod.1.1"
+
+ # Test that everything was properly scheduled.
+ dotest binfiles2-10 "${testcvs} -q ci -m checkin" \
+"Checking in binfile\.dat;
+${TESTDIR}/cvsroot/first-dir/binfile\.dat,v <-- binfile\.dat
+new revision: 1\.2; previous revision: 1\.1
+done
+Checking in brmod;
+${TESTDIR}/cvsroot/first-dir/brmod,v <-- brmod
+new revision: 1\.2; previous revision: 1\.1
+done
+Checking in brmod-trmod;
+${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod
+new revision: 1\.3; previous revision: 1\.2
+done
+Checking in brmod-wdmod;
+${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v <-- brmod-wdmod
+new revision: 1\.2; previous revision: 1\.1
+done"
+
+ dotest_fail binfiles2-o1 "${testcvs} -q admin -o :1.2 brmod-trmod" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v
+deleting revision 1\.2
+${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v: can't remove branch point 1\.1
+${PROG} [a-z]*: cannot modify RCS file for .brmod-trmod."
+ dotest binfiles2-o2 "${testcvs} -q admin -o 1.1.2.1: brmod-trmod" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v
+deleting revision 1\.1\.2\.1
+done"
+ dotest binfiles2-o3 "${testcvs} -q admin -o :1.2 brmod-trmod" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v
+deleting revision 1\.2
+deleting revision 1\.1
+done"
+ dotest binfiles2-o4 "${testcvs} -q log -N brmod-trmod" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v
+Working file: brmod-trmod
+head: 1\.3
+branch:
+locks: strict
+access list:
+keyword substitution: b
+total revisions: 1; selected revisions: 1
+description:
+----------------------------
+revision 1\.3
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
+checkin
+============================================================================="
+ cd ..
+ cd ..
+
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ rm -r 1
+ ;;
+
+ mcopy)
+ # See comment at "mwrap" test for list of other wrappers tests.
+ # Test cvs's ability to handle nonmergeable files specified with
+ # -m 'COPY' in wrappers. Similar to the binfiles2 test,
+ # which tests the same thing for binary files
+ # (which are non-mergeable in the same sense).
+ #
+ # Cases (we are merging from the branch to the trunk):
+ # brmod) File modified on branch, not on trunk.
+ # File should be copied over to trunk (no merging is needed).
+ # brmod-trmod) File modified on branch, also on trunk.
+ # This is a conflict. Present the user with both files and
+ # let them figure it out.
+ # brmod-wdmod) File modified on branch, not modified in the trunk
+ # repository, but modified in the (trunk) working directory.
+ # This is also a conflict.
+
+ # For the moment, remote CVS can't pass wrappers from CVSWRAPPERS
+ # (see wrap_send). So skip these tests for remote.
+ if test "x$remote" = xno; then
+
+ mkdir ${CVSROOT_DIRNAME}/first-dir
+ mkdir 1; cd 1
+ dotest mcopy-1 "${testcvs} -q co first-dir" ''
+ cd first-dir
+
+ # FIXCVS: unless a branch has at least one file on it,
+ # tag_check_valid won't know it exists. So if brmod didn't
+ # exist, we would have to invent it.
+ echo 'brmod initial contents' >brmod
+ echo 'brmod-trmod initial contents' >brmod-trmod
+ echo 'brmod-wdmod initial contents' >brmod-wdmod
+ echo "* -m 'COPY'" >.cvswrappers
+ dotest mcopy-1a \
+"${testcvs} add .cvswrappers brmod brmod-trmod brmod-wdmod" \
+"${PROG} [a-z]*: scheduling file .\.cvswrappers. for addition
+${PROG} [a-z]*: scheduling file .brmod. for addition
+${PROG} [a-z]*: scheduling file .brmod-trmod. for addition
+${PROG} [a-z]*: scheduling file .brmod-wdmod. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
+ dotest mcopy-1b "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/\.cvswrappers,v
+done
+Checking in \.cvswrappers;
+${TESTDIR}/cvsroot/first-dir/\.cvswrappers,v <-- \.cvswrappers
+initial revision: 1\.1
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/brmod,v
+done
+Checking in brmod;
+${TESTDIR}/cvsroot/first-dir/brmod,v <-- brmod
+initial revision: 1\.1
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-trmod,v
+done
+Checking in brmod-trmod;
+${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod
+initial revision: 1\.1
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v
+done
+Checking in brmod-wdmod;
+${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v <-- brmod-wdmod
+initial revision: 1\.1
+done"
+
+ # NOTE: .cvswrappers files are broken (see comment in
+ # src/wrapper.c). So doing everything via the environment
+ # variable is a workaround. Better would be to test them
+ # both.
+ CVSWRAPPERS="* -m 'COPY'"
+ export CVSWRAPPERS
+ dotest mcopy-2 "${testcvs} -q tag -b br" 'T \.cvswrappers
+T brmod
+T brmod-trmod
+T brmod-wdmod'
+ dotest mcopy-3 "${testcvs} -q update -r br" ''
+ echo 'modify brmod on br' >brmod
+ echo 'modify brmod-trmod on br' >brmod-trmod
+ echo 'modify brmod-wdmod on br' >brmod-wdmod
+ dotest mcopy-5 "${testcvs} -q ci -m br-changes" \
+"Checking in brmod;
+${TESTDIR}/cvsroot/first-dir/brmod,v <-- brmod
+new revision: 1\.1\.2\.1; previous revision: 1\.1
+done
+Checking in brmod-trmod;
+${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod
+new revision: 1\.1\.2\.1; previous revision: 1\.1
+done
+Checking in brmod-wdmod;
+${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v <-- brmod-wdmod
+new revision: 1\.1\.2\.1; previous revision: 1\.1
+done"
+ dotest mcopy-6 "${testcvs} -q update -A" \
+"[UP] brmod
+[UP] brmod-trmod
+[UP] brmod-wdmod"
+ dotest mcopy-7 "cat brmod brmod-trmod brmod-wdmod" \
+"brmod initial contents
+brmod-trmod initial contents
+brmod-wdmod initial contents"
+
+ echo 'modify brmod-trmod again on trunk' >brmod-trmod
+ dotest mcopy-7a "${testcvs} -q ci -m tr-modify" \
+"Checking in brmod-trmod;
+${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod
+new revision: 1\.2; previous revision: 1\.1
+done"
+ echo 'modify brmod-wdmod in working dir' >brmod-wdmod
+
+ dotest mcopy-8 "${testcvs} -q update -j br" \
+"U brmod
+${PROG} [a-z]*: nonmergeable file needs merge
+${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-trmod
+${PROG} [a-z]*: file from working directory is now in .#brmod-trmod.1.2
+C brmod-trmod
+M brmod-wdmod
+${PROG} [a-z]*: nonmergeable file needs merge
+${PROG} [a-z]*: revision 1.1.2.1 from repository is now in brmod-wdmod
+${PROG} [a-z]*: file from working directory is now in .#brmod-wdmod.1.1
+C brmod-wdmod"
+
+ dotest mcopy-9 "cat brmod brmod-trmod brmod-wdmod" \
+"modify brmod on br
+modify brmod-trmod on br
+modify brmod-wdmod on br"
+ dotest mcopy-9a "cat .#brmod-trmod.1.2 .#brmod-wdmod.1.1" \
+"modify brmod-trmod again on trunk
+modify brmod-wdmod in working dir"
+
+ # Test that everything was properly scheduled.
+ dotest mcopy-10 "${testcvs} -q ci -m checkin" \
+"Checking in brmod;
+${TESTDIR}/cvsroot/first-dir/brmod,v <-- brmod
+new revision: 1\.2; previous revision: 1\.1
+done
+Checking in brmod-trmod;
+${TESTDIR}/cvsroot/first-dir/brmod-trmod,v <-- brmod-trmod
+new revision: 1\.3; previous revision: 1\.2
+done
+Checking in brmod-wdmod;
+${TESTDIR}/cvsroot/first-dir/brmod-wdmod,v <-- brmod-wdmod
+new revision: 1\.2; previous revision: 1\.1
+done"
cd ..
cd ..
rm -rf ${CVSROOT_DIRNAME}/first-dir
rm -r 1
+ unset CVSWRAPPERS
+
+ fi # end of tests to be skipped for remote
+
;;
binwrap)
# Test the ability to specify binary-ness based on file name.
- # We could also be testing the ability to use the other
- # ways to specify a wrapper (CVSROOT/cvswrappers, etc.).
+ # See "mwrap" for a list of other wrappers tests.
mkdir dir-to-import
cd dir-to-import
@@ -5394,9 +7372,311 @@ File: foo\.exe Status: Up-to-date
rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
+ binwrap2)
+ # Test the ability to specify binary-ness based on file name.
+ # See "mwrap" for a list of other wrappers tests.
+
+ mkdir dir-to-import
+ cd dir-to-import
+ touch foo.c foo.exe
+
+ # Specify that all files are binary except *.c.
+ # The order seems to matter, with the earlier rules taking
+ # precedence. I'm not sure whether that is good or not,
+ # but it is the current behavior.
+ if ${testcvs} import -m message -I ! \
+ -W "*.c -k 'o'" -W "* -k 'b'" \
+ first-dir tag1 tag2 >>${LOGFILE}; then
+ pass binwrap2-1
+ else
+ fail binwrap2-1
+ fi
+ cd ..
+ rm -r dir-to-import
+ dotest binwrap2-2 "${testcvs} -q co first-dir" 'U first-dir/foo.c
+U first-dir/foo.exe'
+ dotest binwrap2-3 "${testcvs} -q status first-dir" \
+"===================================================================
+File: foo\.c Status: Up-to-date
+
+ Working revision: 1\.1\.1\.1.*
+ Repository revision: 1\.1\.1\.1 ${TESTDIR}/cvsroot/first-dir/foo\.c,v
+ Sticky Tag: (none)
+ Sticky Date: (none)
+ Sticky Options: -ko
+
+===================================================================
+File: foo\.exe Status: Up-to-date
+
+ Working revision: 1\.1\.1\.1.*
+ Repository revision: 1\.1\.1\.1 ${TESTDIR}/cvsroot/first-dir/foo\.exe,v
+ Sticky Tag: (none)
+ Sticky Date: (none)
+ Sticky Options: -kb"
+ rm -r first-dir
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
+ binwrap3)
+ # Test communication of file-specified -k wrappers between
+ # client and server, in `import':
+ #
+ # 1. Set up a directory tree, populate it with files.
+ # 2. Give each directory a different .cvswrappers file.
+ # 3. Give the server its own .cvswrappers file.
+ # 4. Import the whole tree, see if the right files got set
+ # to binary.
+ #
+ # The tree has a top ("0th") level, and two subdirs, sub1/
+ # and sub2/; sub2/ contains directory subsub/. Every
+ # directory has a .cvswrappers file as well as regular
+ # files.
+ #
+ # In the file names, "foo-b.*" should end up binary, and
+ # "foo-t.*" should end up text. Don't worry about the two
+ # letter extensions; they're just there to help me keep
+ # things straight.
+ #
+ # Here's the directory tree:
+ #
+ # ./
+ # .cvswrappers
+ # foo-b.c0
+ # foo-b.sb
+ # foo-t.c1
+ # foo-t.st
+ #
+ # sub1/ sub2/
+ # .cvswrappers .cvswrappers
+ # foo-b.c1 foo-b.sb
+ # foo-b.sb foo-b.st
+ # foo-t.c0 foo-t.c0
+ # foo-t.st foo-t.c1
+ # foo-t.c2
+ # foo-t.c3
+ #
+ # subsub/
+ # .cvswrappers
+ # foo-b.c3
+ # foo-b.sb
+ # foo-t.c0
+ # foo-t.c1
+ # foo-t.c2
+ # foo-t.st
+
+ binwrap3_line1="This is a test file "
+ binwrap3_line2="containing little of use "
+ binwrap3_line3="except this non-haiku"
+
+ binwrap3_text="${binwrap3_line1}${binwrap3_line2}${binwrap3_line3}"
+
+ cd ${TESTDIR}
+
+ # On Windows, we can't check out CVSROOT, because the case
+ # insensitivity means that this conflicts with cvsroot.
+ mkdir wnt
+ cd wnt
+
+ mkdir binwrap3 # the 0th dir
+ mkdir binwrap3/sub1
+ mkdir binwrap3/sub2
+ mkdir binwrap3/sub2/subsub
+
+ echo "*.c0 -k 'b'" > binwrap3/.cvswrappers
+ echo "whatever -k 'b'" >> binwrap3/.cvswrappers
+ echo ${binwrap3_text} > binwrap3/foo-b.c0
+ echo ${binwrap3_text} > binwrap3/foo-b.sb
+ echo ${binwrap3_text} > binwrap3/foo-t.c1
+ echo ${binwrap3_text} > binwrap3/foo-t.st
+
+ echo "*.c1 -k 'b'" > binwrap3/sub1/.cvswrappers
+ echo "whatever -k 'b'" >> binwrap3/sub1/.cvswrappers
+ echo ${binwrap3_text} > binwrap3/sub1/foo-b.c1
+ echo ${binwrap3_text} > binwrap3/sub1/foo-b.sb
+ echo ${binwrap3_text} > binwrap3/sub1/foo-t.c0
+ echo ${binwrap3_text} > binwrap3/sub1/foo-t.st
+
+ echo "*.st -k 'b'" > binwrap3/sub2/.cvswrappers
+ echo ${binwrap3_text} > binwrap3/sub2/foo-b.sb
+ echo ${binwrap3_text} > binwrap3/sub2/foo-b.st
+ echo ${binwrap3_text} > binwrap3/sub2/foo-t.c0
+ echo ${binwrap3_text} > binwrap3/sub2/foo-t.c1
+ echo ${binwrap3_text} > binwrap3/sub2/foo-t.c2
+ echo ${binwrap3_text} > binwrap3/sub2/foo-t.c3
+
+ echo "*.c3 -k 'b'" > binwrap3/sub2/subsub/.cvswrappers
+ echo "foo -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers
+ echo "c0* -k 'b'" >> binwrap3/sub2/subsub/.cvswrappers
+ echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-b.c3
+ echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-b.sb
+ echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c0
+ echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c1
+ echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.c2
+ echo ${binwrap3_text} > binwrap3/sub2/subsub/foo-t.st
+
+ # Now set up CVSROOT/cvswrappers, the easy way:
+ dotest binwrap3-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
+ cd CVSROOT
+ # This destroys anything currently in cvswrappers, but
+ # presumably other tests will take care of it themselves if
+ # they use cvswrappers:
+ echo "foo*.sb -k 'b'" > cvswrappers
+ dotest binwrap3-2 "${testcvs} -q ci -m cvswrappers-mod" \
+"Checking in cvswrappers;
+${TESTDIR}/cvsroot/CVSROOT/cvswrappers,v <-- cvswrappers
+new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
+done
+${PROG} [a-z]*: Rebuilding administrative file database"
+ cd ..
+
+ # Avoid environmental interference
+ CVSWRAPPERS_SAVED=${CVSWRAPPERS}
+ unset CVSWRAPPERS
+
+ # Do the import
+ cd binwrap3
+ # Not importing .cvswrappers tests whether the client is really
+ # letting the server know "honestly" whether the file is binary,
+ # rather than just letting the server see the .cvswrappers file.
+ dotest binwrap3-2a \
+"${testcvs} import -m . -I .cvswrappers binwrap3 tag1 tag2" \
+"[NI] ${DOTSTAR}"
+
+ # OK, now test "cvs add".
+ cd ..
+ rm -r binwrap3
+ dotest binwrap3-2b "${testcvs} co binwrap3" "${DOTSTAR}"
+ cd binwrap3
+ cd sub2
+ echo "*.newbin -k 'b'" > .cvswrappers
+ echo .cvswrappers >.cvsignore
+ echo .cvsignore >>.cvsignore
+ touch file1.newbin file1.txt
+ dotest binwrap3-2c "${testcvs} add file1.newbin file1.txt" \
+"${PROG} [a-z]*: scheduling file .file1\.newbin. for addition
+${PROG} [a-z]*: scheduling file .file1\.txt. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
+ dotest binwrap3-2d "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/binwrap3/sub2/file1\.newbin,v
+done
+Checking in file1\.newbin;
+${TESTDIR}/cvsroot/binwrap3/sub2/file1\.newbin,v <-- file1\.newbin
+initial revision: 1\.1
+done
+RCS file: ${TESTDIR}/cvsroot/binwrap3/sub2/file1\.txt,v
+done
+Checking in file1\.txt;
+${TESTDIR}/cvsroot/binwrap3/sub2/file1\.txt,v <-- file1\.txt
+initial revision: 1\.1
+done"
+ cd ..
+
+ # Now check out the module and see which files are binary.
+ cd ..
+ rm -r binwrap3
+ dotest binwrap3-3 "${testcvs} co binwrap3" "${DOTSTAR}"
+ cd binwrap3
+
+ # Running "cvs status" and matching output is too
+ # error-prone, too likely to falsely fail. Instead, we'll
+ # just grep the Entries lines:
+
+ dotest binwrap3-top1 "grep foo-b.c0 ./CVS/Entries" \
+ "/foo-b.c0/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
+
+ dotest binwrap3-top2 "grep foo-b.sb ./CVS/Entries" \
+ "/foo-b.sb/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
+
+ dotest binwrap3-top3 "grep foo-t.c1 ./CVS/Entries" \
+ "/foo-t.c1/1.1.1.1/[A-Za-z0-9 :]*//"
+
+ dotest binwrap3-top4 "grep foo-t.st ./CVS/Entries" \
+ "/foo-t.st/1.1.1.1/[A-Za-z0-9 :]*//"
+
+ dotest binwrap3-sub1-1 "grep foo-b.c1 sub1/CVS/Entries" \
+ "/foo-b.c1/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
+
+ dotest binwrap3-sub1-2 "grep foo-b.sb sub1/CVS/Entries" \
+ "/foo-b.sb/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
+
+ dotest binwrap3-sub1-3 "grep foo-t.c0 sub1/CVS/Entries" \
+ "/foo-t.c0/1.1.1.1/[A-Za-z0-9 :]*//"
+
+ dotest binwrap3-sub1-4 "grep foo-t.st sub1/CVS/Entries" \
+ "/foo-t.st/1.1.1.1/[A-Za-z0-9 :]*//"
+
+ dotest binwrap3-sub2-1 "grep foo-b.sb sub2/CVS/Entries" \
+ "/foo-b.sb/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
+
+ dotest binwrap3-sub2-2 "grep foo-b.st sub2/CVS/Entries" \
+ "/foo-b.st/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
+
+ dotest binwrap3-sub2-3 "grep foo-t.c0 sub2/CVS/Entries" \
+ "/foo-t.c0/1.1.1.1/[A-Za-z0-9 :]*//"
+
+ dotest binwrap3-sub2-4 "grep foo-t.c1 sub2/CVS/Entries" \
+ "/foo-t.c1/1.1.1.1/[A-Za-z0-9 :]*//"
+
+ dotest binwrap3-sub2-5 "grep foo-t.c2 sub2/CVS/Entries" \
+ "/foo-t.c2/1.1.1.1/[A-Za-z0-9 :]*//"
+
+ dotest binwrap3-sub2-6 "grep foo-t.c3 sub2/CVS/Entries" \
+ "/foo-t.c3/1.1.1.1/[A-Za-z0-9 :]*//"
+
+ dotest binwrap3-subsub1 "grep foo-b.c3 sub2/subsub/CVS/Entries" \
+ "/foo-b.c3/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
+
+ dotest binwrap3-subsub2 "grep foo-b.sb sub2/subsub/CVS/Entries" \
+ "/foo-b.sb/1.1.1.1/[A-Za-z0-9 :]*/-kb/"
+
+ dotest binwrap3-subsub3 "grep foo-t.c0 sub2/subsub/CVS/Entries" \
+ "/foo-t.c0/1.1.1.1/[A-Za-z0-9 :]*//"
+
+ dotest binwrap3-subsub4 "grep foo-t.c1 sub2/subsub/CVS/Entries" \
+ "/foo-t.c1/1.1.1.1/[A-Za-z0-9 :]*//"
+
+ dotest binwrap3-subsub5 "grep foo-t.c2 sub2/subsub/CVS/Entries" \
+ "/foo-t.c2/1.1.1.1/[A-Za-z0-9 :]*//"
+
+ dotest binwrap3-subsub6 "grep foo-t.st sub2/subsub/CVS/Entries" \
+ "/foo-t.st/1.1.1.1/[A-Za-z0-9 :]*//"
+
+ dotest binwrap3-sub2-add1 "grep file1.newbin sub2/CVS/Entries" \
+ "/file1.newbin/1.1/[A-Za-z0-9 :]*/-kb/"
+ dotest binwrap3-sub2-add2 "grep file1.txt sub2/CVS/Entries" \
+ "/file1.txt/1.1/[A-Za-z0-9 :]*//"
+
+ # Restore and clean up
+ cd ..
+ rm -r binwrap3 CVSROOT
+ cd ..
+ rm -r wnt
+ rm -rf ${CVSROOT_DIRNAME}/binwrap3
+ CVSWRAPPERS=${CVSWRAPPERS_SAVED}
+ ;;
+
mwrap)
- # Tests relating to the -m wrappers options. -k tests are in
- # binwrap and -t/-f tests haven't been written yet.
+ # Tests of various wrappers features:
+ # -m 'COPY' and cvs update: mwrap
+ # -m 'COPY' and joining: mcopy
+ # -k: binwrap, binwrap2
+ # -t/-f: hasn't been written yet.
+ #
+ # Tests of different ways of specifying wrappers:
+ # CVSROOT/cvswrappers: mwrap
+ # -W: binwrap, binwrap2
+ # .cvswrappers in working directory, local: mcopy
+ # CVSROOT/cvswrappers, .cvswrappers remote: binwrap3
+ # CVSWRAPPERS environment variable: mcopy
+
+ # This test is similar to binfiles-con1; -m 'COPY' specifies
+ # non-mergeableness the same way that -kb does.
+
+ # On Windows, we can't check out CVSROOT, because the case
+ # insensitivity means that this conflicts with cvsroot.
+ mkdir wnt
+ cd wnt
+
dotest mwrap-c1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
cd CVSROOT
echo "* -m 'COPY'" >>cvswrappers
@@ -5416,7 +7696,7 @@ ${PROG} [a-z]*: Rebuilding administrative file database"
touch aa
dotest mwrap-3 "${testcvs} add aa" \
"${PROG} [a-z]*: scheduling file .aa. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest mwrap-4 "${testcvs} -q ci -m add" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/aa,v
done
@@ -5438,14 +7718,14 @@ done"
cd m1/first-dir
echo "changed in m1" >aa
dotest_fail mwrap-7 "${testcvs} -nq update" "C aa"
- dotest_fail mwrap-8 "${testcvs} -q update" \
-"${PROG} [a-z]*: A -m .COPY. wrapper is specified
-${PROG} [a-z]*: but file aa needs merge
-${PROG} \[[a-z]* aborted\]: You probably want to avoid -m .COPY. wrappers"
- # Under the old, dangerous behavior, this would have been
- # "changed in m2" -- that is, the changes in the working directory
- # would have been clobbered (!).
- dotest mwrap-9 "cat aa" "changed in m1"
+ dotest mwrap-8 "${testcvs} -q update" \
+"U aa
+${PROG} [a-z]*: nonmergeable file needs merge
+${PROG} [a-z]*: revision 1\.2 from repository is now in aa
+${PROG} [a-z]*: file from working directory is now in \.#aa\.1\.1
+C aa"
+ dotest mwrap-9 "cat aa" "changed in m2"
+ dotest mwrap-10 "cat .#aa.1.1" "changed in m1"
cd ../..
cd CVSROOT
echo '# comment out' >cvswrappers
@@ -5458,11 +7738,26 @@ ${PROG} [a-z]*: Rebuilding administrative file database"
cd ..
rm -r CVSROOT
rm -r m1 m2
+ cd ..
+ rm -r wnt
rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
info)
- # Test CVS's ability to handle *info files.
+ # Administrative file tests.
+ # Here is a list of where each administrative file is tested:
+ # loginfo: info
+ # modules: modules, modules2, modules3
+ # cvsignore: ignore
+ # verifymsg: info
+ # cvswrappers: mwrap
+ # config: config
+
+ # On Windows, we can't check out CVSROOT, because the case
+ # insensitivity means that this conflicts with cvsroot.
+ mkdir wnt
+ cd wnt
+
dotest info-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
cd CVSROOT
echo "ALL sh -c \"echo x\${=MYENV}\${=OTHER}y\${=ZEE}=\$USER=\$CVSROOT= >>$TESTDIR/testlog; cat >/dev/null\"" > loginfo
@@ -5478,7 +7773,7 @@ ${PROG} [a-z]*: Rebuilding administrative file database"
# with "cvs init".
: dotest info-2 "${testcvs} add loginfo" \
"${PROG}"' [a-z]*: scheduling file `loginfo'"'"' for addition
-'"${PROG}"' [a-z]*: use '"'"'cvs commit'"'"' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
dotest info-3 "${testcvs} -q ci -m new-loginfo" \
"Checking in loginfo;
@@ -5494,7 +7789,7 @@ ${PROG} [a-z]*: Rebuilding administrative file database"
touch file1
dotest info-6 "${testcvs} add file1" \
"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
echo "cvs -s OTHER=not-this -s MYENV=env-" >>$HOME/.cvsrc
dotest info-6a "${testcvs} -q -s OTHER=value ci -m add-it" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
@@ -5511,7 +7806,7 @@ ${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
new revision: 1\.2; previous revision: 1\.1
done"
cd ..
- dotest info-9 "cat $TESTDIR/testlog" "xenv-valueyz=[a-z0-9@][a-z0-9@]*=${TESTDIR}/cvsroot="
+ dotest info-9 "cat $TESTDIR/testlog" "xenv-valueyz=${username}=${TESTDIR}/cvsroot="
dotest info-10 "cat $TESTDIR/testlog2" 'first-dir file1,NONE,1.1
first-dir 1.1
first-dir file1
@@ -5534,7 +7829,7 @@ ${PROG} [a-z]*: Rebuilding administrative file database"
# Now test verifymsg
cat >${TESTDIR}/vscript <<EOF
-#!/bin/sh
+#!${TESTSHELL}
if head -1 < \$1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
exit 0
else
@@ -5598,12 +7893,58 @@ ${PROG} [a-z]*: Rebuilding administrative file database"
else
fail info-cleanup-2
fi
+ cd ..
+ rm -r wnt
rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
+ config)
+ # Tests of the CVSROOT/config file. See the comment at the
+ # "info" tests for a full list of administrative file tests.
+
+ # On Windows, we can't check out CVSROOT, because the case
+ # insensitivity means that this conflicts with cvsroot.
+ mkdir wnt
+ cd wnt
+
+ dotest config-1 "${testcvs} -q co CVSROOT" "U CVSROOT/${DOTSTAR}"
+ cd CVSROOT
+ echo 'bogus line' >config
+ dotest config-3 "${testcvs} -q ci -m change-to-bogus-line" \
+"Checking in config;
+${TESTDIR}/cvsroot/CVSROOT/config,v <-- config
+new revision: 1\.2; previous revision: 1\.1
+done
+${PROG} [a-z]*: Rebuilding administrative file database"
+ echo 'BogusOption=yes' >config
+ dotest config-4 "${testcvs} -q ci -m change-to-bogus-opt" \
+"${PROG} [a-z]*: syntax error in ${TESTDIR}/cvsroot/CVSROOT/config: line 'bogus line' is missing '='
+Checking in config;
+${TESTDIR}/cvsroot/CVSROOT/config,v <-- config
+new revision: 1\.3; previous revision: 1\.2
+done
+${PROG} [a-z]*: Rebuilding administrative file database"
+ echo '# No config is a good config' > config
+ dotest config-5 "${testcvs} -q ci -m change-to-comment" \
+"${PROG} [a-z]*: ${TESTDIR}/cvsroot/CVSROOT/config: unrecognized keyword 'BogusOption'
+Checking in config;
+${TESTDIR}/cvsroot/CVSROOT/config,v <-- config
+new revision: 1\.4; previous revision: 1\.3
+done
+${PROG} [a-z]*: Rebuilding administrative file database"
+ dotest config-6 "${testcvs} -q update" ''
+
+ cd ..
+ rm -r CVSROOT
+ cd ..
+ rm -r wnt
+ ;;
+
serverpatch)
# Test remote CVS handling of unpatchable files. This isn't
# much of a test for local CVS.
+ # We test this with some keyword expansion games, but the situation
+ # also arises if the user modifies the file while CVS is running.
mkdir ${CVSROOT_DIRNAME}/first-dir
mkdir 1
cd 1
@@ -5616,7 +7957,7 @@ ${PROG} [a-z]*: Rebuilding administrative file database"
echo '1' >> file1
dotest serverpatch-2 "${testcvs} add file1" \
"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
dotest serverpatch-3 "${testcvs} -q commit -m add" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
@@ -5667,10 +8008,14 @@ U file1'
log)
# Test selecting revisions with cvs log.
# See also log2 tests for more tests.
- # See also rcs tests, for -d option to log.
# See also branches-14.3 for logging with a branch off of a branch.
# See also multibranch-14 for logging with several branches off the
# same branchpoint.
+ # Tests of each option to cvs log:
+ # -h: admin-19a-log
+ # -N: log, log2, admin-19a-log
+ # -b, -r: log
+ # -d: rcs
# Check in a file with a few revisions and branches.
mkdir ${CVSROOT_DIRNAME}/first-dir
@@ -5679,15 +8024,23 @@ U file1'
echo 'first revision' > file1
dotest log-2 "${testcvs} add file1" \
"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
-
- dotest log-3 "${testcvs} -q commit -m 1" \
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
+
+ # While we're at it, check multi-line comments, input from file,
+ # and trailing whitespace trimming
+ echo 'line 1 ' >${TESTDIR}/comment.tmp
+ echo ' ' >>${TESTDIR}/comment.tmp
+ echo 'line 2 ' >>${TESTDIR}/comment.tmp
+ echo ' ' >>${TESTDIR}/comment.tmp
+ echo ' ' >>${TESTDIR}/comment.tmp
+ dotest log-3 "${testcvs} -q commit -F ${TESTDIR}/comment.tmp" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
done
Checking in file1;
${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
initial revision: 1\.1
done"
+ rm -f ${TESTDIR}/comment.tmp
echo 'second revision' > file1
dotest log-4 "${testcvs} -q ci -m2 file1" \
@@ -5742,7 +8095,9 @@ revision'
log_lines=" lines: ${PLUS}1 -1"
log_rev1="${log_dash} 1\.1
${log_date}
-1"
+line 1
+
+line 2"
log_rev2="${log_dash} 1\.2
${log_date}${log_lines}
branches: 1\.2\.2;
@@ -5886,6 +8241,29 @@ ${log_rev2}
${log_rev1}
${log_trailer}"
+ dotest log-o0 "${testcvs} admin -o 1.2.2.2:: file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done"
+ dotest log-o1 "${testcvs} admin -o ::1.2.2.1 file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done"
+ dotest log-o2 "${testcvs} admin -o 1.2.2.1:: file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+deleting revision 1\.2\.2\.2
+done"
+ dotest log-o3 "${testcvs} log file1" \
+"${log_header}
+${log_tags}
+${log_header2}
+total revisions: 4; selected revisions: 4
+description:
+${log_rev3}
+${log_rev2}
+${log_rev1}
+${log_rev1b}
+${log_trailer}"
+ dotest log-o4 "${testcvs} -q update -p -r 1.2.2.1 file1" \
+"first branch revision"
cd ..
rm -r first-dir
rm -rf ${CVSROOT_DIRNAME}/first-dir
@@ -5894,10 +8272,6 @@ ${log_trailer}"
log2)
# More "cvs log" tests, for example the file description.
- # Setting the file description doesn't yet work client/server, so
- # skip these tests for remote.
- if test "x$remote" = xno; then
-
# Check in a file
mkdir ${CVSROOT_DIRNAME}/first-dir
dotest log2-1 "${testcvs} -q co first-dir" ''
@@ -5905,7 +8279,7 @@ ${log_trailer}"
echo 'first revision' > file1
dotest log2-2 "${testcvs} add -m file1-is-for-testing file1" \
"${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
-'"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
+'"${PROG}"' [a-z]*: use .'"${PROG}"' commit. to add this file permanently'
dotest log2-3 "${testcvs} -q commit -m 1" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
done
@@ -5913,6 +8287,10 @@ Checking in file1;
${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
initial revision: 1\.1
done"
+ # Setting the file description with add -m doesn't yet work
+ # client/server, so skip log2-4 for remote.
+ if test "x$remote" = xno; then
+
dotest log2-4 "${testcvs} log -N file1" "
RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
Working file: file1
@@ -5930,13 +8308,204 @@ date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
1
============================================================================="
+ fi # end of tests skipped for remote
+
+ dotest log2-5 "${testcvs} admin -t-change-description file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done"
+ dotest log2-6 "${testcvs} log -N file1" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+Working file: file1
+head: 1\.1
+branch:
+locks: strict
+access list:
+keyword substitution: kv
+total revisions: 1; selected revisions: 1
+description:
+change-description
+----------------------------
+revision 1\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
+1
+============================================================================="
+
+ # I believe that in Real Life (TM), this is broken for remote.
+ # That is, the filename in question must be the filename of a
+ # file on the server. It only happens to work here because the
+ # client machine and the server machine are one and the same.
+ echo 'longer description' >${TESTDIR}/descrip
+ echo 'with two lines' >>${TESTDIR}/descrip
+ dotest log2-7 "${testcvs} admin -t${TESTDIR}/descrip file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done"
+ dotest log2-8 "${testcvs} log -N file1" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+Working file: file1
+head: 1\.1
+branch:
+locks: strict
+access list:
+keyword substitution: kv
+total revisions: 1; selected revisions: 1
+description:
+longer description
+with two lines
+----------------------------
+revision 1\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
+1
+============================================================================="
+
+ # Reading the description from stdin is broken for remote.
+ # See comments in cvs.texinfo for a few more notes on this.
+ if test "x$remote" = xno; then
+
+ if echo change from stdin | ${testcvs} admin -t -q file1
+ then
+ pass log2-9
+ else
+ fail log2-9
+ fi
+ dotest log2-10 "${testcvs} log -N file1" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+Working file: file1
+head: 1\.1
+branch:
+locks: strict
+access list:
+keyword substitution: kv
+total revisions: 1; selected revisions: 1
+description:
+change from stdin
+----------------------------
+revision 1\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
+1
+============================================================================="
+
+ fi # end of tests skipped for remote
+
cd ..
+ rm ${TESTDIR}/descrip
rm -r first-dir
rm -rf ${CVSROOT_DIRNAME}/first-dir
- fi # end of tests skipped for remote
+ ;;
+
+ ann)
+ # Tests of "cvs annotate". See also basica-10.
+ mkdir 1; cd 1
+ dotest ann-1 "${testcvs} -q co -l ." ''
+ mkdir first-dir
+ dotest ann-2 "${testcvs} add first-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
+ cd first-dir
+ cat >file1 <<EOF
+this
+is
+the
+ancestral
+file
+EOF
+ dotest ann-3 "${testcvs} add file1" \
+"${PROG} [a-z]*: scheduling file .file1. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest ann-4 "${testcvs} -q ci -m add file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done
+Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+initial revision: 1\.1
+done"
+ cat >file1 <<EOF
+this
+is
+a
+file
+
+with
+a
+blank
+line
+EOF
+ dotest ann-5 "${testcvs} -q ci -m modify file1" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.2; previous revision: 1\.1
+done"
+ dotest ann-6 "${testcvs} -q tag -b br" "T file1"
+ cat >file1 <<EOF
+this
+is
+a
+trunk file
+
+with
+a
+blank
+line
+EOF
+ dotest ann-7 "${testcvs} -q ci -m modify file1" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.3; previous revision: 1\.2
+done"
+ dotest ann-8 "${testcvs} -q update -r br" "[UP] file1"
+ cat >file1 <<EOF
+this
+is
+a
+file
+
+with
+a
+blank
+line
+and some
+branched content
+EOF
+ dotest ann-9 "${testcvs} -q ci -m modify" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.2\.2\.1; previous revision: 1\.2
+done"
+ # Note that this annotates the trunk despite the presence
+ # of a sticky tag in the current directory. This is
+ # fairly bogus, but it is the longstanding behavior for
+ # whatever that is worth.
+ dotest ann-10 "${testcvs} ann" \
+"Annotations for file1
+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
+1\.1 (${username} *[0-9a-zA-Z-]*): this
+1\.1 (${username} *[0-9a-zA-Z-]*): is
+1\.2 (${username} *[0-9a-zA-Z-]*): a
+1\.3 (${username} *[0-9a-zA-Z-]*): trunk file
+1\.2 (${username} *[0-9a-zA-Z-]*):
+1\.2 (${username} *[0-9a-zA-Z-]*): with
+1\.2 (${username} *[0-9a-zA-Z-]*): a
+1\.2 (${username} *[0-9a-zA-Z-]*): blank
+1\.2 (${username} *[0-9a-zA-Z-]*): line"
+ dotest ann-11 "${testcvs} ann -r br" \
+"Annotations for file1
+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
+1\.1 (${username} *[0-9a-zA-Z-]*): this
+1\.1 (${username} *[0-9a-zA-Z-]*): is
+1\.2 (${username} *[0-9a-zA-Z-]*): a
+1\.1 (${username} *[0-9a-zA-Z-]*): file
+1\.2 (${username} *[0-9a-zA-Z-]*):
+1\.2 (${username} *[0-9a-zA-Z-]*): with
+1\.2 (${username} *[0-9a-zA-Z-]*): a
+1\.2 (${username} *[0-9a-zA-Z-]*): blank
+1\.2 (${username} *[0-9a-zA-Z-]*): line
+1\.2\.2\.1 (${username} *[0-9a-zA-Z-]*): and some
+1\.2\.2\.1 (${username} *[0-9a-zA-Z-]*): branched content"
+ cd ../..
+ rm -r 1
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
+
crerepos)
# Various tests relating to creating repositories, operating
# on repositories created with old versions of CVS, etc.
@@ -5983,12 +8552,17 @@ ${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then
# The directory tmp should be empty
dotest crerepos-6 "rmdir tmp" ''
+ CREREPOS_ROOT=${TESTDIR}/crerepos
+
else
# For remote, just create the repository. We don't yet do
# the various other tests above for remote but that should be
# changed.
mkdir crerepos
mkdir crerepos/CVSROOT
+
+ CREREPOS_ROOT=:ext:`hostname`:${TESTDIR}/crerepos
+
fi
if test "x$remote" = "xno"; then
@@ -6027,6 +8601,82 @@ ${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then
dotest_fail crerepos-7 \
"test -f ${TESTDIR}/crerepos/CVSROOT/history" ''
+ # Now test mixing repositories. This kind of thing tends to
+ # happen accidentally when people work with several repositories.
+ mkdir 1; cd 1
+ dotest crerepos-8 "${testcvs} -q co -l ." ''
+ mkdir first-dir
+ dotest crerepos-9 "${testcvs} add first-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
+ cd first-dir
+ touch file1
+ dotest crerepos-10 "${testcvs} add file1" \
+"${PROG} [a-z]*: scheduling file .file1. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest crerepos-11 "${testcvs} -q ci -m add-it" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done
+Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+initial revision: 1\.1
+done"
+ cd ../..
+ rm -r 1
+
+ mkdir 1; cd 1
+ dotest crerepos-12 "${testcvs} -d ${CREREPOS_ROOT} -q co -l ." ''
+ mkdir crerepos-dir
+ dotest crerepos-13 "${testcvs} add crerepos-dir" \
+"Directory ${TESTDIR}/crerepos/crerepos-dir added to the repository"
+ cd crerepos-dir
+ touch cfile
+ dotest crerepos-14 "${testcvs} add cfile" \
+"${PROG} [a-z]*: scheduling file .cfile. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest crerepos-15 "${testcvs} -q ci -m add-it" \
+"RCS file: ${TESTDIR}/crerepos/crerepos-dir/cfile,v
+done
+Checking in cfile;
+${TESTDIR}/crerepos/crerepos-dir/cfile,v <-- cfile
+initial revision: 1\.1
+done"
+ cd ../..
+ rm -r 1
+
+ mkdir 1; cd 1
+ dotest crerepos-16 "${testcvs} co first-dir" \
+"${PROG} [a-z]*: Updating first-dir
+U first-dir/file1"
+ dotest crerepos-17 "${testcvs} -d ${CREREPOS_ROOT} co crerepos-dir" \
+"${PROG} [a-z]*: Updating crerepos-dir
+U crerepos-dir/cfile"
+
+ if test x`cat CVS/Repository` = x.; then
+ # RELATIVE_REPOS
+ # Fatal error so that we don't go traipsing through the
+ # directories which happen to have the same names from the
+ # wrong repository.
+ dotest_fail crerepos-18 "${testcvs} -q update" \
+"${PROG} \[[a-z]* aborted\]: cannot open directory ${TESTDIR}/cvsroot/crerepos-dir: .*" ''
+ else
+ if test "$remote" = no; then
+ # The lack of an error doesn't mean CVS is really
+ # working (things are getting logged to the wrong
+ # history file and such).
+ dotest crerepos-18 "${testcvs} -q update" ''
+ else
+ # Fatal error so that we don't go traipsing through the
+ # directories which happen to have the same names from the
+ # wrong repository.
+ dotest_fail crerepos-18 "${testcvs} -q update" \
+"protocol error: directory .${TESTDIR}/crerepos/crerepos-dir. not within root .${TESTDIR}/cvsroot."
+ fi
+ fi
+
+ cd ..
+
+ rm -r 1
+ rm -rf ${CVSROOT_DIRNAME}/first-dir ${TESTDIR}/crerepos
;;
rcs)
@@ -6035,20 +8685,27 @@ ${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then
# implements this format, will be out there "forever" and
# CVS must always be able to import such files.
- # TODO: would be nice to have a corresponding test for exporting
- # RCS files. Rather than try to write a rigorous check for whether
- # the file CVS exports is legal, we could just write a simpler test
- # for what CVS actually exports, and revise the check as needed.
+ # See tests admin-13, admin-25 and rcs-8a for exporting RCS files.
mkdir ${CVSROOT_DIRNAME}/first-dir
# Currently the way to import an RCS file is to copy it
# directly into the repository.
+ #
# This file was written by RCS 5.7, and then the dates were
# hacked so that we test year 2000 stuff. Note also that
# "author" names are just strings, as far as importing
# RCS files is concerned--they need not correspond to user
# IDs on any particular system.
+ #
+ # I also tried writing a file with the RCS supplied with
+ # HPUX A.09.05. According to "man rcsintro" this is
+ # "Revision Number: 3.0; Release Date: 83/05/11". There
+ # were a few minor differences like whitespace but at least
+ # in simple cases like this everything else seemed the same
+ # as the file written by RCS 5.7 (so I won't try to make it
+ # a separate test case).
+
cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file1,v
head 1.3;
access;
@@ -6200,6 +8857,243 @@ add file1
else
fail rcs-4
fi
+
+ # OK, here is another one. This one was written by hand based on
+ # doc/RCSFILES and friends.
+ cat <<EOF >${CVSROOT_DIRNAME}/first-dir/file2,v
+head 1.5 ;
+ branch 1.2.6;
+access ;
+symbols;
+locks;
+testofanewphrase @without newphrase we'd have trouble extending @@ all@ ;
+1.5 date 71.01.01.01.00.00; author joe; state bogus; branches; next 1.4;
+1.4 date 71.01.01.00.00.05; author joe; state bogus; branches; next 1.3;
+1.3 date 70.12.31.15.00.05; author joe; state bogus; branches; next 1.2;
+1.2 date 70.12.31.12.15.05; author me; state bogus; branches 1.2.6.1; next 1.1;
+1.1 date 70.12.31.11.00.05; author joe; state bogus; branches; next; newph;
+1.2.6.1 date 71.01.01.08.00.05; author joe; state Exp; branches; next;
+desc @@
+1.5 log @@ newphrase1; newphrase2 42; text @head revision@
+1.4 log @@ text @d1 1
+a1 1
+new year revision@
+1.3 log @@ text @d1 1
+a1 1
+old year revision@
+1.2 log @@ text @d1 1
+a1 1
+mid revision@ 1.1
+
+log @@ text @d1 1
+a1 1
+start revision@
+1.2.6.1 log @@ text @d1 1
+a1 1
+branch revision@
+EOF
+ # First test the default branch.
+ dotest rcs-5 "${testcvs} -q update file2" "U file2"
+ dotest rcs-6 "cat file2" "branch revision"
+
+ # Now get rid of the default branch, it will get in the way.
+ dotest rcs-7 "${testcvs} admin -b file2" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+done"
+ # But we do want to make sure that "cvs admin" leaves the newphrases
+ # in the file.
+ # The extra whitespace regexps are for the RCS library, which does
+ # not preserve whitespace in the dogmatic manner of RCS 5.7. -twp
+ dotest rcs-8 \
+"grep testofanewphrase ${CVSROOT_DIRNAME}/first-dir/file2,v" \
+"testofanewphrase[ ][ ]*@without newphrase we'd have trouble extending @@ all@[ ]*;"
+ # The easiest way to test for newphrases in deltas and deltatexts
+ # is to just look at the whole file, I guess.
+ dotest rcs-8a "cat ${CVSROOT_DIRNAME}/first-dir/file2,v" \
+"head 1\.5;
+access;
+symbols;
+locks;
+
+testofanewphrase @without newphrase we'd have trouble extending @@ all@;
+
+1\.5
+date 71\.01\.01\.01\.00\.00; author joe; state bogus;
+branches;
+next 1\.4;
+
+1\.4
+date 71\.01\.01\.00\.00\.05; author joe; state bogus;
+branches;
+next 1\.3;
+
+1\.3
+date 70\.12\.31\.15\.00\.05; author joe; state bogus;
+branches;
+next 1\.2;
+
+1\.2
+date 70\.12\.31\.12\.15\.05; author me; state bogus;
+branches
+ 1\.2\.6\.1;
+next 1\.1;
+
+1\.1
+date 70\.12\.31\.11\.00\.05; author joe; state bogus;
+branches;
+next ;
+newph ;
+
+1\.2\.6\.1
+date 71\.01\.01\.08\.00\.05; author joe; state Exp;
+branches;
+next ;
+
+
+desc
+@@
+
+
+1\.5
+log
+@@
+newphrase1 ;
+newphrase2 42;
+text
+@head revision@
+
+
+1\.4
+log
+@@
+text
+@d1 1
+a1 1
+new year revision@
+
+
+1\.3
+log
+@@
+text
+@d1 1
+a1 1
+old year revision@
+
+
+1\.2
+log
+@@
+text
+@d1 1
+a1 1
+mid revision@
+
+
+1\.1
+log
+@@
+text
+@d1 1
+a1 1
+start revision@
+
+
+1\.2\.6\.1
+log
+@@
+text
+@d1 1
+a1 1
+branch revision@"
+
+ # For remote, the "update -p -D" usage seems not to work.
+ # I'm not sure what is going on.
+ if test "x$remote" = "xno"; then
+
+ if ${testcvs} -q update -p -D '1970-12-31 11:30 UT' file2 \
+ >${TESTDIR}/rcs4.tmp
+ then
+ dotest rcs-9 "cat ${TESTDIR}/rcs4.tmp" "start revision"
+ else
+ fail rcs-9
+ fi
+
+ if ${testcvs} -q update -p -D '1970-12-31 12:30 UT' file2 \
+ >${TESTDIR}/rcs4.tmp
+ then
+ dotest rcs-10 "cat ${TESTDIR}/rcs4.tmp" "mid revision"
+ else
+ fail rcs-10
+ fi
+
+ if ${testcvs} -q update -p -D '1971-01-01 00:30 UT' file2 \
+ >${TESTDIR}/rcs4.tmp
+ then
+ dotest rcs-11 "cat ${TESTDIR}/rcs4.tmp" "new year revision"
+ else
+ fail rcs-11
+ fi
+
+ # Same test as rcs-10, but with am/pm.
+ if ${testcvs} -q update -p -D 'December 31, 1970 12:30pm UT' file2 \
+ >${TESTDIR}/rcs4.tmp
+ then
+ dotest rcs-12 "cat ${TESTDIR}/rcs4.tmp" "mid revision"
+ else
+ fail rcs-12
+ fi
+
+ # Same test as rcs-11, but with am/pm.
+ if ${testcvs} -q update -p -D 'January 1, 1971 12:30am UT' file2 \
+ >${TESTDIR}/rcs4.tmp
+ then
+ dotest rcs-13 "cat ${TESTDIR}/rcs4.tmp" "new year revision"
+ else
+ fail rcs-13
+ fi
+
+ fi # end of tests skipped for remote
+
+ # OK, now make sure cvs log doesn't have any trouble with the
+ # newphrases and such.
+ dotest rcs-14 "${testcvs} -q log file2" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+Working file: file2
+head: 1\.5
+branch:
+locks:
+access list:
+symbolic names:
+keyword substitution: kv
+total revisions: 6; selected revisions: 6
+description:
+----------------------------
+revision 1\.5
+date: 1971/01/01 01:00:00; author: joe; state: bogus; lines: ${PLUS}1 -1
+\*\*\* empty log message \*\*\*
+----------------------------
+revision 1\.4
+date: 1971/01/01 00:00:05; author: joe; state: bogus; lines: ${PLUS}1 -1
+\*\*\* empty log message \*\*\*
+----------------------------
+revision 1\.3
+date: 1970/12/31 15:00:05; author: joe; state: bogus; lines: ${PLUS}1 -1
+\*\*\* empty log message \*\*\*
+----------------------------
+revision 1\.2
+date: 1970/12/31 12:15:05; author: me; state: bogus; lines: ${PLUS}1 -1
+branches: 1\.2\.6;
+\*\*\* empty log message \*\*\*
+----------------------------
+revision 1\.1
+date: 1970/12/31 11:00:05; author: joe; state: bogus;
+\*\*\* empty log message \*\*\*
+----------------------------
+revision 1\.2\.6\.1
+date: 1971/01/01 08:00:05; author: joe; state: Exp; lines: ${PLUS}1 -1
+\*\*\* empty log message \*\*\*
+============================================================================="
cd ..
rm -r first-dir ${TESTDIR}/rcs4.tmp
@@ -6231,7 +9125,7 @@ add file1
done
dotest big-2 "${testcvs} add file1" \
"${PROG} [a-z]*: scheduling file .file1. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest big-3 "${testcvs} -q ci -m add" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
done
@@ -6240,15 +9134,28 @@ ${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
initial revision: 1\.1
done"
cd ..
- rm -r first-dir
+ mkdir 2
+ cd 2
dotest big-4 "${testcvs} -q get first-dir" "U first-dir/file1"
+ cd ../first-dir
+ echo "add a line to the end" >>file1
+ dotest big-5 "${testcvs} -q ci -m modify" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.2; previous revision: 1\.1
+done"
+ cd ../2/first-dir
+ # The idea here is particularly to test the Rcs-diff response
+ # and the reallocing thereof, for remote.
+ dotest big-6 "${testcvs} -q update" "[UP] file1"
+ cd ../..
if test "$keep" = yes; then
echo Keeping ${TESTDIR} and exiting due to --keep
exit 0
fi
- rm -r first-dir
+ rm -r first-dir 2
rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
@@ -6275,7 +9182,7 @@ done"
touch aa
dotest modes-3 "${testcvs} add aa" \
"${PROG} [a-z]*: scheduling file .aa. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest modes-4 "${testcvs} -q ci -m add" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/aa,v
done
@@ -6318,7 +9225,7 @@ done"
chmod +x ab
dotest modes-8 "${testcvs} add ab" \
"${PROG} [a-z]*: scheduling file .ab. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest modes-9 "${testcvs} -q ci -m add" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/ab,v
done
@@ -6345,7 +9252,7 @@ T ab'
touch ac
dotest modes-13 "${testcvs} add ac" \
"${PROG} [a-z]*: scheduling file .ac. for addition on branch .br.
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
# Not sure it really makes sense to refer to a "previous revision"
# when we are just now adding the file; as far as I know
# that is longstanding CVS behavior, for what it's worth.
@@ -6395,7 +9302,7 @@ done"
dotest stamps-3 "${testcvs} add aa kw" \
"${PROG} [a-z]*: scheduling file .aa. for addition
${PROG} [a-z]*: scheduling file .kw. for addition
-${PROG} [a-z]*: use .cvs commit. to add these files permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
ls -l aa >${TESTDIR}/1/stamp.aa.add
ls -l kw >${TESTDIR}/1/stamp.kw.add
# "cvs add" should not muck with the timestamp.
@@ -6518,6 +9425,9 @@ done"
sticky)
# More tests of sticky tags, particularly non-branch sticky tags.
+ # See many tests (e.g. multibranch) for ordinary sticky tag
+ # operations such as adding files on branches.
+ # See "head" test for interaction between stick tags and HEAD.
mkdir 1; cd 1
dotest sticky-1 "${testcvs} -q co -l ." ''
mkdir first-dir
@@ -6528,7 +9438,7 @@ done"
touch file1
dotest sticky-3 "${testcvs} add file1" \
"${PROG} [a-z]*: scheduling file .file1. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest sticky-4 "${testcvs} -q ci -m add" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
done
@@ -6555,7 +9465,54 @@ ${QUESTION} file2" "${QUESTION} file2
[UP] file1"
dotest sticky-13 "${testcvs} add file2" \
"${PROG} [a-z]*: scheduling file .file2. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest sticky-14 "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+done
+Checking in file2;
+${TESTDIR}/cvsroot/first-dir/file2,v <-- file2
+initial revision: 1\.1
+done"
+
+ # Now back to tag1
+ dotest sticky-15 "${testcvs} -q update -r tag1" "[UP] file1
+${PROG} [a-z]*: file2 is no longer in the repository"
+
+ rm file1
+ dotest sticky-16 "${testcvs} rm file1" \
+"${PROG} [a-z]*: scheduling .file1. for removal
+${PROG} [a-z]*: use .${PROG} commit. to remove this file permanently"
+ # Hmm, this command seems to silently remove the tag from
+ # the file. This appears to be intentional.
+ # The silently part especially strikes me as odd, though.
+ dotest sticky-17 "${testcvs} -q ci -m remove-it" ""
+ dotest sticky-18 "${testcvs} -q update -A" "U file1
+U file2"
+ dotest sticky-19 "${testcvs} -q update -r tag1" \
+"${PROG} [a-z]*: file1 is no longer in the repository
+${PROG} [a-z]*: file2 is no longer in the repository"
+ dotest sticky-20 "${testcvs} -q update -A" "U file1
+U file2"
+
+ # Now try with a numeric revision.
+ dotest sticky-21 "${testcvs} -q update -r 1.1 file1" "U file1"
+ rm file1
+ dotest sticky-22 "${testcvs} rm file1" \
+"${PROG} [a-z]*: cannot remove file .file1. which has a numeric sticky tag of .1\.1."
+ # The old behavior was that remove allowed this and then commit
+ # gave an error, which was somewhat hard to clear. I mean, you
+ # could get into a long elaborate discussion of this being a
+ # conflict and two ways to resolve it, but I don't really see
+ # why CVS should have a concept of conflict that arises, not from
+ # parallel development, but from CVS's own sticky tags.
+
+ # I'm kind of surprised that the "file1 was lost" doesn't crop
+ # up elsewhere in the testsuite. It is a long-standing
+ # discrepency between local and remote CVS and should probably
+ # be cleaned up at some point.
+ dotest sticky-23 "${testcvs} -q update -A" \
+"${PROG} [a-z]*: warning: file1 was lost
+U file1" "U file1"
cd ../..
rm -r 1
@@ -6564,6 +9521,14 @@ ${PROG} [a-z]*: use .cvs commit. to add this file permanently"
keyword)
# Test keyword expansion.
+ # Various other tests relate to our ability to correctly
+ # set the keyword expansion mode.
+ # "binfiles" tests "cvs admin -k".
+ # "binfiles" and "binfiles2" test "cvs add -k".
+ # "rdiff" tests "cvs co -k".
+ # "binfiles" (and this test) test "cvs update -k".
+ # "binwrap" tests setting the mode from wrappers.
+ # I don't think any test is testing "cvs import -k".
mkdir 1; cd 1
dotest keyword-1 "${testcvs} -q co -l ." ''
mkdir first-dir
@@ -6591,7 +9556,7 @@ ${PROG} [a-z]*: use .cvs commit. to add this file permanently"
dotest keyword-3 "${testcvs} add file1" \
"${PROG} [a-z]*: scheduling file .file1. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest keyword-4 "${testcvs} -q ci -m add" \
"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
done
@@ -6725,17 +9690,7 @@ xx "'\$'"Log"'\$'
# Test the Name keyword. First go back to normal expansion.
- # FIXME: When using remote, update -A does not revert the
- # keyword expansion mode. We work around that bug here.
- # This workaround should be removed when the bug is fixed.
- if test "x$remote" = "xyes"; then
- cd ..
- rm -r first-dir
- dotest keyword-17 "${testcvs} -q co first-dir" "U first-dir/file1"
- cd first-dir
- else
- dotest keyword-17 "${testcvs} update -A file1" "U file1"
- fi
+ dotest keyword-17 "${testcvs} update -A file1" "U file1"
echo '$''Name$' > file1
dotest keyword-18 "${testcvs} ci -m modify file1" \
@@ -6759,44 +9714,160 @@ done"
dotest keyword-23 "${testcvs} update -A file1" "[UP] file1"
+ cd ../..
+ rm -r 1
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
+ keywordlog)
# Test the Log keyword.
+ mkdir 1; cd 1
+ dotest keywordlog-1 "${testcvs} -q co -l ." ''
+ mkdir first-dir
+ dotest keywordlog-2 "${testcvs} add first-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
+ cd first-dir
+ echo change >file1
+ dotest keywordlog-3 "${testcvs} add file1" \
+"${PROG} [a-z]*: scheduling file .file1. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+
+ # Note that we wanted to try "ci -r 1.3 -m add file1" and CVS
+ # seemed to get all confused, thinking it was adding on a branch
+ # or something. FIXME? Do something about this? Document it
+ # in BUGS or someplace?
+
+ dotest keywordlog-4 "${testcvs} -q ci -m add file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done
+Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+initial revision: 1\.1
+done"
+
+ cd ../..
+ mkdir 2; cd 2
+ dotest keywordlog-4a "${testcvs} -q co first-dir" "U first-dir/file1"
+ cd ../1/first-dir
+
echo 'xx $''Log$' > file1
cat >${TESTDIR}/comment.tmp <<EOF
First log line
Second log line
EOF
- dotest keyword-24 "${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \
+ dotest keywordlog-5 "${testcvs} ci -F ${TESTDIR}/comment.tmp file1" \
"Checking in file1;
${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
-new revision: 1\.4; previous revision: 1\.3
+new revision: 1\.2; previous revision: 1\.1
done"
rm -f ${TESTDIR}/comment.tmp
- dotest keyword-25 "cat file1" \
+ dotest keywordlog-6 "${testcvs} -q tag -b br" "T file1"
+ dotest keywordlog-7 "cat file1" \
"xx "'\$'"Log: file1,v "'\$'"
-xx Revision 1\.4 [0-9/]* [0-9:]* ${username}
+xx Revision 1\.2 [0-9/]* [0-9:]* ${username}
xx First log line
xx Second log line
xx"
+ cd ../../2/first-dir
+ dotest keywordlog-8 "${testcvs} -q update" "[UP] file1"
+ dotest keywordlog-9 "cat file1" \
+"xx "'\$'"Log: file1,v "'\$'"
+xx Revision 1\.2 [0-9/]* [0-9:]* ${username}
+xx First log line
+xx Second log line
+xx"
+ cd ../../1/first-dir
+
echo "change" >> file1
- dotest keyword-26 "${testcvs} ci -m modify file1" \
+ dotest keywordlog-10 "${testcvs} ci -m modify file1" \
"Checking in file1;
${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
-new revision: 1\.5; previous revision: 1\.4
+new revision: 1\.3; previous revision: 1\.2
done"
- dotest keyword-27 "cat file1" \
+ dotest keywordlog-11 "cat file1" \
+"xx "'\$'"Log: file1,v "'\$'"
+xx Revision 1\.3 [0-9/]* [0-9:]* ${username}
+xx modify
+xx
+xx Revision 1\.2 [0-9/]* [0-9:]* ${username}
+xx First log line
+xx Second log line
+xx
+change"
+
+ cd ../../2/first-dir
+ dotest keywordlog-12 "${testcvs} -q update" "[UP] file1"
+ dotest keywordlog-13 "cat file1" \
"xx "'\$'"Log: file1,v "'\$'"
-xx Revision 1\.5 [0-9/]* [0-9:]* ${username}
+xx Revision 1\.3 [0-9/]* [0-9:]* ${username}
xx modify
xx
-xx Revision 1\.4 [0-9/]* [0-9:]* ${username}
+xx Revision 1\.2 [0-9/]* [0-9:]* ${username}
xx First log line
xx Second log line
xx
change"
+ cd ../../1/first-dir
+ dotest keywordlog-14 "${testcvs} -q update -r br" "[UP] file1"
+ echo br-change >>file1
+ dotest keywordlog-15 "${testcvs} -q ci -m br-modify" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.2\.2\.1; previous revision: 1\.2
+done"
+ dotest keywordlog-16 "cat file1" \
+"xx "'\$'"Log: file1,v "'\$'"
+xx Revision 1\.2\.2\.1 [0-9/]* [0-9:]* ${username}
+xx br-modify
+xx
+xx Revision 1\.2 [0-9/]* [0-9:]* ${username}
+xx First log line
+xx Second log line
+xx
+br-change"
+ cd ../../2/first-dir
+ dotest keywordlog-17 "${testcvs} -q update -r br" "[UP] file1"
+ dotest keywordlog-18 "cat file1" \
+"xx "'\$'"Log: file1,v "'\$'"
+xx Revision 1\.2\.2\.1 [0-9/]* [0-9:]* ${username}
+xx br-modify
+xx
+xx Revision 1\.2 [0-9/]* [0-9:]* ${username}
+xx First log line
+xx Second log line
+xx
+br-change"
cd ../..
- rm -r 1
+ dotest keywordlog-19 "${testcvs} -q co -p -r br first-dir/file1" \
+"xx "'\$'"Log: file1,v "'\$'"
+xx Revision 1\.2\.2\.1 [0-9/]* [0-9:]* ${username}
+xx br-modify
+xx
+xx Revision 1\.2 [0-9/]* [0-9:]* ${username}
+xx First log line
+xx Second log line
+xx
+br-change"
+ dotest keywordlog-20 "${testcvs} -q co -p first-dir/file1" \
+"xx "'\$'"Log: file1,v "'\$'"
+xx Revision 1\.3 [0-9/]* [0-9:]* ${username}
+xx modify
+xx
+xx Revision 1\.2 [0-9/]* [0-9:]* ${username}
+xx First log line
+xx Second log line
+xx
+change"
+ dotest keywordlog-21 "${testcvs} -q co -p -r 1.2 first-dir/file1" \
+"xx "'\$'"Log: file1,v "'\$'"
+xx Revision 1\.2 [0-9/]* [0-9:]* ${username}
+xx First log line
+xx Second log line
+xx"
+
+ rm -r 1 2
rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
@@ -6811,15 +9882,16 @@ change"
mkdir 1; cd 1
dotest toplevel-1 "${testcvs} -q co -l ." ''
- mkdir top-dir
- dotest toplevel-2 "${testcvs} add top-dir" \
-"Directory ${TESTDIR}/cvsroot/top-dir added to the repository"
+ mkdir top-dir second-dir
+ dotest toplevel-2 "${testcvs} add top-dir second-dir" \
+"Directory ${TESTDIR}/cvsroot/top-dir added to the repository
+Directory ${TESTDIR}/cvsroot/second-dir added to the repository"
cd top-dir
touch file1
dotest toplevel-3 "${testcvs} add file1" \
"${PROG} [a-z]*: scheduling file .file1. for addition
-${PROG} [a-z]*: use .cvs commit. to add this file permanently"
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
dotest toplevel-4 "${testcvs} -q ci -m add" \
"RCS file: ${TESTDIR}/cvsroot/top-dir/file1,v
done
@@ -6827,6 +9899,20 @@ Checking in file1;
${TESTDIR}/cvsroot/top-dir/file1,v <-- file1
initial revision: 1\.1
done"
+ cd ..
+
+ cd second-dir
+ touch file2
+ dotest toplevel-3s "${testcvs} add file2" \
+"${PROG} [a-z]*: scheduling file .file2. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest toplevel-4s "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/second-dir/file2,v
+done
+Checking in file2;
+${TESTDIR}/cvsroot/second-dir/file2,v <-- file2
+initial revision: 1\.1
+done"
cd ../..
rm -r 1; mkdir 1; cd 1
@@ -6842,16 +9928,11 @@ ${PROG} [a-z]*: Updating top-dir"
dotest toplevel-8 "${testcvs} update -d top-dir" \
"${PROG} [a-z]*: Updating top-dir"
- # FIXME: This test fails in cvs starting from 1.9.2 because
- # it updates "file1" in "1". Test modules3-7f also finds
- # (and tolerates) this bug. The second expect string below
- # should be removed when this is fixed. The first expect
- # string is the behavior of remote CVS. There is some sentiment
- # that
+ # There is some sentiment that
# "${PROG} [a-z]*: Updating \.
# ${PROG} [a-z]*: Updating top-dir"
# is correct but it isn't clear why that would be correct instead
- # of the remote CVS behavior.
+ # of the remote CVS behavior (which also updates CVSROOT).
#
# The DOTSTAR matches of a bunch of lines like
# "U CVSROOT/checkoutlist". Trying to match them more precisely
@@ -6862,13 +9943,3368 @@ ${PROG} [a-z]*: Updating top-dir"
"${PROG} [a-z]*: Updating \.
${PROG} [a-z]*: Updating CVSROOT
${DOTSTAR}
-${PROG} [a-z]*: Updating top-dir" \
-"${PROG} [a-z]*: Updating \.
-U file1
${PROG} [a-z]*: Updating top-dir"
cd ..
+ rm -r 1; mkdir 1; cd 1
+ dotest toplevel-10 "${testcvs} co top-dir" \
+"${PROG} [a-z]*: Updating top-dir
+U top-dir/file1"
+ # This tests more or less the same thing, in a particularly
+ # "real life" example.
+ dotest toplevel-11 "${testcvs} -q update -d second-dir" \
+"U second-dir/file2"
+
+ # Now remove the CVS directory (people may do this manually,
+ # especially if they formed their habits with CVS
+ # 1.9 and older, which didn't create it. Or perhaps the working
+ # directory itself was created with 1.9 or older).
+ rm -r CVS
+ # Now set the permissions so we can't recreate it.
+ chmod -w ../1
+ # Now see whether CVS has trouble because it can't create CVS.
+ dotest toplevel-12 "${testcvs} co top-dir" \
+"${PROG} [a-z]*: warning: cannot make directory ./CVS: Permission denied
+${PROG} [a-z]*: Updating top-dir"
+ chmod +w ../1
+
+ cd ..
+ rm -r 1
+ rm -rf ${CVSROOT_DIRNAME}/top-dir
+ ;;
+
+ head)
+ # Testing handling of the HEAD special tag.
+ # There are many cases involving added and removed files
+ # which we don't yet try to deal with.
+ # TODO: We also could be paying much closer attention to
+ # "head of the trunk" versus "head of the default branch".
+ # That is what "cvs import" is doing here (but I didn't really
+ # fully follow through on writing the tests for that case).
+ mkdir imp-dir
+ cd imp-dir
+ echo 'imported contents' >file1
+ # It may seem like we don't do much with file2, but do note that
+ # the "cvs diff" invocations do also diff file2 (and come up empty).
+ echo 'imported contents' >file2
+ dotest head-1 "${testcvs} import -m add first-dir tag1 tag2" \
+"N first-dir/file1
+N first-dir/file2
+
+No conflicts created by this import"
+ cd ..
+ rm -r imp-dir
+ mkdir 1
+ cd 1
+ dotest head-2 "${testcvs} -q co first-dir" \
+"U first-dir/file1
+U first-dir/file2"
+ cd first-dir
+ echo 'add a line on trunk' >> file1
+ dotest head-3 "${testcvs} -q ci -m modify" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.2; previous revision: 1\.1
+done"
+ dotest head-4 "${testcvs} -q tag trunktag" "T file1
+T file2"
+ echo 'add a line on trunk after trunktag' >> file1
+ dotest head-5 "${testcvs} -q ci -m modify" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.3; previous revision: 1\.2
+done"
+ dotest head-6 "${testcvs} -q tag -b br1" "T file1
+T file2"
+ dotest head-7 "${testcvs} -q update -r br1" ""
+ echo 'modify on branch' >>file1
+ dotest head-8 "${testcvs} -q ci -m modify" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.3\.2\.1; previous revision: 1\.3
+done"
+ dotest head-9 "${testcvs} -q tag brtag" "T file1
+T file2"
+ echo 'modify on branch after brtag' >>file1
+ dotest head-10 "${testcvs} -q ci -m modify" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1
+done"
+ # With no sticky tags, HEAD is the head of the trunk.
+ dotest head-trunk-setup "${testcvs} -q update -A" "[UP] file1"
+ dotest head-trunk-update "${testcvs} -q update -r HEAD -p file1" \
+"imported contents
+add a line on trunk
+add a line on trunk after trunktag"
+ # and diff thinks so too. Case (a) from the comment in
+ # cvs.texinfo (Common options).
+ dotest_fail head-trunk-diff "${testcvs} -q diff -c -r HEAD -r br1" \
+"Index: file1
+===================================================================
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+retrieving revision 1\.3
+retrieving revision 1\.3\.2\.2
+diff -c -r1\.3 -r1\.3\.2\.2
+\*\*\* file1 [0-9/]* [0-9:]* 1\.3
+--- file1 [0-9/]* [0-9:]* 1\.3\.2\.2
+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
+\*\*\* 1,3 \*\*\*\*
+--- 1,5 ----
+ imported contents
+ add a line on trunk
+ add a line on trunk after trunktag
+${PLUS} modify on branch
+${PLUS} modify on branch after brtag"
+
+ # With a branch sticky tag, HEAD is the head of the trunk.
+ dotest head-br1-setup "${testcvs} -q update -r br1" "[UP] file1"
+ dotest head-br1-update "${testcvs} -q update -r HEAD -p file1" \
+"imported contents
+add a line on trunk
+add a line on trunk after trunktag"
+ # But diff thinks that HEAD is "br1". Case (b) from cvs.texinfo.
+ # Probably people are relying on it.
+ dotest head-br1-diff "${testcvs} -q diff -c -r HEAD -r br1" ""
+
+ # With a nonbranch sticky tag on a branch,
+ # HEAD is the head of the trunk
+ dotest head-brtag-setup "${testcvs} -q update -r brtag" "[UP] file1"
+ dotest head-brtag-update "${testcvs} -q update -r HEAD -p file1" \
+"imported contents
+add a line on trunk
+add a line on trunk after trunktag"
+ # But diff thinks that HEAD is "brtag". Case (c) from
+ # cvs.texinfo (the "strange, maybe accidental" case).
+ dotest_fail head-brtag-diff "${testcvs} -q diff -c -r HEAD -r br1" \
+"Index: file1
+===================================================================
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+retrieving revision 1\.3\.2\.1
+retrieving revision 1\.3\.2\.2
+diff -c -r1\.3\.2\.1 -r1\.3\.2\.2
+\*\*\* file1 [0-9/]* [0-9:]* 1\.3\.2\.1
+--- file1 [0-9/]* [0-9:]* 1\.3\.2\.2
+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
+\*\*\* 2,4 \*\*\*\*
+--- 2,5 ----
+ add a line on trunk
+ add a line on trunk after trunktag
+ modify on branch
+${PLUS} modify on branch after brtag"
+
+ # With a nonbranch sticky tag on the trunk, HEAD is the head
+ # of the trunk, I think.
+ dotest head-trunktag-setup "${testcvs} -q update -r trunktag" \
+"[UP] file1"
+ dotest head-trunktag-check "cat file1" "imported contents
+add a line on trunk"
+ dotest head-trunktag-update "${testcvs} -q update -r HEAD -p file1" \
+"imported contents
+add a line on trunk
+add a line on trunk after trunktag"
+ # Like head-brtag-diff, HEAD is the sticky tag. Similarly
+ # questionable.
+ dotest_fail head-trunktag-diff \
+ "${testcvs} -q diff -c -r HEAD -r br1" \
+"Index: file1
+===================================================================
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+retrieving revision 1\.2
+retrieving revision 1\.3\.2\.2
+diff -c -r1\.2 -r1\.3\.2\.2
+\*\*\* file1 [0-9/]* [0-9:]* 1\.2
+--- file1 [0-9/]* [0-9:]* 1\.3\.2\.2
+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
+\*\*\* 1,2 \*\*\*\*
+--- 1,5 ----
+ imported contents
+ add a line on trunk
+${PLUS} add a line on trunk after trunktag
+${PLUS} modify on branch
+${PLUS} modify on branch after brtag"
+
+ # Also might test what happens if we setup with update -r
+ # HEAD. In general, if sticky tags matter, does the
+ # behavior of "update -r <foo>" (without -p) depend on the
+ # sticky tags before or after the update?
+
+ # Note that we are testing both the case where this deletes
+ # a revision (file1) and the case where it does not (file2)
+ dotest_fail head-o0a "${testcvs} admin -o ::br1" \
+"${PROG} [a-z]*: Administrating \.
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+${PROG} [a-z]*: cannot remove revision 1\.3\.2\.1 because it has tags
+${PROG} [a-z]*: cannot modify RCS file for .file1.
+RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+done"
+ dotest head-o0b "${testcvs} tag -d brtag" \
+"${PROG} [a-z]*: Untagging \.
+D file1
+D file2"
+ dotest head-o1 "${testcvs} admin -o ::br1" \
+"${PROG} [a-z]*: Administrating \.
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+deleting revision 1\.3\.2\.1
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+done"
+ cd ../..
+ rm -r 1
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
+ tagdate)
+ # Test combining -r and -D.
+ mkdir 1; cd 1
+ dotest tagdate-1 "${testcvs} -q co -l ." ''
+ mkdir first-dir
+ dotest tagdate-2 "${testcvs} add first-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
+ cd first-dir
+
+ echo trunk-1 >file1
+ dotest tagdate-3 "${testcvs} add file1" \
+"${PROG} [a-z]*: scheduling file .file1. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest tagdate-4 "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done
+Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+initial revision: 1\.1
+done"
+ dotest tagdate-5 "${testcvs} -q tag -b br1" "T file1"
+ dotest tagdate-6 "${testcvs} -q tag -b br2" "T file1"
+ echo trunk-2 >file1
+ dotest tagdate-7 "${testcvs} -q ci -m modify-on-trunk" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.2; previous revision: 1\.1
+done"
+ # We are testing -r -D where br1 is a (magic) branch without
+ # any revisions. First the case where br2 doesn't have any
+ # revisions either:
+ dotest tagdate-8 "${testcvs} -q update -p -r br1 -D now" "trunk-1"
+ dotest tagdate-9 "${testcvs} -q update -r br2" "[UP] file1"
+ echo br2-1 >file1
+ dotest tagdate-10 "${testcvs} -q ci -m modify-on-br2" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.1\.4\.1; previous revision: 1\.1
+done"
+ # Then the case where br2 does have revisions:
+ dotest tagdate-11 "${testcvs} -q update -p -r br1 -D now" "trunk-1"
+
+ cd ../..
+ rm -r 1
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
+ multibranch2)
+ # Commit the first delta on branch A when there is an older
+ # branch, B, that already has a delta. A and B come from the
+ # same branch point. Then verify that branches A and B are
+ # in the right order.
+ mkdir 1; cd 1
+ dotest multibranch2-1 "${testcvs} -q co -l ." ''
+ mkdir first-dir
+ dotest multibranch2-2 "${testcvs} add first-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
+ cd first-dir
+
+ echo trunk-1 >file1
+ dotest multibranch2-3 "${testcvs} add file1" \
+"${PROG} [a-z]*: scheduling file .file1. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest multibranch2-4 "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done
+Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+initial revision: 1\.1
+done"
+ dotest multibranch2-5 "${testcvs} -q tag -b A" "T file1"
+ dotest multibranch2-6 "${testcvs} -q tag -b B" "T file1"
+
+ dotest multibranch2-7 "${testcvs} -q update -r B" ''
+ echo branch-B >file1
+ dotest multibranch2-8 "${testcvs} -q ci -m modify-on-B" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.1\.4\.1; previous revision: 1\.1
+done"
+
+ dotest multibranch2-9 "${testcvs} -q update -r A" '[UP] file1'
+ echo branch-A >file1
+ # When using cvs-1.9.20, this commit gets a failed assertion in rcs.c.
+ dotest multibranch2-10 "${testcvs} -q ci -m modify-on-A" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.1\.2\.1; previous revision: 1\.1
+done"
+
+ dotest multibranch2-11 "${testcvs} -q log" \
+"
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+Working file: file1
+head: 1\.1
+branch:
+locks: strict
+access list:
+symbolic names:
+ B: 1\.1\.0\.4
+ A: 1\.1\.0\.2
+keyword substitution: kv
+total revisions: 3; selected revisions: 3
+description:
+----------------------------
+revision 1\.1
+date: [0-9/]* [0-9:]*; author: $username; state: Exp;
+branches: 1\.1\.2; 1\.1\.4;
+add
+----------------------------
+revision 1\.1\.4\.1
+date: [0-9/]* [0-9:]*; author: $username; state: Exp; lines: ${PLUS}1 -1
+modify-on-B
+----------------------------
+revision 1\.1\.2\.1
+date: [0-9/]* [0-9:]*; author: $username; state: Exp; lines: ${PLUS}1 -1
+modify-on-A
+============================================================================="
+
+ # This one is more concise.
+ dotest multibranch2-12 "${testcvs} -q log -r1.1" \
+"
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+Working file: file1
+head: 1\.1
+branch:
+locks: strict
+access list:
+symbolic names:
+ B: 1\.1\.0\.4
+ A: 1\.1\.0\.2
+keyword substitution: kv
+total revisions: 3; selected revisions: 1
+description:
+----------------------------
+revision 1\.1
+date: [0-9/]* [0-9:]*; author: $username; state: Exp;
+branches: 1\.1\.2; 1\.1\.4;
+add
+============================================================================="
+
+ cd ../..
+ rm -r 1
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
+
+ admin)
+ # More "cvs admin" tests.
+ # The basicb-21 test tests rejecting an illegal option.
+ # For -l and -u, see "reserved" and "keyword" tests.
+ # "binfiles" test has a test of "cvs admin -k".
+ # "log2" test has tests of -t and -q options to cvs admin.
+ # "rcs" tests -b option also.
+ # For -o, see:
+ # admin-22-o1 through admin-23 (various cases not involving ::)
+ # binfiles2-o* (:rev, rev on trunk; rev:, deleting entire branch)
+ # basica-o1 through basica-o3 (basic :: usage)
+ # head-o1 (::branch, where this deletes a revision or is noop)
+ # branches-o1 (::branch, similar, with different branch topology)
+ # log-o1 (1.3.2.1::)
+ # binfiles-o1 (1.3:: and ::1.3)
+ # Also could be testing:
+ # 1.3.2.6::1.3.2.8
+ # 1.3.2.6::1.3.2
+ # 1.3.2.1::1.3.2.6
+ # 1.3::1.3.2.6 (error? or synonym for ::1.3.2.6?)
+
+ mkdir 1; cd 1
+ dotest admin-1 "${testcvs} -q co -l ." ''
+ mkdir first-dir
+ dotest admin-2 "${testcvs} add first-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
+ cd first-dir
+
+ dotest_fail admin-3 "${testcvs} -q admin -i file1" \
+"${PROG} admin: the -i option to admin is not supported
+${PROG} admin: run add or import to create an RCS file
+${PROG} \[admin aborted\]: specify ${PROG} -H admin for usage information"
+ dotest_fail admin-4 "${testcvs} -q log file1" \
+"${PROG} [a-z]*: nothing known about file1"
+
+ # Set up some files, file2 a plain one and file1 with a revision
+ # on a branch.
+ touch file1 file2
+ dotest admin-5 "${testcvs} add file1 file2" \
+"${PROG} [a-z]*: scheduling file .file1. for addition
+${PROG} [a-z]*: scheduling file .file2. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add these files permanently"
+ dotest admin-6 "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done
+Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+initial revision: 1\.1
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+done
+Checking in file2;
+${TESTDIR}/cvsroot/first-dir/file2,v <-- file2
+initial revision: 1\.1
+done"
+ dotest admin-7 "${testcvs} -q tag -b br" "T file1
+T file2"
+ dotest admin-8 "${testcvs} -q update -r br" ""
+ echo 'add a line on the branch' >> file1
+ dotest admin-9 "${testcvs} -q ci -m modify-on-branch" \
+"Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+new revision: 1\.1\.2\.1; previous revision: 1\.1
+done"
+ dotest admin-10 "${testcvs} -q update -A" "U file1"
+
+ # Try to recurse with a numeric revision arg.
+ # If we wanted to comprehensive about this, we would also test
+ # this for -l, -u, and all the different -o syntaxes.
+ dotest_fail admin-10a "${testcvs} -q admin -b1.1.2" \
+"${PROG} [a-z]*: while processing more than one file:
+${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
+ dotest_fail admin-10b "${testcvs} -q admin -m1.1:bogus file1 file2" \
+"${PROG} [a-z]*: while processing more than one file:
+${PROG} \[[a-z]* aborted\]: attempt to specify a numeric revision"
+
+ # Note that -s option applies to the new default branch, not
+ # the old one.
+ # Also note that the implementation of -a via "rcs" requires
+ # no space between -a and the argument. However, we expect
+ # to change that once CVS parses options.
+ dotest admin-11 "${testcvs} -q admin -afoo,bar -abaz \
+-b1.1.2 -cxx -U -sfoo file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done"
+
+ dotest admin-12 "${testcvs} log -N file1" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+Working file: file1
+head: 1\.1
+branch: 1\.1\.2
+locks:
+access list:
+ foo
+ bar
+ baz
+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
+============================================================================="
+
+ # "cvs log" doesn't print the comment leader. RCS 5.7 will print
+ # the comment leader only if one specifies "-V4" to rlog. So it
+ # seems like the only way to test it is by looking at the RCS file
+ # directly. This also serves as a test of exporting RCS files
+ # (analogous to the import tests in "rcs").
+ # Rather than try to write a rigorous check for whether the
+ # file CVS exports is legal, we just write a simpler
+ # test for what CVS actually exports, and figure we can revise
+ # the check as needed (within the confines of the RCS5 format as
+ # documented in RCSFILES).
+ dotest admin-13 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \
+"head 1\.1;
+branch 1\.1\.2;
+access
+ foo
+ bar
+ baz;
+symbols
+ br:1\.1\.0\.2;
+locks;
+comment @xx@;
+
+
+1\.1
+date [0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]; author ${username}; state Exp;
+branches
+ 1\.1\.2\.1;
+next ;
+
+1\.1\.2\.1
+date [0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]; author ${username}; state foo;
+branches;
+next ;
+
+
+desc
+@@
+
+
+1\.1
+log
+@add
+@
+text
+@@
+
+
+1\.1\.2\.1
+log
+@modify-on-branch
+@
+text
+@a0 1
+add a line on the branch
+@"
+ dotest admin-14 "${testcvs} -q admin -aauth3 -aauth2,foo \
+-soneone:1.1 -m1.1:changed-log-message -ntagone: file2" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+done"
+ dotest admin-15 "${testcvs} -q log file2" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+Working file: file2
+head: 1\.1
+branch:
+locks: strict
+access list:
+ auth3
+ auth2
+ foo
+symbolic names:
+ tagone: 1\.1
+ 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: oneone;
+changed-log-message
+============================================================================="
+
+ dotest admin-16 "${testcvs} -q admin \
+-A${CVSROOT_DIRNAME}/first-dir/file2,v -b -L -Nbr:1.1 file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done"
+ dotest admin-17 "${testcvs} -q log file1" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+Working file: file1
+head: 1\.1
+branch:
+locks: strict
+access list:
+ foo
+ bar
+ baz
+ auth3
+ auth2
+symbolic names:
+ br: 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
+============================================================================="
+
+ dotest_fail admin-18 "${testcvs} -q admin -nbr:1.1.2 file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/file1,v: symbolic name br already bound to 1\.1
+${PROG} [a-z]*: cannot modify RCS file for .file1."
+ dotest admin-19 "${testcvs} -q admin -ebaz -ebar,auth3 -nbr file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done"
+ dotest admin-20 "${testcvs} -q log file1" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+Working file: file1
+head: 1\.1
+branch:
+locks: strict
+access list:
+ foo
+ auth2
+symbolic names:
+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
+============================================================================="
+
+ # OK, this is starting to get ridiculous, in terms of
+ # testing a feature (access lists) which doesn't do anything
+ # useful, but what about nonexistent files and
+ # relative pathnames in admin -A?
+ dotest_fail admin-19a-nonexist \
+"${testcvs} -q admin -A${TESTDIR}/foo/bar file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+${PROG} [a-z]*: Couldn't open rcs file .${TESTDIR}/foo/bar.: No such file or directory
+${PROG} \[[a-z]* aborted\]: cannot continue"
+
+ # In the remote case, we are cd'd off into the temp directory
+ # and so these tests give "No such file or directory" errors.
+ if test "x$remote" = xno; then
+
+ dotest admin-19a-admin "${testcvs} -q admin -A../../cvsroot/first-dir/file2,v file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done"
+ dotest admin-19a-log "${testcvs} -q log -h -N file1" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+Working file: file1
+head: 1\.1
+branch:
+locks: strict
+access list:
+ foo
+ auth2
+ auth3
+keyword substitution: kv
+total revisions: 2
+============================================================================="
+ # Put the access list back, to avoid special cases later.
+ dotest admin-19a-fix "${testcvs} -q admin -eauth3 file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done"
+ fi # end of tests skipped for remote
+
+ # Add another revision to file2, so we can delete one.
+ echo 'add a line' >> file2
+ dotest admin-21 "${testcvs} -q ci -m modify file2" \
+"Checking in file2;
+${TESTDIR}/cvsroot/first-dir/file2,v <-- file2
+new revision: 1\.2; previous revision: 1\.1
+done"
+ dotest admin-22 "${testcvs} -q admin -o1.1 file2" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+deleting revision 1\.1
+done"
+ # Test admin -o. More variants that we could be testing:
+ # * REV: [on branch]
+ # * REV1:REV2 [deleting whole branch]
+ # * high branch numbers (e.g. 1.2.2.3.2.3)
+ # ... and probably others. See RCS_delete_revs for ideas.
+
+ echo first rev > aaa
+ dotest admin-22-o1 "${testcvs} add aaa" \
+"${PROG} [a-z]*: scheduling file .aaa. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest admin-22-o2 "${testcvs} -q ci -m first aaa" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
+done
+Checking in aaa;
+${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa
+initial revision: 1\.1
+done"
+ echo second rev >> aaa
+ dotest admin-22-o3 "${testcvs} -q ci -m second aaa" \
+"Checking in aaa;
+${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa
+new revision: 1\.2; previous revision: 1\.1
+done"
+ echo third rev >> aaa
+ dotest admin-22-o4 "${testcvs} -q ci -m third aaa" \
+"Checking in aaa;
+${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa
+new revision: 1\.3; previous revision: 1\.2
+done"
+ echo fourth rev >> aaa
+ dotest admin-22-o5 "${testcvs} -q ci -m fourth aaa" \
+"Checking in aaa;
+${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa
+new revision: 1\.4; previous revision: 1\.3
+done"
+ echo fifth rev >>aaa
+ dotest admin-22-o6 "${testcvs} -q ci -m fifth aaa" \
+"Checking in aaa;
+${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa
+new revision: 1\.5; previous revision: 1\.4
+done"
+ echo sixth rev >> aaa
+ dotest admin-22-o7 "${testcvs} -q ci -m sixth aaa" \
+"Checking in aaa;
+${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa
+new revision: 1\.6; previous revision: 1\.5
+done"
+ dotest admin-22-o8 "${testcvs} admin -l1.6 aaa" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
+1\.6 locked
+done"
+ dotest admin-22-o9 "${testcvs} log -r1.6 aaa" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
+Working file: aaa
+head: 1\.6
+branch:
+locks: strict
+ ${username}: 1\.6
+access list:
+symbolic names:
+keyword substitution: kv
+total revisions: 6; selected revisions: 1
+description:
+----------------------------
+revision 1\.6 locked by: ${username};
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; lines: ${PLUS}1 -0
+sixth
+============================================================================="
+ dotest_fail admin-22-o10 "${testcvs} admin -o1.5: aaa" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
+${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/aaa,v: can't remove locked revision 1\.6
+${PROG} [a-z]*: cannot modify RCS file for .aaa."
+ dotest admin-22-o11 "${testcvs} admin -u aaa" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
+1\.6 unlocked
+done"
+ dotest admin-22-o12 "${testcvs} admin -o1.5: aaa" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
+deleting revision 1\.6
+deleting revision 1\.5
+done"
+ dotest admin-22-o13 "${testcvs} log aaa" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
+Working file: aaa
+head: 1\.4
+branch:
+locks: strict
+access list:
+symbolic names:
+keyword substitution: kv
+total revisions: 4; selected revisions: 4
+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
+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
+============================================================================="
+
+ dotest admin-22-o14 "${testcvs} tag -b -r1.3 br1 aaa" "T aaa"
+ dotest admin-22-o15 "${testcvs} update -rbr1 aaa" "U aaa"
+ echo new branch rev >> aaa
+ dotest admin-22-o16 "${testcvs} ci -m new-branch aaa" \
+"Checking in aaa;
+${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa
+new revision: 1\.3\.2\.1; previous revision: 1\.3
+done"
+ dotest_fail admin-22-o17 "${testcvs} admin -o1.2:1.4 aaa" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
+deleting revision 1\.4
+${PROG} [a-z]*: ${TESTDIR}/cvsroot/first-dir/aaa,v: can't remove branch point 1\.3
+${PROG} [a-z]*: cannot modify RCS file for .aaa."
+ dotest admin-22-o18 "${testcvs} update -p -r1.4 aaa" \
+"===================================================================
+Checking out aaa
+RCS: ${TESTDIR}/cvsroot/first-dir/aaa,v
+VERS: 1\.4
+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
+first rev
+second rev
+third rev
+fourth rev"
+ echo second branch rev >> aaa
+ dotest admin-22-o19 "${testcvs} ci -m branch-two aaa" \
+"Checking in aaa;
+${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa
+new revision: 1\.3\.2\.2; previous revision: 1\.3\.2\.1
+done"
+ echo third branch rev >> aaa
+ dotest admin-22-o20 "${testcvs} ci -m branch-three aaa" \
+"Checking in aaa;
+${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa
+new revision: 1\.3\.2\.3; previous revision: 1\.3\.2\.2
+done"
+ echo fourth branch rev >> aaa
+ dotest admin-22-o21 "${testcvs} ci -m branch-four aaa" \
+"Checking in aaa;
+${TESTDIR}/cvsroot/first-dir/aaa,v <-- aaa
+new revision: 1\.3\.2\.4; previous revision: 1\.3\.2\.3
+done"
+ dotest admin-22-o22 "${testcvs} admin -o:1.3.2.3 aaa" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/aaa,v
+deleting revision 1\.3\.2\.1
+deleting revision 1\.3\.2\.2
+deleting revision 1\.3\.2\.3
+done"
+ dotest admin-22-o23 "${testcvs} log aaa" "
+RCS file: ${TESTDIR}/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
+============================================================================="
+
+ dotest admin-22-o24 "${testcvs} -q update -p -r 1.3.2.4 aaa" \
+"first rev
+second rev
+third rev
+new branch rev
+second branch rev
+third branch rev
+fourth branch rev"
+
+ # The bit here about how there is a "tagone" tag pointing to
+ # a nonexistent revision is documented by rcs. I dunno, I
+ # wonder whether the "cvs admin -o" should give a warning in
+ # this case.
+ dotest admin-23 "${testcvs} -q log file2" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file2,v
+Working file: file2
+head: 1\.2
+branch:
+locks: strict
+access list:
+ auth3
+ auth2
+ foo
+symbolic names:
+ tagone: 1\.1
+ br: 1\.1\.0\.2
+keyword substitution: kv
+total revisions: 1; selected revisions: 1
+description:
+----------------------------
+revision 1\.2
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
+modify
+============================================================================="
+
+ dotest admin-25 "cat ${CVSROOT_DIRNAME}/first-dir/file1,v" \
+"head 1\.1;
+access
+ foo
+ auth2;
+symbols;
+locks; strict;
+comment @xx@;
+
+
+1\.1
+date [0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]; author ${username}; state Exp;
+branches
+ 1\.1\.2\.1;
+next ;
+
+1\.1\.2\.1
+date [0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]; author ${username}; state foo;
+branches;
+next ;
+
+
+desc
+@@
+
+
+1\.1
+log
+@add
+@
+text
+@@
+
+
+1\.1\.2\.1
+log
+@modify-on-branch
+@
+text
+@a0 1
+add a line on the branch
+@"
+
+ cd ../..
+ rm -r 1
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
+ reserved)
+ # Tests of reserved checkouts. Eventually this will test
+ # rcslock.pl (or equivalent) and all kinds of stuff. Right
+ # now it just does some very basic checks on cvs admin -u
+ # and cvs admin -l.
+ # Also should test locking on a branch (and making sure that
+ # locks from one branch don't get mixed up with those from
+ # another. Both the case where one of the branches is the
+ # main branch, and in which neither one is).
+ # See also test keyword, which tests that keywords and -kkvl
+ # do the right thing in the presence of locks.
+
+ # The usual setup, directory first-dir containing file file1.
+ mkdir 1; cd 1
+ dotest reserved-1 "${testcvs} -q co -l ." ''
+ mkdir first-dir
+ dotest reserved-2 "${testcvs} add first-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
+ cd first-dir
+ touch file1
+ dotest reserved-3 "${testcvs} add file1" \
+"${PROG} [a-z]*: scheduling file .file1. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest reserved-4 "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+done
+Checking in file1;
+${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
+initial revision: 1\.1
+done"
+
+ dotest reserved-5 "${testcvs} -q admin -l file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+1\.1 locked
+done"
+ dotest reserved-6 "${testcvs} log -N file1" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+Working file: file1
+head: 1\.1
+branch:
+locks: strict
+ ${username}: 1\.1
+access list:
+keyword substitution: kv
+total revisions: 1; selected revisions: 1
+description:
+----------------------------
+revision 1\.1 locked by: ${username};
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
+add
+============================================================================="
+
+ # Note that this just tests the owner of the lock giving
+ # it up. It doesn't test breaking a lock.
+ dotest reserved-7 "${testcvs} -q admin -u file1" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+1\.1 unlocked
+done"
+
+ dotest reserved-8 "${testcvs} log -N file1" "
+RCS file: ${TESTDIR}/cvsroot/first-dir/file1,v
+Working file: file1
+head: 1\.1
+branch:
+locks: strict
+access list:
+keyword substitution: kv
+total revisions: 1; selected revisions: 1
+description:
+----------------------------
+revision 1\.1
+date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
+add
+============================================================================="
+
+ # rcslock.pl tests. Of course, the point isn't to test
+ # rcslock.pl from the distribution but equivalent
+ # functionality (for example, many sites may have an old
+ # rcslock.pl). The functionality of this hook falls
+ # short of the real rcslock.pl though.
+ # Note that we can use rlog or look at the RCS file directly,
+ # but we can't use "cvs log" because "cvs commit" has a lock.
+
+ cat >${TESTDIR}/lockme <<EOF
+#!${TESTSHELL}
+line=\`grep <\$1/\$2,v 'locks ${username}:1\.[0-9];'\`
+if test -z "\$line"; then
+ # It isn't locked
+ exit 0
+else
+ user=\`echo \$line | sed -e 's/locks \\(${username}\\):[0-9.]*;.*/\\1/'\`
+ version=\`echo \$line | sed -e 's/locks ${username}:\\([0-9.]*\\);.*/\\1/'\`
+ echo "\$user has file a-lock locked for version \$version"
+ exit 1
+fi
+EOF
+ chmod +x ${TESTDIR}/lockme
+
+ echo stuff > a-lock
+ dotest reserved-9 "${testcvs} add a-lock" \
+"${PROG} [a-z]*: scheduling file .a-lock. for addition
+${PROG} [a-z]*: use .${PROG} commit. to add this file permanently"
+ dotest reserved-10 "${testcvs} -q ci -m new a-lock" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/a-lock,v
+done
+Checking in a-lock;
+${TESTDIR}/cvsroot/first-dir/a-lock,v <-- a-lock
+initial revision: 1\.1
+done"
+ # FIXME: the contents of CVSROOT fluctuate a lot
+ # here. Maybe the expect pattern should just
+ # confirm that commitinfo is one of the files checked out,
+ # but for now we just check that CVS exited with success.
+ cd ..
+ if ${testcvs} -q co CVSROOT >>${LOGFILE} ; then
+ pass reserved-11
+ else
+ fail reserved-11
+ fi
+ cd CVSROOT
+ echo "DEFAULT ${TESTDIR}/lockme" >>commitinfo
+ dotest reserved-12 "${testcvs} -q ci -m rcslock commitinfo" \
+"Checking in commitinfo;
+${TESTDIR}/cvsroot/CVSROOT/commitinfo,v <-- commitinfo
+new revision: 1\.2; previous revision: 1\.1
+done
+${PROG} [a-z]*: Rebuilding administrative file database"
+ cd ..; cd first-dir
+
+ # Simulate (approximately) what a-lock would look like
+ # if someone else had locked revision 1.1.
+ sed -e 's/locks; strict;/locks fred:1.1; strict;/' ${TESTDIR}/cvsroot/first-dir/a-lock,v > a-lock,v
+ chmod 644 ${TESTDIR}/cvsroot/first-dir/a-lock,v
+ dotest reserved-13 "mv a-lock,v ${TESTDIR}/cvsroot/first-dir/a-lock,v"
+ chmod 444 ${TESTDIR}/cvsroot/first-dir/a-lock,v
+ echo more stuff >> a-lock
+ dotest_fail reserved-13b "${testcvs} ci -m '' a-lock" \
+"fred has file a-lock locked for version 1\.1
+${PROG} [a-z]*: Pre-commit check failed
+${PROG} \[[a-z]* aborted\]: correct above errors first!"
+
+ dotest reserved-14 "${testcvs} admin -u1.1 a-lock" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/a-lock,v
+1\.1 unlocked
+done"
+ dotest reserved-15 "${testcvs} -q ci -m success a-lock" \
+"Checking in a-lock;
+${TESTDIR}/cvsroot/first-dir/a-lock,v <-- a-lock
+new revision: 1\.2; previous revision: 1\.1
+done"
+
+ # undo commitinfo changes
+ cd ../CVSROOT
+ echo '# vanilla commitinfo' >commitinfo
+ dotest reserved-16 "${testcvs} -q ci -m back commitinfo" \
+"Checking in commitinfo;
+${TESTDIR}/cvsroot/CVSROOT/commitinfo,v <-- commitinfo
+new revision: 1\.3; previous revision: 1\.2
+done
+${PROG} [a-z]*: Rebuilding administrative file database"
+ cd ..; rm -r CVSROOT; cd first-dir
+
+ cd ../..
rm -r 1
+ rm ${TESTDIR}/lockme
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
+ cvsadm)
+ # These test check the content of CVS' administrative
+ # files as they are checked out in various configurations.
+ # (As a side note, I'm not using the "-q" flag in any of
+ # this code, which should provide some extra checking for
+ # those messages which don't seem to be checked thoroughly
+ # anywhere else.) To do a thorough test, we need to make
+ # a bunch of modules in various configurations.
+ #
+ # <1mod> is a directory at the top level of cvsroot
+ # ``foo bar''
+ # <2mod> is a directory at the second level of cvsroot
+ # ``foo bar/baz''
+ # <1d1mod> is a directory at the top level which is
+ # checked out into another directory
+ # ``foo -d bar baz''
+ # <1d2mod> is a directory at the second level which is
+ # checked out into another directory
+ # ``foo -d bar baz/quux''
+ # <2d1mod> is a directory at the top level which is
+ # checked out into a directory that is two deep
+ # ``foo -d bar/baz quux''
+ # <2d2mod> is a directory at the second level which is
+ # checked out into a directory that is two deep
+ # ``foo -d bar/baz quux''
+ #
+ # The tests do each of these types separately and in twos.
+ # We also repeat each test -d flag for 1-deep and 2-deep
+ # directories.
+ #
+ # Each test should check the output for the Repository
+ # file, since that is the one which varies depending on
+ # the directory and how it was checked out.
+ #
+ # Yes, this is verbose, but at least it's very thorough.
+
+ # convenience variables
+ REP=${CVSROOT}
+
+ # First, check out the modules file and edit it.
+ mkdir 1; cd 1
+ dotest cvsadm-1 "${testcvs} co CVSROOT/modules" \
+"U CVSROOT/modules"
+
+ # Try to determine whether RELATIVE_REPOS is defined
+ # so that we can make the following a lot less
+ # verbose.
+
+ echo "${CVSROOT_DIRNAME}/." > ${TESTDIR}/dotest.abs
+ echo "." > ${TESTDIR}/dotest.rel
+ if cmp ${TESTDIR}/dotest.abs CVS/Repository >/dev/null 2>&1; then
+ AREP="${CVSROOT_DIRNAME}/"
+ elif cmp ${TESTDIR}/dotest.rel CVS/Repository >/dev/null 2>&1; then
+ AREP=""
+ else
+ fail "Cannot figure out if RELATIVE_REPOS is defined."
+ fi
+
+ # Test CVS/Root once. Since there is only one part of
+ # the code which writes CVS/Root files (Create_Admin),
+ # there is no point in testing this every time.
+ dotest cvsadm-1a "cat CVS/Root" ${REP}
+ dotest cvsadm-1b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-1c "cat CVSROOT/CVS/Root" ${REP}
+ dotest cvsadm-1d "cat CVSROOT/CVS/Repository" \
+"${AREP}CVSROOT"
+ # All of the defined module names begin with a number.
+ # All of the top-level directory names begin with "dir".
+ # All of the subdirectory names begin with "sub".
+ # All of the top-level modules begin with "mod".
+ echo "# Module defs for cvsadm tests" > CVSROOT/modules
+ echo "1mod mod1" >> CVSROOT/modules
+ echo "1mod-2 mod1-2" >> CVSROOT/modules
+ echo "2mod mod2/sub2" >> CVSROOT/modules
+ echo "2mod-2 mod2-2/sub2-2" >> CVSROOT/modules
+ echo "1d1mod -d dir1d1 mod1" >> CVSROOT/modules
+ echo "1d1mod-2 -d dir1d1-2 mod1-2" >> CVSROOT/modules
+ echo "1d2mod -d dir1d2 mod2/sub2" >> CVSROOT/modules
+ echo "1d2mod-2 -d dir1d2-2 mod2-2/sub2-2" >> CVSROOT/modules
+ echo "2d1mod -d dir2d1/sub2d1 mod1" >> CVSROOT/modules
+ echo "2d1mod-2 -d dir2d1-2/sub2d1-2 mod1-2" >> CVSROOT/modules
+ echo "2d2mod -d dir2d2/sub2d2 mod2/sub2" >> CVSROOT/modules
+ echo "2d2mod-2 -d dir2d2-2/sub2d2-2 mod2-2/sub2-2" >> CVSROOT/modules
+ dotest cvsadm-1e "${testcvs} ci -m add-modules" \
+"${PROG} [a-z]*: Examining .
+${PROG} [a-z]*: Examining CVSROOT
+Checking in CVSROOT/modules;
+${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules
+new revision: 1\.[0-9]*; previous revision: 1\.[0-9]*
+done
+${PROG} [a-z]*: Rebuilding administrative file database"
+ rm -rf CVS CVSROOT;
+
+ # Create the various modules
+ mkdir ${CVSROOT_DIRNAME}/mod1
+ mkdir ${CVSROOT_DIRNAME}/mod1-2
+ mkdir ${CVSROOT_DIRNAME}/mod2
+ mkdir ${CVSROOT_DIRNAME}/mod2/sub2
+ mkdir ${CVSROOT_DIRNAME}/mod2-2
+ mkdir ${CVSROOT_DIRNAME}/mod2-2/sub2-2
+ dotest cvsadm-2 "${testcvs} co mod1 mod1-2 mod2 mod2-2" \
+"${PROG} [a-z]*: Updating mod1
+${PROG} [a-z]*: Updating mod1-2
+${PROG} [a-z]*: Updating mod2
+${PROG} [a-z]*: Updating mod2/sub2
+${PROG} [a-z]*: Updating mod2-2
+${PROG} [a-z]*: Updating mod2-2/sub2-2"
+
+ # Populate the directories for the halibut
+ echo "file1" > mod1/file1
+ echo "file1-2" > mod1-2/file1-2
+ echo "file2" > mod2/sub2/file2
+ echo "file2-2" > mod2-2/sub2-2/file2-2
+ dotest cvsadm-2a "${testcvs} add mod1/file1 mod1-2/file1-2 mod2/sub2/file2 mod2-2/sub2-2/file2-2" \
+"${PROG} [a-z]*: scheduling file .mod1/file1. for addition
+${PROG} [a-z]*: scheduling file .mod1-2/file1-2. for addition
+${PROG} [a-z]*: scheduling file .mod2/sub2/file2. for addition
+${PROG} [a-z]*: scheduling file .mod2-2/sub2-2/file2-2. for addition
+${PROG} [a-z]*: use '${PROG} commit' to add these files permanently"
+
+ dotest cvsadm-2b "${testcvs} ci -m yup mod1 mod1-2 mod2 mod2-2" \
+"${PROG} [a-z]*: Examining mod1
+${PROG} [a-z]*: Examining mod1-2
+${PROG} [a-z]*: Examining mod2
+${PROG} [a-z]*: Examining mod2/sub2
+${PROG} [a-z]*: Examining mod2-2
+${PROG} [a-z]*: Examining mod2-2/sub2-2
+RCS file: ${CVSROOT_DIRNAME}/mod1/file1,v
+done
+Checking in mod1/file1;
+${CVSROOT_DIRNAME}/mod1/file1,v <-- file1
+initial revision: 1.1
+done
+RCS file: ${CVSROOT_DIRNAME}/mod1-2/file1-2,v
+done
+Checking in mod1-2/file1-2;
+${CVSROOT_DIRNAME}/mod1-2/file1-2,v <-- file1-2
+initial revision: 1.1
+done
+RCS file: ${CVSROOT_DIRNAME}/mod2/sub2/file2,v
+done
+Checking in mod2/sub2/file2;
+${CVSROOT_DIRNAME}/mod2/sub2/file2,v <-- file2
+initial revision: 1.1
+done
+RCS file: ${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v
+done
+Checking in mod2-2/sub2-2/file2-2;
+${CVSROOT_DIRNAME}/mod2-2/sub2-2/file2-2,v <-- file2-2
+initial revision: 1.1
+done"
+ # Finished creating the modules -- clean up.
+ rm -rf CVS mod1 mod1-2 mod2 mod2-2
+ # Done.
+
+ ##################################################
+ ## Start the dizzying array of possibilities.
+ ## Begin with each module type separately.
+ ##################################################
+
+ # Pattern -- after each checkout, first check the top-level
+ # CVS directory. Then, check the directories in numerical
+ # order.
+
+ dotest cvsadm-3 "${testcvs} co 1mod" \
+"${PROG} [a-z]*: Updating 1mod
+U 1mod/file1"
+ dotest cvsadm-3b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-3d "cat 1mod/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS 1mod
+
+ dotest cvsadm-4 "${testcvs} co 2mod" \
+"${PROG} [a-z]*: Updating 2mod
+U 2mod/file2"
+ dotest cvsadm-4b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-4d "cat 2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS 2mod
+
+ dotest cvsadm-5 "${testcvs} co 1d1mod" \
+"${PROG} [a-z]*: Updating dir1d1
+U dir1d1/file1"
+ dotest cvsadm-5b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-5d "cat dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir1d1
+
+ dotest cvsadm-6 "${testcvs} co 1d2mod" \
+"${PROG} [a-z]*: Updating dir1d2
+U dir1d2/file2"
+ dotest cvsadm-6b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-6d "cat dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir1d2
+
+ dotest cvsadm-7 "${testcvs} co 2d1mod" \
+"${PROG} [a-z]*: Updating dir2d1/sub2d1
+U dir2d1/sub2d1/file1"
+ dotest cvsadm-7b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-7d "cat dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-7f "cat dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir2d1
+
+ dotest cvsadm-8 "${testcvs} co 2d2mod" \
+"${PROG} [a-z]*: Updating dir2d2/sub2d2
+U dir2d2/sub2d2/file2"
+ dotest cvsadm-8b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-8d "cat dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-8f "cat dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir2d2
+
+ ##################################################
+ ## You are in a shell script of twisted little
+ ## module combination statements, all alike.
+ ##################################################
+
+ ### 1mod
+
+ dotest cvsadm-9 "${testcvs} co 1mod 1mod-2" \
+"${PROG} [a-z]*: Updating 1mod
+U 1mod/file1
+${PROG} [a-z]*: Updating 1mod-2
+U 1mod-2/file1-2"
+ # the usual for the top level
+ dotest cvsadm-9b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 1mod
+ dotest cvsadm-9d "cat 1mod/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 1mod copy
+ dotest cvsadm-9f "cat 1mod-2/CVS/Repository" \
+"${AREP}mod1-2"
+ rm -rf CVS 1mod 1mod-2
+
+ # 1mod 2mod redmod bluemod
+ dotest cvsadm-10 "${testcvs} co 1mod 2mod" \
+"${PROG} [a-z]*: Updating 1mod
+U 1mod/file1
+${PROG} [a-z]*: Updating 2mod
+U 2mod/file2"
+ # the usual for the top level
+ dotest cvsadm-10b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 1mod
+ dotest cvsadm-10d "cat 1mod/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 2dmod
+ dotest cvsadm-10f "cat 2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS 1mod 2mod
+
+ dotest cvsadm-11 "${testcvs} co 1mod 1d1mod" \
+"${PROG} [a-z]*: Updating 1mod
+U 1mod/file1
+${PROG} [a-z]*: Updating dir1d1
+U dir1d1/file1"
+ # the usual for the top level
+ dotest cvsadm-11b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 1mod
+ dotest cvsadm-11d "cat 1mod/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 1d1mod
+ dotest cvsadm-11f "cat dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS 1mod dir1d1
+
+ dotest cvsadm-12 "${testcvs} co 1mod 1d2mod" \
+"${PROG} [a-z]*: Updating 1mod
+U 1mod/file1
+${PROG} [a-z]*: Updating dir1d2
+U dir1d2/file2"
+ # the usual for the top level
+ dotest cvsadm-12b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 1mod
+ dotest cvsadm-12d "cat 1mod/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 1d2mod
+ dotest cvsadm-12f "cat dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS 1mod dir1d2
+
+ dotest cvsadm-13 "${testcvs} co 1mod 2d1mod" \
+"${PROG} [a-z]*: Updating 1mod
+U 1mod/file1
+${PROG} [a-z]*: Updating dir2d1/sub2d1
+U dir2d1/sub2d1/file1"
+ # the usual for the top level
+ dotest cvsadm-13b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 1mod
+ dotest cvsadm-13d "cat 1mod/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 2d1mod
+ dotest cvsadm-13f "cat dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-13h "cat dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS 1mod dir2d1
+
+ dotest cvsadm-14 "${testcvs} co 1mod 2d2mod" \
+"${PROG} [a-z]*: Updating 1mod
+U 1mod/file1
+${PROG} [a-z]*: Updating dir2d2/sub2d2
+U dir2d2/sub2d2/file2"
+ # the usual for the top level
+ dotest cvsadm-14b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 1mod
+ dotest cvsadm-14d "cat 1mod/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 2d2mod
+ dotest cvsadm-14f "cat dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-14h "cat dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS 1mod dir2d2
+
+
+ ### 2mod
+
+ dotest cvsadm-15 "${testcvs} co 2mod 2mod-2" \
+"${PROG} [a-z]*: Updating 2mod
+U 2mod/file2
+${PROG} [a-z]*: Updating 2mod-2
+U 2mod-2/file2-2"
+ # the usual for the top level
+ dotest cvsadm-15b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 2mod
+ dotest cvsadm-15d "cat 2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 2mod copy
+ dotest cvsadm-15f "cat 2mod-2/CVS/Repository" \
+"${AREP}mod2-2/sub2-2"
+ rm -rf CVS 2mod 2mod-2
+
+
+ dotest cvsadm-16 "${testcvs} co 2mod 1d1mod" \
+"${PROG} [a-z]*: Updating 2mod
+U 2mod/file2
+${PROG} [a-z]*: Updating dir1d1
+U dir1d1/file1"
+ # the usual for the top level
+ dotest cvsadm-16b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 2mod
+ dotest cvsadm-16d "cat 2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 1d1mod
+ dotest cvsadm-16f "cat dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS 2mod dir1d1
+
+ dotest cvsadm-17 "${testcvs} co 2mod 1d2mod" \
+"${PROG} [a-z]*: Updating 2mod
+U 2mod/file2
+${PROG} [a-z]*: Updating dir1d2
+U dir1d2/file2"
+ # the usual for the top level
+ dotest cvsadm-17b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 2mod
+ dotest cvsadm-17d "cat 2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 1d2mod
+ dotest cvsadm-17f "cat dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS 2mod dir1d2
+
+ dotest cvsadm-18 "${testcvs} co 2mod 2d1mod" \
+"${PROG} [a-z]*: Updating 2mod
+U 2mod/file2
+${PROG} [a-z]*: Updating dir2d1/sub2d1
+U dir2d1/sub2d1/file1"
+ # the usual for the top level
+ dotest cvsadm-18b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 2mod
+ dotest cvsadm-18d "cat 2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 2d1mod
+ dotest cvsadm-18f "cat dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-18h "cat dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS 2mod dir2d1
+
+ dotest cvsadm-19 "${testcvs} co 2mod 2d2mod" \
+"${PROG} [a-z]*: Updating 2mod
+U 2mod/file2
+${PROG} [a-z]*: Updating dir2d2/sub2d2
+U dir2d2/sub2d2/file2"
+ # the usual for the top level
+ dotest cvsadm-19b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 2mod
+ dotest cvsadm-19d "cat 2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 2d2mod
+ dotest cvsadm-19f "cat dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-19h "cat dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS 2mod dir2d2
+
+
+ ### 1d1mod
+
+ dotest cvsadm-20 "${testcvs} co 1d1mod 1d1mod-2" \
+"${PROG} [a-z]*: Updating dir1d1
+U dir1d1/file1
+${PROG} [a-z]*: Updating dir1d1-2
+U dir1d1-2/file1-2"
+ # the usual for the top level
+ dotest cvsadm-20b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 1d1mod
+ dotest cvsadm-20d "cat dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 1d1mod copy
+ dotest cvsadm-20f "cat dir1d1-2/CVS/Repository" \
+"${AREP}mod1-2"
+ rm -rf CVS dir1d1 dir1d1-2
+
+ dotest cvsadm-21 "${testcvs} co 1d1mod 1d2mod" \
+"${PROG} [a-z]*: Updating dir1d1
+U dir1d1/file1
+${PROG} [a-z]*: Updating dir1d2
+U dir1d2/file2"
+ # the usual for the top level
+ dotest cvsadm-21b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 1d1mod
+ dotest cvsadm-21d "cat dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 1d2mod
+ dotest cvsadm-21f "cat dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir1d1 dir1d2
+
+ dotest cvsadm-22 "${testcvs} co 1d1mod 2d1mod" \
+"${PROG} [a-z]*: Updating dir1d1
+U dir1d1/file1
+${PROG} [a-z]*: Updating dir2d1/sub2d1
+U dir2d1/sub2d1/file1"
+ # the usual for the top level
+ dotest cvsadm-22b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 1d1mod
+ dotest cvsadm-22d "cat dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 2d1mod
+ dotest cvsadm-22f "cat dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-22h "cat dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir1d1 dir2d1
+
+ dotest cvsadm-23 "${testcvs} co 1d1mod 2d2mod" \
+"${PROG} [a-z]*: Updating dir1d1
+U dir1d1/file1
+${PROG} [a-z]*: Updating dir2d2/sub2d2
+U dir2d2/sub2d2/file2"
+ # the usual for the top level
+ dotest cvsadm-23b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 1d1mod
+ dotest cvsadm-23d "cat dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 2d2mod
+ dotest cvsadm-23f "cat dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-23h "cat dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir1d1 dir2d2
+
+
+ ### 1d2mod
+
+ dotest cvsadm-24 "${testcvs} co 1d2mod 1d2mod-2" \
+"${PROG} [a-z]*: Updating dir1d2
+U dir1d2/file2
+${PROG} [a-z]*: Updating dir1d2-2
+U dir1d2-2/file2-2"
+ # the usual for the top level
+ dotest cvsadm-24b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 1d2mod
+ dotest cvsadm-24d "cat dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 1d2mod copy
+ dotest cvsadm-24f "cat dir1d2-2/CVS/Repository" \
+"${AREP}mod2-2/sub2-2"
+ rm -rf CVS dir1d2 dir1d2-2
+
+ dotest cvsadm-25 "${testcvs} co 1d2mod 2d1mod" \
+"${PROG} [a-z]*: Updating dir1d2
+U dir1d2/file2
+${PROG} [a-z]*: Updating dir2d1/sub2d1
+U dir2d1/sub2d1/file1"
+ # the usual for the top level
+ dotest cvsadm-25b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 1d2mod
+ dotest cvsadm-25d "cat dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 2d1mod
+ dotest cvsadm-25f "cat dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-25h "cat dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir1d2 dir2d1
+
+ dotest cvsadm-26 "${testcvs} co 1d2mod 2d2mod" \
+"${PROG} [a-z]*: Updating dir1d2
+U dir1d2/file2
+${PROG} [a-z]*: Updating dir2d2/sub2d2
+U dir2d2/sub2d2/file2"
+ # the usual for the top level
+ dotest cvsadm-26b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 1d2mod
+ dotest cvsadm-26d "cat dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 2d2mod
+ dotest cvsadm-26f "cat dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-26h "cat dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir1d2 dir2d2
+
+
+ # 2d1mod
+
+ dotest cvsadm-27 "${testcvs} co 2d1mod 2d1mod-2" \
+"${PROG} [a-z]*: Updating dir2d1/sub2d1
+U dir2d1/sub2d1/file1
+${PROG} [a-z]*: Updating dir2d1-2/sub2d1-2
+U dir2d1-2/sub2d1-2/file1-2"
+ # the usual for the top level
+ dotest cvsadm-27b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 2d1mod
+ dotest cvsadm-27d "cat dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-27f "cat dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 2d1mod
+ dotest cvsadm-27h "cat dir2d1-2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-27j "cat dir2d1-2/sub2d1-2/CVS/Repository" \
+"${AREP}mod1-2"
+ rm -rf CVS dir2d1 dir2d1-2
+
+ dotest cvsadm-28 "${testcvs} co 2d1mod 2d2mod" \
+"${PROG} [a-z]*: Updating dir2d1/sub2d1
+U dir2d1/sub2d1/file1
+${PROG} [a-z]*: Updating dir2d2/sub2d2
+U dir2d2/sub2d2/file2"
+ # the usual for the top level
+ dotest cvsadm-28b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 2d1mod
+ dotest cvsadm-28d "cat dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-28f "cat dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 2d2mod
+ dotest cvsadm-28h "cat dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-28j "cat dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir2d1 dir2d2
+
+
+ # 2d2mod
+
+ dotest cvsadm-29 "${testcvs} co 2d2mod 2d2mod-2" \
+"${PROG} [a-z]*: Updating dir2d2/sub2d2
+U dir2d2/sub2d2/file2
+${PROG} [a-z]*: Updating dir2d2-2/sub2d2-2
+U dir2d2-2/sub2d2-2/file2-2"
+ # the usual for the top level
+ dotest cvsadm-29b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for 2d2mod
+ dotest cvsadm-29d "cat dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-29f "cat dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 2d2mod
+ dotest cvsadm-29h "cat dir2d2-2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-29j "cat dir2d2-2/sub2d2-2/CVS/Repository" \
+"${AREP}mod2-2/sub2-2"
+ rm -rf CVS dir2d2 dir2d2-2
+
+ ##################################################
+ ## And now, all of that again using the "-d" flag
+ ## on the command line.
+ ##################################################
+
+ dotest cvsadm-1d3 "${testcvs} co -d dir 1mod" \
+"${PROG} [a-z]*: Updating dir
+U dir/file1"
+ dotest cvsadm-1d3b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-1d3d "cat dir/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d4 "${testcvs} co -d dir 2mod" \
+"${PROG} [a-z]*: Updating dir
+U dir/file2"
+ dotest cvsadm-1d4b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-1d4d "cat dir/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d5 "${testcvs} co -d dir 1d1mod" \
+"${PROG} [a-z]*: Updating dir
+U dir/file1"
+ dotest cvsadm-1d5b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-1d5d "cat dir/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d6 "${testcvs} co -d dir 1d2mod" \
+"${PROG} [a-z]*: Updating dir
+U dir/file2"
+ dotest cvsadm-1d6b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-1d6d "cat dir/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d7 "${testcvs} co -d dir 2d1mod" \
+"${PROG} [a-z]*: Updating dir
+U dir/file1"
+ dotest cvsadm-1d7b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-1d7d "cat dir/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d8 "${testcvs} co -d dir 2d2mod" \
+"${PROG} [a-z]*: Updating dir
+U dir/file2"
+ dotest cvsadm-1d8b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-1d8d "cat dir/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ ##################################################
+ ## Los Combonaciones
+ ##################################################
+
+ ### 1mod
+
+ dotest cvsadm-1d9 "${testcvs} co -d dir 1mod 1mod-2" \
+"${PROG} [a-z]*: Updating dir/1mod
+U dir/1mod/file1
+${PROG} [a-z]*: Updating dir/1mod-2
+U dir/1mod-2/file1-2"
+ # the usual for the top level
+ dotest cvsadm-1d9b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d9d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 1mod
+ dotest cvsadm-1d9f "cat dir/1mod/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 1mod copy
+ dotest cvsadm-1d9h "cat dir/1mod-2/CVS/Repository" \
+"${AREP}mod1-2"
+ rm -rf CVS dir
+
+ # 1mod 2mod redmod bluemod
+ dotest cvsadm-1d10 "${testcvs} co -d dir 1mod 2mod" \
+"${PROG} [a-z]*: Updating dir/1mod
+U dir/1mod/file1
+${PROG} [a-z]*: Updating dir/2mod
+U dir/2mod/file2"
+ dotest cvsadm-1d10b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d10d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 1mod
+ dotest cvsadm-1d10f "cat dir/1mod/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 2dmod
+ dotest cvsadm-1d10h "cat dir/2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d11 "${testcvs} co -d dir 1mod 1d1mod" \
+"${PROG} [a-z]*: Updating dir/1mod
+U dir/1mod/file1
+${PROG} [a-z]*: Updating dir/dir1d1
+U dir/dir1d1/file1"
+ dotest cvsadm-1d11b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d11d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 1mod
+ dotest cvsadm-1d11f "cat dir/1mod/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 1d1mod
+ dotest cvsadm-1d11h "cat dir/dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d12 "${testcvs} co -d dir 1mod 1d2mod" \
+"${PROG} [a-z]*: Updating dir/1mod
+U dir/1mod/file1
+${PROG} [a-z]*: Updating dir/dir1d2
+U dir/dir1d2/file2"
+ dotest cvsadm-1d12b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d12d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 1mod
+ dotest cvsadm-1d12f "cat dir/1mod/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 1d2mod
+ dotest cvsadm-1d12h "cat dir/dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d13 "${testcvs} co -d dir 1mod 2d1mod" \
+"${PROG} [a-z]*: Updating dir/1mod
+U dir/1mod/file1
+${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
+U dir/dir2d1/sub2d1/file1"
+ dotest cvsadm-1d13b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d13d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 1mod
+ dotest cvsadm-1d13f "cat dir/1mod/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 2d1mod
+ dotest cvsadm-1d13h "cat dir/dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-1d13j "cat dir/dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d14 "${testcvs} co -d dir 1mod 2d2mod" \
+"${PROG} [a-z]*: Updating dir/1mod
+U dir/1mod/file1
+${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
+U dir/dir2d2/sub2d2/file2"
+ dotest cvsadm-1d14b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d14d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 1mod
+ dotest cvsadm-1d14f "cat dir/1mod/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 2d2mod
+ dotest cvsadm-1d14h "cat dir/dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-1d14j "cat dir/dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+
+ ### 2mod
+
+ dotest cvsadm-1d15 "${testcvs} co -d dir 2mod 2mod-2" \
+"${PROG} [a-z]*: Updating dir/2mod
+U dir/2mod/file2
+${PROG} [a-z]*: Updating dir/2mod-2
+U dir/2mod-2/file2-2"
+ dotest cvsadm-1d15b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d15d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 2mod
+ dotest cvsadm-1d15f "cat dir/2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 2mod copy
+ dotest cvsadm-1d15h "cat dir/2mod-2/CVS/Repository" \
+"${AREP}mod2-2/sub2-2"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d16 "${testcvs} co -d dir 2mod 1d1mod" \
+"${PROG} [a-z]*: Updating dir/2mod
+U dir/2mod/file2
+${PROG} [a-z]*: Updating dir/dir1d1
+U dir/dir1d1/file1"
+ dotest cvsadm-1d16b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d16d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 2mod
+ dotest cvsadm-1d16f "cat dir/2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 1d1mod
+ dotest cvsadm-1d16h "cat dir/dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d17 "${testcvs} co -d dir 2mod 1d2mod" \
+"${PROG} [a-z]*: Updating dir/2mod
+U dir/2mod/file2
+${PROG} [a-z]*: Updating dir/dir1d2
+U dir/dir1d2/file2"
+ dotest cvsadm-1d17b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d17d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 2mod
+ dotest cvsadm-1d17f "cat dir/2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 1d2mod
+ dotest cvsadm-1d17h "cat dir/dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d18 "${testcvs} co -d dir 2mod 2d1mod" \
+"${PROG} [a-z]*: Updating dir/2mod
+U dir/2mod/file2
+${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
+U dir/dir2d1/sub2d1/file1"
+ dotest cvsadm-1d18b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d18d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 2mod
+ dotest cvsadm-1d18f "cat dir/2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 2d1mod
+ dotest cvsadm-1d18h "cat dir/dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-1d18j "cat dir/dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d19 "${testcvs} co -d dir 2mod 2d2mod" \
+"${PROG} [a-z]*: Updating dir/2mod
+U dir/2mod/file2
+${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
+U dir/dir2d2/sub2d2/file2"
+ dotest cvsadm-1d19b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d19d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 2mod
+ dotest cvsadm-1d19f "cat dir/2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 2d2mod
+ dotest cvsadm-1d19h "cat dir/dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-1d19j "cat dir/dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+
+ ### 1d1mod
+
+ dotest cvsadm-1d20 "${testcvs} co -d dir 1d1mod 1d1mod-2" \
+"${PROG} [a-z]*: Updating dir/dir1d1
+U dir/dir1d1/file1
+${PROG} [a-z]*: Updating dir/dir1d1-2
+U dir/dir1d1-2/file1-2"
+ dotest cvsadm-1d20b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d20d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 1d1mod
+ dotest cvsadm-1d20f "cat dir/dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 1d1mod copy
+ dotest cvsadm-1d20h "cat dir/dir1d1-2/CVS/Repository" \
+"${AREP}mod1-2"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d21 "${testcvs} co -d dir 1d1mod 1d2mod" \
+"${PROG} [a-z]*: Updating dir/dir1d1
+U dir/dir1d1/file1
+${PROG} [a-z]*: Updating dir/dir1d2
+U dir/dir1d2/file2"
+ dotest cvsadm-1d21b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d21d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 1d1mod
+ dotest cvsadm-1d21f "cat dir/dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 1d2mod
+ dotest cvsadm-1d21h "cat dir/dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d22 "${testcvs} co -d dir 1d1mod 2d1mod" \
+"${PROG} [a-z]*: Updating dir/dir1d1
+U dir/dir1d1/file1
+${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
+U dir/dir2d1/sub2d1/file1"
+ dotest cvsadm-1d22b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d22d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 1d1mod
+ dotest cvsadm-1d22f "cat dir/dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 2d1mod
+ dotest cvsadm-1d22h "cat dir/dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-1d22j "cat dir/dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d23 "${testcvs} co -d dir 1d1mod 2d2mod" \
+"${PROG} [a-z]*: Updating dir/dir1d1
+U dir/dir1d1/file1
+${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
+U dir/dir2d2/sub2d2/file2"
+ dotest cvsadm-1d23b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d23d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 1d1mod
+ dotest cvsadm-1d23f "cat dir/dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 2d2mod
+ dotest cvsadm-1d23h "cat dir/dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-1d23j "cat dir/dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+
+ ### 1d2mod
+
+ dotest cvsadm-1d24 "${testcvs} co -d dir 1d2mod 1d2mod-2" \
+"${PROG} [a-z]*: Updating dir/dir1d2
+U dir/dir1d2/file2
+${PROG} [a-z]*: Updating dir/dir1d2-2
+U dir/dir1d2-2/file2-2"
+ dotest cvsadm-1d24b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d24d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 1d2mod
+ dotest cvsadm-1d24f "cat dir/dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 1d2mod copy
+ dotest cvsadm-1d24h "cat dir/dir1d2-2/CVS/Repository" \
+"${AREP}mod2-2/sub2-2"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d25 "${testcvs} co -d dir 1d2mod 2d1mod" \
+"${PROG} [a-z]*: Updating dir/dir1d2
+U dir/dir1d2/file2
+${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
+U dir/dir2d1/sub2d1/file1"
+ dotest cvsadm-1d25b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d25d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 1d2mod
+ dotest cvsadm-1d25f "cat dir/dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 2d1mod
+ dotest cvsadm-1d25h "cat dir/dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-1d25j "cat dir/dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d26 "${testcvs} co -d dir 1d2mod 2d2mod" \
+"${PROG} [a-z]*: Updating dir/dir1d2
+U dir/dir1d2/file2
+${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
+U dir/dir2d2/sub2d2/file2"
+ dotest cvsadm-1d26b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d26d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 1d2mod
+ dotest cvsadm-1d26f "cat dir/dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 2d2mod
+ dotest cvsadm-1d26h "cat dir/dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-1d26j "cat dir/dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+
+ # 2d1mod
+
+ dotest cvsadm-1d27 "${testcvs} co -d dir 2d1mod 2d1mod-2" \
+"${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
+U dir/dir2d1/sub2d1/file1
+${PROG} [a-z]*: Updating dir/dir2d1-2/sub2d1-2
+U dir/dir2d1-2/sub2d1-2/file1-2"
+ dotest cvsadm-1d27b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d27d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 2d1mod
+ dotest cvsadm-1d27f "cat dir/dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-1d27h "cat dir/dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 2d1mod
+ dotest cvsadm-1d27j "cat dir/dir2d1-2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-1d27l "cat dir/dir2d1-2/sub2d1-2/CVS/Repository" \
+"${AREP}mod1-2"
+ rm -rf CVS dir
+
+ dotest cvsadm-1d28 "${testcvs} co -d dir 2d1mod 2d2mod" \
+"${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
+U dir/dir2d1/sub2d1/file1
+${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
+U dir/dir2d2/sub2d2/file2"
+ dotest cvsadm-1d28b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d28d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 2d1mod
+ dotest cvsadm-1d28f "cat dir/dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-1d28h "cat dir/dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ # the usual for 2d2mod
+ dotest cvsadm-1d28j "cat dir/dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-1d28l "cat dir/dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+
+ # 2d2mod
+
+ dotest cvsadm-1d29 "${testcvs} co -d dir 2d2mod 2d2mod-2" \
+"${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
+U dir/dir2d2/sub2d2/file2
+${PROG} [a-z]*: Updating dir/dir2d2-2/sub2d2-2
+U dir/dir2d2-2/sub2d2-2/file2-2"
+ dotest cvsadm-1d29b "cat CVS/Repository" \
+"${AREP}\."
+ # the usual for the dir level
+ dotest cvsadm-1d29d "cat dir/CVS/Repository" \
+"${AREP}\."
+ # the usual for 2d2mod
+ dotest cvsadm-1d29f "cat dir/dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-1d29h "cat dir/dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ # the usual for 2d2mod
+ dotest cvsadm-1d29j "cat dir/dir2d2-2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-1d29l "cat dir/dir2d2-2/sub2d2-2/CVS/Repository" \
+"${AREP}mod2-2/sub2-2"
+ rm -rf CVS dir
+
+ ##################################################
+ ## And now, some of that again using the "-d" flag
+ ## on the command line, but use a longer path.
+ ##################################################
+
+ dotest cvsadm-2d3 "${testcvs} co -d dir/dir2 1mod" \
+"${PROG} [a-z]*: Updating dir/dir2
+U dir/dir2/file1"
+ dotest cvsadm-2d3b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-2d3d "cat dir/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-2d3f "cat dir/dir2/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-2d4 "${testcvs} co -d dir/dir2 2mod" \
+"${PROG} [a-z]*: Updating dir/dir2
+U dir/dir2/file2"
+ dotest cvsadm-2d4b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-2d4d "cat dir/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-2d4f "cat dir/dir2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ dotest cvsadm-2d5 "${testcvs} co -d dir/dir2 1d1mod" \
+"${PROG} [a-z]*: Updating dir/dir2
+U dir/dir2/file1"
+ dotest cvsadm-2d5b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-2d5d "cat dir/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-2d5f "cat dir/dir2/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-2d6 "${testcvs} co -d dir/dir2 1d2mod" \
+"${PROG} [a-z]*: Updating dir/dir2
+U dir/dir2/file2"
+ dotest cvsadm-2d6b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-2d6d "cat dir/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-2d6f "cat dir/dir2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ dotest cvsadm-2d7 "${testcvs} co -d dir/dir2 2d1mod" \
+"${PROG} [a-z]*: Updating dir/dir2
+U dir/dir2/file1"
+ dotest cvsadm-2d7b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-2d7d "cat dir/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-2d7f "cat dir/dir2/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-2d8 "${testcvs} co -d dir/dir2 2d2mod" \
+"${PROG} [a-z]*: Updating dir/dir2
+U dir/dir2/file2"
+ dotest cvsadm-2d8b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-2d8d "cat dir/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-2d8f "cat dir/dir2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ ##################################################
+ ## And now, a few of those tests revisited to
+ ## test the behavior of the -N flag.
+ ##################################################
+
+ dotest cvsadm-N3 "${testcvs} co -N 1mod" \
+"${PROG} [a-z]*: Updating 1mod
+U 1mod/file1"
+ dotest cvsadm-N3b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N3d "cat 1mod/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS 1mod
+
+ dotest cvsadm-N4 "${testcvs} co -N 2mod" \
+"${PROG} [a-z]*: Updating 2mod
+U 2mod/file2"
+ dotest cvsadm-N4b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N4d "cat 2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS 2mod
+
+ dotest cvsadm-N5 "${testcvs} co -N 1d1mod" \
+"${PROG} [a-z]*: Updating dir1d1
+U dir1d1/file1"
+ dotest cvsadm-N5b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N5d "cat dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir1d1
+
+ dotest cvsadm-N6 "${testcvs} co -N 1d2mod" \
+"${PROG} [a-z]*: Updating dir1d2
+U dir1d2/file2"
+ dotest cvsadm-N6b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N6d "cat dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir1d2
+
+ dotest cvsadm-N7 "${testcvs} co -N 2d1mod" \
+"${PROG} [a-z]*: Updating dir2d1/sub2d1
+U dir2d1/sub2d1/file1"
+ dotest cvsadm-N7b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N7d "cat dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-N7f "cat dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir2d1
+
+ dotest cvsadm-N8 "${testcvs} co -N 2d2mod" \
+"${PROG} [a-z]*: Updating dir2d2/sub2d2
+U dir2d2/sub2d2/file2"
+ dotest cvsadm-N8b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N8d "cat dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-N8f "cat dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir2d2
+
+ ## the ones in one-deep directories
+
+ dotest cvsadm-N1d3 "${testcvs} co -N -d dir 1mod" \
+"${PROG} [a-z]*: Updating dir/1mod
+U dir/1mod/file1"
+ dotest cvsadm-N1d3b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N1d3d "cat dir/CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N1d3f "cat dir/1mod/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-N1d4 "${testcvs} co -N -d dir 2mod" \
+"${PROG} [a-z]*: Updating dir/2mod
+U dir/2mod/file2"
+ dotest cvsadm-N1d4b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N1d4d "cat dir/CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N1d4f "cat dir/2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ dotest cvsadm-N1d5 "${testcvs} co -N -d dir 1d1mod" \
+"${PROG} [a-z]*: Updating dir/dir1d1
+U dir/dir1d1/file1"
+ dotest cvsadm-N1d5b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N1d5d "cat dir/CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N1d5d "cat dir/dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-N1d6 "${testcvs} co -N -d dir 1d2mod" \
+"${PROG} [a-z]*: Updating dir/dir1d2
+U dir/dir1d2/file2"
+ dotest cvsadm-N1d6b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N1d6d "cat dir/CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N1d6f "cat dir/dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ dotest cvsadm-N1d7 "${testcvs} co -N -d dir 2d1mod" \
+"${PROG} [a-z]*: Updating dir/dir2d1/sub2d1
+U dir/dir2d1/sub2d1/file1"
+ dotest cvsadm-N1d7b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N1d7d "cat dir/CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N1d7f "cat dir/dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-N1d7h "cat dir/dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-N1d8 "${testcvs} co -N -d dir 2d2mod" \
+"${PROG} [a-z]*: Updating dir/dir2d2/sub2d2
+U dir/dir2d2/sub2d2/file2"
+ dotest cvsadm-N1d8b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N1d8d "cat dir/CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N1d8d "cat dir/dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-N1d8d "cat dir/dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ ## the ones in two-deep directories
+
+ dotest cvsadm-N2d3 "${testcvs} co -N -d dir/dir2 1mod" \
+"${PROG} [a-z]*: Updating dir/dir2/1mod
+U dir/dir2/1mod/file1"
+ dotest cvsadm-N2d3b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N2d3d "cat dir/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-N2d3f "cat dir/dir2/CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N2d3h "cat dir/dir2/1mod/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-N2d4 "${testcvs} co -N -d dir/dir2 2mod" \
+"${PROG} [a-z]*: Updating dir/dir2/2mod
+U dir/dir2/2mod/file2"
+ dotest cvsadm-N2d4b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N2d4d "cat dir/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-N2d4f "cat dir/dir2/CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N2d4h "cat dir/dir2/2mod/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ dotest cvsadm-N2d5 "${testcvs} co -N -d dir/dir2 1d1mod" \
+"${PROG} [a-z]*: Updating dir/dir2/dir1d1
+U dir/dir2/dir1d1/file1"
+ dotest cvsadm-N2d5b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N2d5d "cat dir/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-N2d5f "cat dir/dir2/CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N2d5h "cat dir/dir2/dir1d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-N2d6 "${testcvs} co -N -d dir/dir2 1d2mod" \
+"${PROG} [a-z]*: Updating dir/dir2/dir1d2
+U dir/dir2/dir1d2/file2"
+ dotest cvsadm-N2d6b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N2d6d "cat dir/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-N2d6f "cat dir/dir2/CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N2d6h "cat dir/dir2/dir1d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ dotest cvsadm-N2d7 "${testcvs} co -N -d dir/dir2 2d1mod" \
+"${PROG} [a-z]*: Updating dir/dir2/dir2d1/sub2d1
+U dir/dir2/dir2d1/sub2d1/file1"
+ dotest cvsadm-N2d7b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N2d7d "cat dir/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-N2d7f "cat dir/dir2/CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N2d7f "cat dir/dir2/dir2d1/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-N2d7h "cat dir/dir2/dir2d1/sub2d1/CVS/Repository" \
+"${AREP}mod1"
+ rm -rf CVS dir
+
+ dotest cvsadm-N2d8 "${testcvs} co -N -d dir/dir2 2d2mod" \
+"${PROG} [a-z]*: Updating dir/dir2/dir2d2/sub2d2
+U dir/dir2/dir2d2/sub2d2/file2"
+ dotest cvsadm-N2d8b "cat CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N2d8d "cat dir/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-N2d8f "cat dir/dir2/CVS/Repository" \
+"${AREP}\."
+ dotest cvsadm-N2d8h "cat dir/dir2/dir2d2/CVS/Repository" \
+"${AREP}CVSROOT/Emptydir"
+ dotest cvsadm-N2d8j "cat dir/dir2/dir2d2/sub2d2/CVS/Repository" \
+"${AREP}mod2/sub2"
+ rm -rf CVS dir
+
+ ##################################################
+ ## That's enough of that, thank you very much.
+ ##################################################
+
+ # remove our junk
+ cd ..
+ rm -rf 1
+ rm -rf ${CVSROOT_DIRNAME}/1mod
+ rm -rf ${CVSROOT_DIRNAME}/1mod-2
+ rm -rf ${CVSROOT_DIRNAME}/2mod
+ rm -rf ${CVSROOT_DIRNAME}/2mod-2
+ ;;
+
+ diffmerge1)
+ # Make sure CVS can merge correctly in circumstances where it
+ # used to mess up (due to a bug which existed in diffutils 2.7
+ # and 2.6, but not 2.5, and which has been fixed in CVS's diff
+ # lib by Paul Eggert, bless his bitty heart).
+
+ # This first test involves two working copies, "mine" and
+ # "yours", checked out from the same repository at the same
+ # time. In yours, you remove some text from the end of the
+ # file and check it in; meanwhile, "me" has commented out some
+ # lines earlier in the file, and I go to check it in right
+ # after you checked yours in. CVS naturally tells me the file
+ # is not up-to-date, so I run cvs update, but it updates
+ # incorrectly, leaving in the lines of text you just deleted.
+ # Bad! I'm in too much of a hurry to actually look at the
+ # file, so I check it in and go home, and so your changes have
+ # been lost. Later you discover this, and you suspect me of
+ # deliberately sabotaging your work, so you let all the air
+ # out of my tires. Only after a series of expensive lawsuits
+ # and countersuits do we discover it this was all CVS's
+ # fault.
+ #
+ # Luckily, this problem has been fixed now, as our test will
+ # handily confirm, no doubt:
+
+ # First make a repository containing the original text:
+
+ # We should be here anyway, but cd to it just in case:
+ cd ${TESTDIR}
+
+ mkdir diffmerge1
+ cd diffmerge1
+
+ # The text of the file is inlined here because `echo' loses
+ # newlines, and I don't know how portable the -e flag is.
+ #
+ # This is the file we both start out with:
+ echo "// Button.java
+
+package random.application;
+
+import random.util.star;
+
+public class Button
+{
+ /star Instantiates a Button with origin (0, 0) and zero width and height.
+ star You must call an initializer method to properly initialize the Button.
+ star/
+ public Button ()
+ {
+ super ();
+
+ _titleColor = Color.black;
+ _disabledTitleColor = Color.gray;
+ _titleFont = Font.defaultFont ();
+ }
+
+ /star Convenience constructor for instantiating a Button with
+ star bounds x, y, width, and height. Equivalent to
+ star foo = new Button ();
+ star foo.init (x, y, width, height);
+ star/
+ public Button (int x, int y, int width, int height)
+ {
+ this ();
+ init (x, y, width, height);
+ }
+}" > the_file
+
+ dotest diffmerge1_import \
+ "${testcvs} import -m import diffmerge1 tag1 tag2" \
+ "${DOTSTAR}No conflicts created by this import"
+ cd ..
+ rm -rf diffmerge1
+
+ # Check out two working copies, one for "you" and one for "me"
+ ${testcvs} checkout diffmerge1 >/dev/null 2>&1
+ mv diffmerge1 diffmerge1_yours
+ ${testcvs} checkout diffmerge1 >/dev/null 2>&1
+ mv diffmerge1 diffmerge1_mine
+
+ # In your working copy, you'll remove the Button() method, and
+ # then check in your change before I check in mine:
+ cd diffmerge1_yours
+ echo "// Button.java
+
+package random.application;
+
+import random.util.star;
+
+public class Button
+{
+ /star Instantiates a Button with origin (0, 0) and zero width and height.
+ star You must call an initializer method to properly initialize the Button.
+ star/
+ public Button ()
+ {
+ super ();
+
+ _titleColor = Color.black;
+ _disabledTitleColor = Color.gray;
+ _titleFont = Font.defaultFont ();
+ }
+}" > the_file
+ dotest diffmerge1_yours \
+ "${testcvs} ci -m yours" \
+ "${DOTSTAR}hecking in ${DOTSTAR}"
+
+ # My working copy still has the Button() method, but I
+ # comment out some code at the top of the class. Then I
+ # update, after both my modifications and your checkin:
+ cd ../diffmerge1_mine
+ echo "// Button.java
+
+package random.application;
+
+import random.util.star;
+
+public class Button
+{
+ /star Instantiates a Button with origin (0, 0) and zero width and height.
+ star You must call an initializer method to properly initialize the Button.
+ star/
+ public Button ()
+ {
+ super ();
+
+ // _titleColor = Color.black;
+ // _disabledTitleColor = Color.gray;
+ // _titleFont = Font.defaultFont ();
+ }
+
+ /star Convenience constructor for instantiating a Button with
+ star bounds x, y, width, and height. Equivalent to
+ star foo = new Button ();
+ star foo.init (x, y, width, height);
+ star/
+ public Button (int x, int y, int width, int height)
+ {
+ this ();
+ init (x, y, width, height);
+ }
+}" > the_file
+ dotest diffmerge1_mine \
+ "${testcvs} update" \
+ "${DOTSTAR}erging${DOTSTAR}"
+
+ # So if your changes didn't make it into my working copy, or
+ # in any case if the file does not look like the final text as
+ # quoted below, then the test flunks:
+ echo "// Button.java
+
+package random.application;
+
+import random.util.star;
+
+public class Button
+{
+ /star Instantiates a Button with origin (0, 0) and zero width and height.
+ star You must call an initializer method to properly initialize the Button.
+ star/
+ public Button ()
+ {
+ super ();
+
+ // _titleColor = Color.black;
+ // _disabledTitleColor = Color.gray;
+ // _titleFont = Font.defaultFont ();
+ }
+}" > comp_me
+ dotest diffmerge1_cmp "cmp the_file comp_me" ''
+
+ # Clean up after ourselves:
+ cd ..
+ rm -rf diffmerge1_yours diffmerge1_mine ${CVSROOT_DIRNAME}/diffmerge1
+
+ ;;
+
+ diffmerge2)
+
+ # FIXME: This test should be rewritten to be much more concise.
+ # It currently weighs in at something like 600 lines, but the
+ # same thing could probably be tested in more like 50-100 lines.
+ mkdir diffmerge2
+
+ # This tests for another diffmerge bug reported by Martin
+ # Tomes; actually, his bug was probably caused by an initial
+ # fix for the bug in test diffmerge1, and likely wasn't ever
+ # a problem in CVS as long as one was using a normal
+ # distribution of diff or a version of CVS that has the diff
+ # lib in it.
+ #
+ # Nevertheless, once burned twice cautious, so we test for his
+ # bug here.
+ #
+ # Here is his report, more or less verbatim:
+ # ------------------------------------------
+ #
+ # Put the attached file (sgrid.h,v) into your repository
+ # somewhere, check out the module and do this:
+ #
+ # cvs update -j Review_Phase_2_Enhancements sgrid.h
+ # cvs diff -r Review_V1p3 sgrid.h
+ #
+ # As there have been no changes made on the trunk there
+ # should be no differences, however this is output:
+ #
+ # % cvs diff -r Review_V1p3 sgrid.h
+ # Index: sgrid.h
+ # ===================================================================
+ # RCS file: /usr/local/repository/play/fred/sgrid.h,v
+ # retrieving revision 1.1.2.1
+ # diff -r1.1.2.1 sgrid.h
+ # 178a179,184
+ # > /*--------------------------------------------------------------
+ # > INLINE FUNCTION : HORIZONTALLINES
+ # > NOTES : Description at the end of the file
+ # > ----------------------------------------------------------------*/
+ # > uint16 horizontalLines( void );
+ # >
+ #
+ # I did a cvs diff -c -r 1.1 -r 1.1.2.1 sgrid.h and patched those
+ # differences to sgrid.h version 1.1 and got the correct result
+ # so it looks like the built in patch is faulty.
+ # -------------------------------------------------------------------
+ #
+ # This is the RCS file, sgrid.h,v, that he sent:
+
+ echo "head 1.1;
+access;
+symbols
+ Review_V1p3:1.1.2.1
+ Review_V1p3C:1.1.2.1
+ Review_1p3A:1.1.2.1
+ Review_V1p3A:1.1.2.1
+ Review_Phase_2_Enhancements:1.1.0.2
+ Review_V1p2:1.1
+ Review_V1p2B:1.1
+ Review_V1p2A:1.1
+ Review_V1p1:1.1
+ Review_1p1:1.1;
+locks; strict;
+comment @ * @;
+
+
+1.1
+date 97.04.02.11.20.05; author colinl; state Exp;
+branches
+ 1.1.2.1;
+next ;
+
+1.1.2.1
+date 97.06.09.10.00.07; author colinl; state Exp;
+branches;
+next ;
+
+
+desc
+@@
+
+
+1.1
+log
+@Project: DEV1175
+DCN:
+Tested By: Colin Law
+Reviewed By:
+Reason for Change: Initial Revision of all files
+
+Design Change Details:
+
+Implications:
+@
+text
+@/* \$""Header: L:/gpanels/dis/sgrid.h_v 1.1.1.0 24 Jan 1996 14:59:20 PAULT \$ */
+/*
+ * \$""Log: L:/gpanels/dis/sgrid.h_v \$
+ *
+ * Rev 1.1.1.0 24 Jan 1996 14:59:20 PAULT
+ * Branched
+ *
+ * Rev 1.1 24 Jan 1996 12:09:52 PAULT
+ * Consolidated 4100 code merged to trunk
+ *
+ * Rev 1.0.2.0 01 Jun 1995 14:18:58 DAVEH
+ * Branched
+ *
+ * Rev 1.0 19 Apr 1995 16:32:48 COLINL
+ * Initial revision.
+*/
+/*****************************************************************************
+FILE : SGRID.H
+VERSION : 2.1
+AUTHOR : Dave Hartley
+SYSTEM : Borland C++
+DESCRIPTION : The declaration of the scrolling grid class
+
+*****************************************************************************/
+#if !defined(__SGRID_H)
+#define __SGRID_H
+
+#if !defined(__SCROLL_H)
+#include <scroll.h>
+#endif
+
+#if !defined(__GKI_H)
+#include \"gki.h\"
+#endif
+
+#if defined PRINTING_SUPPORT
+class Printer;
+#endif
+
+/*****************************************************************************
+CLASS : ScrollingGrid
+DESCRIPTION: This class inherits from a grid and a scrollable, and
+ can therefore use all the PUBLIC services provided by these
+ classes. A description of these can be found in
+ GRID.H and SCROLL.H.
+ A scrolling grid is a set of horizontal and vertical lines
+ that scroll and continually update to provide a complete grid
+
+*****************************************************************************/
+
+class ScrollingGrid : public Scrollable
+{
+ public:
+#if defined _WINDOWS
+/*---------------------------------------------------------------------------
+FUNCTION : CONSTRUCTOR
+DESCRIPTION : sets up the details of the grid, ready for painting
+ARGUMENTS : name : sgColour
+ - the colour of the grid
+ sgLineType
+ - the syle of line
+ sgHorizontalTotal
+ - the total number of horizontal grid lines
+ verticalSpacingMin
+ - the min distance between the vertical grid lines
+ on the scrolling axis
+ currentTimestamp
+ - timestamp value now
+ ticksPerSecond
+ - number of timestamp ticks per second
+ ticksPerPixel
+ - number of timestamp ticks per pixel required
+
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType,
+ uint16 sgHorizontalTotal,
+ uint16 verticalSpacingMin, uint32 currentTimestamp,
+ uint16 ticksPerSecond, uint32 ticksPerPixel );
+#else
+/*---------------------------------------------------------------------------
+FUNCTION : CONSTRUCTOR
+DESCRIPTION : sets up the details of the grid, ready for painting
+ARGUMENTS : name : sgColour
+ - the colour of the grid
+ sgLineType
+ - the syle of line
+ sgHorizontalTotal ( THE MAX NUMBER OF LINES IS 100 )
+ - the total number of horizontal grid lines
+ sgVerticalSpacing
+ - the distance between the vertical grid lines
+ on the scrolling axis
+
+RETURN : None
+NOTES : If the caller does not get the total grid lines value, synced
+ with the overall size of the viewport, the spacing between
+ grid lines will not be consistent.
+
+---------------------------------------------------------------------------*/
+ ScrollingGrid( GkiColour sgColour, GkiLineType sgLineType
+ , uint16 sgHorizontalTotal, uint16 sgVerticalSpacing );
+#endif
+/*---------------------------------------------------------------------------
+FUNCTION : DESTRUCTOR
+DESCRIPTION : tidies it all up
+ARGUMENTS : name :
+
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ ~ScrollingGrid( void );
+
+/*---------------------------------------------------------------------------
+FUNCTION : ATTACH
+DESCRIPTION : This service overloads the base class service, as it does
+ additional work at the time of attachment.
+
+ARGUMENTS : name : tDrawingArea
+ - the scrolled viewport to attach this trend to
+
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void attach( SViewport *tDrawingArea );
+
+#if defined _WINDOWS
+/*---------------------------------------------------------------------------
+FUNCTION : calculateVerticalSpacing
+DESCRIPTION : determines optimum spacing along time axis
+ARGUMENTS :
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void calculateVerticalSpacing();
+
+/*---------------------------------------------------------------------------
+FUNCTION : gridSpacingTicks
+DESCRIPTION : Provides the grid spacing in the time axis in ticks
+ARGUMENTS :
+RETURN : Number of ticks
+NOTES :
+---------------------------------------------------------------------------*/
+ uint32 gridSpacingTicks();
+
+#endif
+
+/*---------------------------------------------------------------------------
+INLINE FUNCTION : HORIZONTALLINES
+NOTES : Description at the end of the file
+---------------------------------------------------------------------------*/
+ uint16 horizontalLines( void );
+
+#if defined _WINDOWS
+// In Windows the OnDraw() function replaces paint()
+/*---------------------------------------------------------------------------
+FUNCTION : ScrollingGrid OnDraw
+DESCRIPTION : Paints the given area of the grid.
+ Pure virtual
+ARGUMENTS : pDC pointer to the device context to use for display
+ Note that the device context operates in the coords
+ of the window owning the viewport
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ virtual void OnDraw( CDC *pDC );
+
+#else // not Windows
+
+/*---------------------------------------------------------------------------
+FUNCTION : PAINT
+DESCRIPTION : This extends the standard grid paint method to paint the
+ viewport relative to its current position.
+
+ARGUMENTS : name :
+
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void paint( void );
+#endif
+
+/*---------------------------------------------------------------------------
+FUNCTION : P A I N T T E X T M A R K E R S
+DESCRIPTION : this service allow the text markers to be painted seperatley
+ from the grid lines
+
+ARGUMENTS : name :
+
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void paintTextMarkers();
+
+#if defined PRINTING_SUPPORT
+/*---------------------------------------------------------------------------
+FUNCTION : P R I N T
+DESCRIPTION : This print service prints a grid marker ( being either a
+ timestamp or a date, IF there is one at the plot position
+ given
+
+ARGUMENTS : name :
+ displayPosition
+ - Where in the log to look to see if there is an
+ entry to print
+
+ - printerPtr
+ the printer to print to
+
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void print( uint16 currentPrintPos, Printer *printerPtr );
+#endif
+
+/*---------------------------------------------------------------------------
+FUNCTION : S E T D R I V E D I R E C T I O N
+DESCRIPTION : Sets direction for update and scrolling forwards or backwards
+ARGUMENTS : direction - required direction
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void setDriveDirection( ScrollDirection direction );
+
+/*---------------------------------------------------------------------------
+FUNCTION : S E T U P
+DESCRIPTION : service that will setup the grid prior to a paint
+
+ARGUMENTS : name :
+ - newTimestamp
+
+
+ - newTimeBase
+ the number of ticks that represent a plot point on
+ the trendgraph.
+
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void setup( uint32 newTimestamp, uint32 newTimeBase );
+
+#if defined PRINTING_SUPPORT
+/*---------------------------------------------------------------------------
+FUNCTION : S E T U P F O R P R I N T
+DESCRIPTION : This service iis to be called prior to printing. It allows
+ the grid to prepare its markers ready for the print
+ commands
+
+ARGUMENTS : name :
+
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void setupForPrint();
+#endif
+
+/*---------------------------------------------------------------------------
+FUNCTION : UPDATE
+DESCRIPTION : When this service is called it will calculate what needs to
+ be painted and fill in the display again.
+
+ARGUMENTS : name : timeStamp
+ - the reference time of this update.
+
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void update( uint32 timeStamp );
+
+/*---------------------------------------------------------------------------
+FUNCTION : U P D A T E B U F F E R
+DESCRIPTION : When a display update is not required, use this method. It
+ updates the internal data ready for a call to paint that
+ will then show the grid in the right position
+
+ARGUMENTS : name :
+
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void updateBuffer( void );
+
+ private:
+
+/*---------------------------------------------------------------------------
+FUNCTION : M A K E G R I D M A R K E R
+DESCRIPTION : service that perpares a string for display. The string will
+ either be a short date, or short time. this is determined
+ by the current setting of the dateMarker flag
+
+ARGUMENTS : name : timestampVal
+ - the value to convert
+
+ storePtr
+ - the place to put the string
+
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void makeGridMarker( uint32 timestampVal, char *storePtr );
+
+/*---------------------------------------------------------------------------
+FUNCTION : P A I N T G R I D M A R K E R
+DESCRIPTION : given a position will put the string on the display
+
+ARGUMENTS : name :
+ yPos
+ - were it goes on the Y-axis
+
+ gridMarkerPtr
+ - what it is
+
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void paintGridMarker( uint16 yPos, char *gridMarkerPtr );
+
+#if defined _WINDOWS
+/*---------------------------------------------------------------------------
+FUNCTION : PAINTHORIZONTALLINES
+DESCRIPTION : responsible for painting the grids horizontal lines
+ARGUMENTS : pRectToDraw pointer to rectangle that needs refreshing.
+ in viewport coords
+ pDC pointer to device context to use
+
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void paintHorizontalLines(RectCoords* pRectToDraw, CDC* pDC );
+#else
+/*---------------------------------------------------------------------------
+FUNCTION : PAINTHORIZONTALLINES
+DESCRIPTION : responsible for painting the grids horizontal lines
+ARGUMENTS : name: xStart
+ - the starting X co-ordinate for the horizontal line
+ xEnd
+ - the ending X co-ordinate for the horizontal line
+
+RETURN : None
+NOTES : Remember lines are drawn from origin. The origin in a
+ horizontal viewport will be the top.
+---------------------------------------------------------------------------*/
+ void paintHorizontalLines( uint16 xStart, uint16 xEnd );
+#endif
+
+#if defined _WINDOWS
+/*---------------------------------------------------------------------------
+FUNCTION : PAINTVERTICALLINES
+DESCRIPTION : responsible for painting the grids vertical lines
+ARGUMENTS : pRectToDraw pointer to rectangle that needs refreshing.
+ in viewport coords
+ offset offset from rhs that rightmost line would be
+ drawn if rectangle included whole viewport
+ pDC pointer to device context to use
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void paintVerticalLines( RectCoords* pRectToDraw, uint16 offset,
+ CDC* pDC );
+#else
+/*---------------------------------------------------------------------------
+FUNCTION : PAINTVERTICALLINES
+DESCRIPTION : responsible for painting the grids vertical lines
+ARGUMENTS : name : yStart
+ - the starting Y co-ordinate for the vertical line
+ yEnd
+ - the ending Y co-ordinate for the vertical line
+ offset
+ - a starting point offset that determines at what X
+ position the first line will be drawn
+
+
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void paintVerticalLines( uint16 yStart, uint16 yEnd, uint16 offset );
+#endif
+
+#if defined _WINDOWS
+/*---------------------------------------------------------------------------
+FUNCTION : PAINTVERTICALLINE
+DESCRIPTION : paints one line at the position specified, and length
+ARGUMENTS : name : yStart
+ - the starting point on the y axis for the line
+ yEnd
+ - the end point on the y axis for the line
+ xPosition
+ - The horizontal offset from the start of the viewport
+ pDC pointer to device context to use
+
+RETURN : None
+NOTES : There is not an equivalent horizontal method as yet. This
+ is a seperate method because the service is useful to a
+ derivation of this class
+---------------------------------------------------------------------------*/
+ void paintVerticalLine( uint16 yStart, uint16 yEnd
+ , uint16 xPosition, CDC *pDC );
+#else
+/*---------------------------------------------------------------------------
+FUNCTION : PAINTVERTICALLINE
+DESCRIPTION : paints one line at the position specified, and length
+ARGUMENTS : name : yStart
+ - the starting point on the y axis for the line
+ yEnd
+ - the end point on the y axis for the line
+ xPosition
+ - The horizontal offset from the start of the viewport
+
+RETURN : None
+NOTES : There is not an equivalent horizontal method as yet. This
+ is a seperate method because the service is useful to a
+ derivation of this class
+---------------------------------------------------------------------------*/
+ void paintVerticalLine( uint16 yStart, uint16 yEnd
+ , uint16 xPosition );
+#endif
+
+/*---------------------------------------------------------------------------
+INLINE FUNCTION : VERTICALSPACING
+NOTES : Description at the end of the file
+---------------------------------------------------------------------------*/
+ uint16 verticalSpacing( void );
+
+
+ // Position in viewport that we are now writing to if going forwards
+ // Note that if this is greater than viewport length then we have
+ // just scrolled and value must be adjusted before use.
+ sint16 forwardsOutputPosition;
+
+ // Position in viewport that we are now writing to if going backwards
+ // Note that if this is less than zero then we have
+ // just scrolled and value must be adjusted before use.
+ sint16 backwardsOutputPosition;
+
+ // position in grid cycle of forwards output position.
+ // if zero then it is time to output a grid line
+ sint16 forwardsIntervalCount;
+
+ // position in grid cycle of forwards output position.
+ // if zero then it is time to output a grid line
+ sint16 backwardsIntervalCount;
+
+ uint32 lastUpdateTimestamp;
+ uint32 timeBase; // ticks per pixel
+ uint16 currentOutputPosition;
+ uint16 gridTimestampSpacing;
+ uint16 intervalCount;
+ uint16 horizontalTotal;
+ uint16 vSpacing;
+#if defined PRINTING_SUPPORT
+ uint16 numberOfGridMarkersPrinted;
+#endif
+ bool firstTime; // indicates first time through
+ bool dateMarker;
+
+ GkiLineType lineType;
+ GkiColour gridColour;
+
+ #if defined _WINDOWS
+ uint16 ticksPerSec; // number of time ticks per second
+ uint16 vSpacingMin; // minimum pixels per division along time axis
+ CPen *pPen; // the pen to use for drawing in windows
+ #endif
+
+};
+
+
+/*****************************************************************************
+ I N L I N E F U N C T I O N S
+*****************************************************************************/
+
+/*---------------------------------------------------------------------------
+FUNCTION : HORIZONTALLINES
+DESCRIPTION : supplies the number of horizontal lines in the grid
+ARGUMENTS : name :
+
+RETURN :
+NOTES :
+---------------------------------------------------------------------------*/
+inline uint16 ScrollingGrid::horizontalLines( void )
+{
+ return( horizontalTotal );
+}
+/*---------------------------------------------------------------------------
+FUNCTION : VERTICALSPACING
+DESCRIPTION : returns the distance between adjacent vertical lines
+ARGUMENTS : name :
+
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+inline uint16 ScrollingGrid::verticalSpacing( void )
+{
+ return( vSpacing );
+}
+
+#endif
+@
+
+
+1.1.2.1
+log
+@DEV1194:DS4 Provision of major and minor grid lines
+@
+text
+@d1 1
+a1 1
+/* \$""Header: /usr/local/repository/cmnsrc/review/src/sgrid.h,v 1.1 1997/04/02 11:20:05 colinl Exp \$ */
+d3 1
+a3 12
+ * \$""Log: sgrid.h,v \$
+ * Revision 1.1 1997/04/02 11:20:05 colinl
+ * Project: DEV1175
+ * DCN:
+ * Tested By: Colin Law
+ * Reviewed By:
+ * Reason for Change: Initial Revision of all files
+ *
+ * Design Change Details:
+ *
+ * Implications:
+ *
+d58 6
+a63 5
+ARGUMENTS : name : majorColour colour for major grid lines
+ minorColour colour for minor grid lines
+ sgLineType line type for minor grid lines
+ yMajorGridLines number of major y lines on grid
+ yMinorGridLines number of major y lines on grid
+d77 2
+a78 3
+ ScrollingGrid( GkiColour majorColour, GkiColour minorColour,
+ GkiLineType sgLineType,
+ uint16 yMajorGridLines, uint16 yMinorGridLines,
+a137 17
+FUNCTION : DrawHorizontalGridLines
+
+DESCRIPTION : Draws major or minor grid lines
+ARGUMENTS : pDC device context
+ pPen pen to use
+ numLines total lines required
+ yLow, yHigh, xLow, xHigh rectangle to draw in
+ yMax max y value
+RETURN : None
+NOTES :
+---------------------------------------------------------------------------*/
+ void DrawHorizontalGridLines( CDC* pDC, CPen* pPen,
+ uint16 numLines,
+ uint16 yLow, uint16 yHigh, uint16 xLow, uint16 xHigh,
+ uint16 yMax );
+
+/*---------------------------------------------------------------------------
+d148 6
+d448 1
+a448 2
+ uint16 m_yMajorGridLines;
+ uint16 m_yMinorGridLines;
+d456 2
+a457 3
+ GkiLineType lineType; // line type for minor grid lines
+ GkiColour m_majorColour;
+ GkiColour m_minorColour;
+d462 1
+a462 2
+ CPen *pMajorPen; // pen to use for drawing major grid lines
+ CPen *pMinorPen; // pen to use for drawing minor grid lines
+d472 12
+@" > diffmerge2/sgrid.h,v
+
+ # We have to put the RCS file in the repository by hand for
+ # this test:
+ mkdir ${CVSROOT_DIRNAME}/diffmerge2
+ cp diffmerge2/sgrid.h,v ${CVSROOT_DIRNAME}/diffmerge2/sgrid.h,v
+ rm -rf diffmerge2
+ dotest diffmerge2_co \
+ "${testcvs} co diffmerge2" "${DOTSTAR}U ${DOTSTAR}"
+ cd diffmerge2
+ dotest diffmerge2_update \
+ "${testcvs} update -j Review_Phase_2_Enhancements sgrid.h" \
+ "${DOTSTAR}erging ${DOTSTAR}"
+ # This is the one that counts -- there should be no output:
+ dotest diffmerge2_diff \
+ "${testcvs} diff -r Review_V1p3 sgrid.h" ''
+
;;
*)
@@ -6891,7 +13327,6 @@ echo "OK, all tests completed."
# * Test all flags in modules file.
# Test that ciprog gets run both on checkin in that directory, or a
# higher-level checkin which recurses into it.
-# * More tests of keyword expansion.
# * Test operations on a directory that contains other directories but has
# no files of its own.
# * -t global option
@@ -6909,7 +13344,8 @@ echo "OK, all tests completed."
# same).
# * Test that remote edit and/or unedit works when disconnected from
# server (e.g. set CVS_SERVER to "foobar").
-# * Test things to do with the CVS/* files, esp. CVS/Root....
+# * Test the contents of adm files other than Root and Repository.
+# Entries seems the next most important thing.
# End of TODO list.
# Remove the test directory, but first change out of it.
diff --git a/contrib/cvs/src/scramble.c b/contrib/cvs/src/scramble.c
index 07094a6..77376fa 100644
--- a/contrib/cvs/src/scramble.c
+++ b/contrib/cvs/src/scramble.c
@@ -50,23 +50,23 @@
*/
static unsigned char
-shifts[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
-17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 114, 120,
-53, 79, 96, 109, 72, 108, 70, 64, 76, 67, 116, 74, 68, 87, 111, 52,
-75, 119, 49, 34, 82, 81, 95, 65, 112, 86, 118, 110, 122, 105, 41, 57,
-83, 43, 46, 102, 40, 89, 38, 103, 45, 50, 42, 123, 91, 35, 125, 55,
-54, 66, 124, 126, 59, 47, 92, 71, 115, 78, 88, 107, 106, 56, 36, 121,
-117, 104, 101, 100, 69, 73, 99, 63, 94, 93, 39, 37, 61, 48, 58, 113,
-32, 90, 44, 98, 60, 51, 33, 97, 62, 77, 84, 80, 85, 223, 225, 216,
-187, 166, 229, 189, 222, 188, 141, 249, 148, 200, 184, 136, 248, 190,
-199, 170, 181, 204, 138, 232, 218, 183, 255, 234, 220, 247, 213, 203,
-226, 193, 174, 172, 228, 252, 217, 201, 131, 230, 197, 211, 145, 238,
-161, 179, 160, 212, 207, 221, 254, 173, 202, 146, 224, 151, 140, 196,
-205, 130, 135, 133, 143, 246, 192, 159, 244, 239, 185, 168, 215, 144,
-139, 165, 180, 157, 147, 186, 214, 176, 227, 231, 219, 169, 175, 156,
-206, 198, 129, 164, 150, 210, 154, 177, 134, 127, 182, 128, 158, 208,
-162, 132, 167, 209, 149, 241, 153, 251, 237, 236, 171, 195, 243, 233,
-253, 240, 194, 250, 191, 155, 142, 137, 245, 235, 163, 242, 178, 152 };
+shifts[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 114,120, 53, 79, 96,109, 72,108, 70, 64, 76, 67,116, 74, 68, 87,
+ 111, 52, 75,119, 49, 34, 82, 81, 95, 65,112, 86,118,110,122,105,
+ 41, 57, 83, 43, 46,102, 40, 89, 38,103, 45, 50, 42,123, 91, 35,
+ 125, 55, 54, 66,124,126, 59, 47, 92, 71,115, 78, 88,107,106, 56,
+ 36,121,117,104,101,100, 69, 73, 99, 63, 94, 93, 39, 37, 61, 48,
+ 58,113, 32, 90, 44, 98, 60, 51, 33, 97, 62, 77, 84, 80, 85,223,
+ 225,216,187,166,229,189,222,188,141,249,148,200,184,136,248,190,
+ 199,170,181,204,138,232,218,183,255,234,220,247,213,203,226,193,
+ 174,172,228,252,217,201,131,230,197,211,145,238,161,179,160,212,
+ 207,221,254,173,202,146,224,151,140,196,205,130,135,133,143,246,
+ 192,159,244,239,185,168,215,144,139,165,180,157,147,186,214,176,
+ 227,231,219,169,175,156,206,198,129,164,150,210,154,177,134,127,
+ 182,128,158,208,162,132,167,209,149,241,153,251,237,236,171,195,
+ 243,233,253,240,194,250,191,155,142,137,245,235,163,242,178,152 };
/* SCRAMBLE and DESCRAMBLE work like this:
@@ -85,57 +85,56 @@ shifts[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
/* Return a malloc'd, scrambled version of STR. */
char *
scramble (str)
- char *str;
+ char *str;
{
- int i;
- char *s;
+ int i;
+ char *s;
- /* +2 to hold the 'A' prefix that indicates which version of
- * scrambling this is (the first, obviously, since we only do one
- * kind of scrambling so far), and then the '\0' of course.
- */
- s = (char *) xmalloc (strlen (str) + 2);
+ /* +2 to hold the 'A' prefix that indicates which version of
+ scrambling this is (the first, obviously, since we only do one
+ kind of scrambling so far), and then the '\0' of course. */
+ s = (char *) xmalloc (strlen (str) + 2);
- s[0] = 'A'; /* Scramble (TM) version prefix. */
- strcpy (s + 1, str);
+ /* Scramble (TM) version prefix. */
+ s[0] = 'A';
+ strcpy (s + 1, str);
- for (i = 1; s[i]; i++)
- s[i] = shifts[(unsigned char)(s[i])];
+ for (i = 1; s[i]; i++)
+ s[i] = shifts[(unsigned char)(s[i])];
- return s;
+ return s;
}
/* Decode the string in place. */
char *
descramble (str)
- char *str;
+ char *str;
{
- char *s;
- int i;
+ char *s;
+ int i;
- /* For now we can only handle one kind of scrambling. In the future
- * there may be other kinds, and this `if' will become a `switch'.
- */
- if (str[0] != 'A')
+ /* For now we can only handle one kind of scrambling. In the future
+ there may be other kinds, and this `if' will become a `switch'. */
+ if (str[0] != 'A')
#ifndef DIAGNOSTIC
- error (1, 0, "descramble: unknown scrambling method");
+ error (1, 0, "descramble: unknown scrambling method");
#else /* DIAGNOSTIC */
- {
- fprintf (stderr, "descramble: unknown scrambling method\n", str);
- fflush (stderr);
- exit (EXIT_FAILURE);
- }
+ {
+ fprintf (stderr, "descramble: unknown scrambling method\n", str);
+ fflush (stderr);
+ exit (EXIT_FAILURE);
+ }
#endif /* DIAGNOSTIC */
- /* Method `A' is symmetrical, so scramble again to decrypt. */
- s = scramble (str + 1);
+ /* Method `A' is symmetrical, so scramble again to decrypt. */
+ s = scramble (str + 1);
- /* Shift the whole string one char to the left, pushing the unwanted
- 'A' off the left end. Safe, because s is null-terminated. */
- for (i = 0; s[i]; i++)
- s[i] = s[i + 1];
+ /* Shift the whole string one char to the left, pushing the unwanted
+ 'A' off the left end. Safe, because s is null-terminated. */
+ for (i = 0; s[i]; i++)
+ s[i] = s[i + 1];
- return s;
+ return s;
}
#endif /* (AUTH_CLIENT_SUPPORT || AUTH_SERVER_SUPPORT) from top of file */
@@ -144,38 +143,38 @@ descramble (str)
int
main ()
{
- int i;
- char *e, *m, biggie[256];
-
- char *cleartexts[5];
- cleartexts[0] = "first";
- cleartexts[1] = "the second";
- cleartexts[2] = "this is the third";
- cleartexts[3] = "$#% !!\\3";
- cleartexts[4] = biggie;
-
- /* Set up the most important test string: */
- /* Can't have a real ASCII zero in the string, because we want to
- use printf, so we substitute the character zero. */
- biggie[0] = '0';
- /* The rest of the string gets straight ascending ASCII. */
- for (i = 1; i < 256; i++)
- biggie[i] = i;
-
- /* Test all the strings. */
- for (i = 0; i < 5; i++)
+ int i;
+ char *e, *m, biggie[256];
+
+ char *cleartexts[5];
+ cleartexts[0] = "first";
+ cleartexts[1] = "the second";
+ cleartexts[2] = "this is the third";
+ cleartexts[3] = "$#% !!\\3";
+ cleartexts[4] = biggie;
+
+ /* Set up the most important test string: */
+ /* Can't have a real ASCII zero in the string, because we want to
+ use printf, so we substitute the character zero. */
+ biggie[0] = '0';
+ /* The rest of the string gets straight ascending ASCII. */
+ for (i = 1; i < 256; i++)
+ biggie[i] = i;
+
+ /* Test all the strings. */
+ for (i = 0; i < 5; i++)
{
- printf ("clear%d: %s\n", i, cleartexts[i]);
- e = scramble (cleartexts[i]);
- printf ("scram%d: %s\n", i, e);
- m = descramble (e);
- free (e);
- printf ("clear%d: %s\n\n", i, m);
- free (m);
+ printf ("clear%d: %s\n", i, cleartexts[i]);
+ e = scramble (cleartexts[i]);
+ printf ("scram%d: %s\n", i, e);
+ m = descramble (e);
+ free (e);
+ printf ("clear%d: %s\n\n", i, m);
+ free (m);
}
- fflush (stdout);
- return 0;
+ fflush (stdout);
+ return 0;
}
#endif /* DIAGNOSTIC */
diff --git a/contrib/cvs/src/server.c b/contrib/cvs/src/server.c
index dece2ca..8d7d119 100644
--- a/contrib/cvs/src/server.c
+++ b/contrib/cvs/src/server.c
@@ -22,16 +22,16 @@
#include <winsock.h>
#endif
-#if defined (AUTH_SERVER_SUPPORT) || defined (HAVE_KERBEROS)
+#if defined (AUTH_SERVER_SUPPORT) || defined (HAVE_KERBEROS) || defined (HAVE_GSSAPI)
#include <sys/socket.h>
#endif
#ifdef HAVE_KERBEROS
-#include <netinet/in.h>
-#include <krb.h>
-#ifndef HAVE_KRB_GET_ERR_TEXT
-#define krb_get_err_text(status) krb_err_txt[status]
-#endif
+# include <netinet/in.h>
+# include <krb.h>
+# ifndef HAVE_KRB_GET_ERR_TEXT
+# define krb_get_err_text(status) krb_err_txt[status]
+# endif
/* Information we need if we are going to use Kerberos encryption. */
static C_Block kblock;
@@ -39,6 +39,34 @@ static Key_schedule sched;
#endif
+#ifdef HAVE_GSSAPI
+
+#include <netdb.h>
+#include <gssapi/gssapi.h>
+#include <gssapi/gssapi_generic.h>
+
+/* We use Kerberos 5 routines to map the GSSAPI credential to a user
+ name. */
+#include <krb5.h>
+
+/* We need this to wrap data. */
+static gss_ctx_id_t gcontext;
+
+static void gserver_authenticate_connection PROTO((void));
+
+/* Whether we are already wrapping GSSAPI communication. */
+static int cvs_gssapi_wrapping;
+
+# ifdef ENCRYPTION
+/* Whether to encrypt GSSAPI communication. We use a global variable
+ like this because we use the same buffer type (gssapi_wrap) to
+ handle both authentication and encryption, and we don't want
+ multiple instances of that buffer in the communication stream. */
+int cvs_gssapi_encrypt;
+# endif
+
+#endif
+
/* for select */
#include <sys/types.h>
#ifdef HAVE_SYS_BSDTYPES_H
@@ -76,12 +104,12 @@ static Key_schedule sched;
#ifdef HAVE_GETSPNAM
#include <shadow.h>
#endif
+#endif /* AUTH_SERVER_SUPPORT */
+
/* For initgroups(). */
#if HAVE_INITGROUPS
#include <grp.h>
#endif /* HAVE_INITGROUPS */
-#endif /* AUTH_SERVER_SUPPORT */
-
#ifdef AUTH_SERVER_SUPPORT
@@ -95,6 +123,10 @@ char *CVS_Username = NULL;
later CVS protocol. Exported because root.c also uses. */
char *Pserver_Repos = NULL;
+/* Should we check for system usernames/passwords? Can be changed by
+ CVSROOT/config. */
+int system_auth = 1;
+
#endif /* AUTH_SERVER_SUPPORT */
@@ -329,7 +361,7 @@ mkdir_p (dir)
{
strncpy (q, dir, p - dir);
q[p - dir] = '\0';
- if (CVS_MKDIR (q, 0777) < 0)
+ if (q[p - dir - 1] != '/' && CVS_MKDIR (q, 0777) < 0)
{
int saved_errno = errno;
@@ -437,6 +469,8 @@ alloc_pending (size)
return 1;
}
+static void serve_is_modified PROTO ((char *));
+
static int supported_response PROTO ((char *));
static int
@@ -526,8 +560,30 @@ serve_root (arg)
"E Root %s must be an absolute pathname", arg);
return;
}
+
+ /* Sending "Root" twice is illegal. It would also be nice to
+ check for the other case, in which there is no Root request
+ prior to a request which requires one.
+
+ The other way to handle a duplicate Root requests would be as a
+ request to clear out all state and start over as if it was a
+ new connection. Doing this would cause interoperability
+ headaches, so it should be a different request, if there is
+ any reason why such a feature is needed. */
+ if (CVSroot_directory != NULL)
+ {
+ if (alloc_pending (80 + strlen (arg)))
+ sprintf (pending_error_text,
+ "E Protocol error: Duplicate Root request, for %s", arg);
+ return;
+ }
+
set_local_cvsroot (arg);
+ /* For pserver, this will already have happened, and the call will do
+ nothing. But for rsh, we need to do it now. */
+ parse_config (CVSroot_directory);
+
path = xmalloc (strlen (CVSroot_directory)
+ sizeof (CVSROOTADM)
+ sizeof (CVSROOTADM_HISTORY)
@@ -629,6 +685,7 @@ dirswitch (dir, repos)
int status;
FILE *f;
char *b;
+ size_t dir_len;
server_write_entries ();
@@ -637,20 +694,22 @@ dirswitch (dir, repos)
if (dir_name != NULL)
free (dir_name);
+ dir_len = strlen (dir);
+
/* Check for a trailing '/'. This is not ISDIRSEP because \ in the
protocol is an ordinary character, not a directory separator (of
course, it is perhaps unwise to use it in directory names, but that
is another issue). */
- if (strlen (dir) > 0
- && dir[strlen (dir) - 1] == '/')
+ if (dir_len > 0
+ && dir[dir_len - 1] == '/')
{
- if (alloc_pending (80 + strlen (dir)))
+ if (alloc_pending (80 + dir_len))
sprintf (pending_error_text,
- "E protocol error: illegal directory syntax in %s", dir);
+ "E protocol error: invalid directory syntax in %s", dir);
return;
}
- dir_name = malloc (strlen (server_temp_dir) + strlen (dir) + 40);
+ dir_name = malloc (strlen (server_temp_dir) + dir_len + 40);
if (dir_name == NULL)
{
pending_error = ENOMEM;
@@ -671,6 +730,12 @@ dirswitch (dir, repos)
return;
}
+ /* Note that this call to Subdir_Register will be a noop if the parent
+ directory does not yet exist (for example, if the client sends
+ "Directory foo" followed by "Directory .", then the subdirectory does
+ not get registered, but if the client sends "Directory ." followed
+ by "Directory foo", then the subdirectory does get registered.
+ This seems pretty fishy, but maybe it is the way it needs to work. */
b = strrchr (dir_name, '/');
*b = '\0';
Subdir_Register ((List *) NULL, dir_name, b + 1);
@@ -774,6 +839,24 @@ serve_directory (arg)
status = buf_read_line (buf_from_net, &repos, (int *) NULL);
if (status == 0)
{
+ /* I think isabsolute (repos) should always be true, and that
+ any RELATIVE_REPOS stuff should only be in CVS/Repository
+ files, not the protocol (for compatibility), but I'm putting
+ in the in isabsolute check just in case. */
+ if (isabsolute (repos)
+ && strncmp (CVSroot_directory,
+ repos,
+ strlen (CVSroot_directory)) != 0)
+ {
+ if (alloc_pending (strlen (CVSroot_directory)
+ + strlen (repos)
+ + 80))
+ sprintf (pending_error_text, "\
+E protocol error: directory '%s' not within root '%s'",
+ repos, CVSroot_directory);
+ return;
+ }
+
dirswitch (arg, repos);
free (repos);
}
@@ -1004,6 +1087,11 @@ receive_file (size, file, gzipped)
}
}
+/* Kopt for the next file sent in Modified or Is-modified. */
+static char *kopt;
+
+static void serve_modified PROTO ((char *));
+
static void
serve_modified (arg)
char *arg;
@@ -1118,6 +1206,13 @@ serve_modified (arg)
return;
}
}
+
+ /* Make sure that the Entries indicate the right kopt. We probably
+ could do this even in the non-kopt case and, I think, save a stat()
+ call in time_stamp_server. But for conservatism I'm leaving the
+ non-kopt case alone. */
+ if (kopt != NULL)
+ serve_is_modified (arg);
}
@@ -1174,8 +1269,6 @@ serve_unchanged (arg)
}
}
-static void serve_is_modified PROTO ((char *));
-
static void
serve_is_modified (arg)
char *arg;
@@ -1212,6 +1305,16 @@ serve_is_modified (arg)
}
*timefield = 'M';
}
+ if (kopt != NULL)
+ {
+ if (alloc_pending (strlen (name) + 80))
+ sprintf (pending_error_text,
+ "E protocol error: both Kopt and Entry for %s",
+ arg);
+ free (kopt);
+ kopt = NULL;
+ return;
+ }
found = 1;
break;
}
@@ -1220,22 +1323,36 @@ serve_is_modified (arg)
{
/* We got Is-modified but no Entry. Add a dummy entry.
The "D" timestamp is what makes it a dummy. */
- struct an_entry *p;
p = (struct an_entry *) malloc (sizeof (struct an_entry));
if (p == NULL)
{
pending_error = ENOMEM;
return;
}
- p->entry = xmalloc (strlen (arg) + 80);
+ p->entry = malloc (strlen (arg) + 80);
+ if (p->entry == NULL)
+ {
+ pending_error = ENOMEM;
+ free (p);
+ return;
+ }
strcpy (p->entry, "/");
strcat (p->entry, arg);
- strcat (p->entry, "//D//");
+ strcat (p->entry, "//D/");
+ if (kopt != NULL)
+ {
+ strcat (p->entry, kopt);
+ free (kopt);
+ kopt = NULL;
+ }
+ strcat (p->entry, "/");
p->next = entries;
entries = p;
}
}
+static void serve_entry PROTO ((char *));
+
static void
serve_entry (arg)
char *arg;
@@ -1262,6 +1379,45 @@ serve_entry (arg)
entries = p;
}
+static void serve_kopt PROTO ((char *));
+
+static void
+serve_kopt (arg)
+ char *arg;
+{
+ if (error_pending ())
+ return;
+
+ if (kopt != NULL)
+ {
+ if (alloc_pending (80 + strlen (arg)))
+ sprintf (pending_error_text,
+ "E protocol error: duplicate Kopt request: %s", arg);
+ return;
+ }
+
+ /* Do some sanity checks. In particular, that it is not too long.
+ This lets the rest of the code not worry so much about buffer
+ overrun attacks. Probably should call RCS_check_kflag here,
+ but that would mean changing RCS_check_kflag to handle errors
+ other than via exit(), fprintf(), and such. */
+ if (strlen (arg) > 10)
+ {
+ if (alloc_pending (80 + strlen (arg)))
+ sprintf (pending_error_text,
+ "E protocol error: invalid Kopt request: %s", arg);
+ return;
+ }
+
+ kopt = malloc (strlen (arg) + 1);
+ if (kopt == NULL)
+ {
+ pending_error = ENOMEM;
+ return;
+ }
+ strcpy (kopt, arg);
+}
+
static void
server_write_entries ()
{
@@ -1609,6 +1765,7 @@ serve_set (arg)
}
#ifdef ENCRYPTION
+
#ifdef HAVE_KERBEROS
static void
@@ -1626,7 +1783,68 @@ serve_kerberos_encrypt (arg)
}
#endif /* HAVE_KERBEROS */
+
+#ifdef HAVE_GSSAPI
+
+static void
+serve_gssapi_encrypt (arg)
+ char *arg;
+{
+ if (cvs_gssapi_wrapping)
+ {
+ /* We're already using a gssapi_wrap buffer for stream
+ authentication. Flush everything we've output so far, and
+ turn on encryption for future data. On the input side, we
+ should only have unwrapped as far as the Gssapi-encrypt
+ command, so future unwrapping will become encrypted. */
+ buf_flush (buf_to_net, 1);
+ cvs_gssapi_encrypt = 1;
+ return;
+ }
+
+ /* All future communication with the client will be encrypted. */
+
+ cvs_gssapi_encrypt = 1;
+
+ buf_to_net = cvs_gssapi_wrap_buffer_initialize (buf_to_net, 0,
+ gcontext,
+ buf_to_net->memory_error);
+ buf_from_net = cvs_gssapi_wrap_buffer_initialize (buf_from_net, 1,
+ gcontext,
+ buf_from_net->memory_error);
+
+ cvs_gssapi_wrapping = 1;
+}
+
+#endif /* HAVE_GSSAPI */
+
#endif /* ENCRYPTION */
+
+#ifdef HAVE_GSSAPI
+
+static void
+serve_gssapi_authenticate (arg)
+ char *arg;
+{
+ if (cvs_gssapi_wrapping)
+ {
+ /* We're already using a gssapi_wrap buffer for encryption.
+ That includes authentication, so we don't have to do
+ anything further. */
+ return;
+ }
+
+ buf_to_net = cvs_gssapi_wrap_buffer_initialize (buf_to_net, 0,
+ gcontext,
+ buf_to_net->memory_error);
+ buf_from_net = cvs_gssapi_wrap_buffer_initialize (buf_from_net, 1,
+ gcontext,
+ buf_from_net->memory_error);
+
+ cvs_gssapi_wrapping = 1;
+}
+
+#endif /* HAVE_GSSAPI */
#ifdef SERVER_FLOWCONTROL
/* The maximum we'll queue to the remote client before blocking. */
@@ -1814,10 +2032,18 @@ check_command_legal_p (cmd_name)
CVSROOTADM, CVSROOTADM_READERS);
fp = fopen (fname, "r");
- free (fname);
if (fp == NULL)
- goto do_writers;
+ {
+ if (!existence_error (errno))
+ {
+ /* Need to deny access, so that attackers can't fool
+ us with some sort of denial of service attack. */
+ error (0, errno, "cannot open %s", fname);
+ free (fname);
+ return 0;
+ }
+ }
else /* successfully opened readers file */
{
while ((num_red = getline (&linebuf, &linebuf_len, fp)) >= 0)
@@ -1835,16 +2061,19 @@ check_command_legal_p (cmd_name)
if (strcmp (linebuf, CVS_Username) == 0)
goto handle_illegal;
}
+ if (num_red < 0 && !feof (fp))
+ error (0, errno, "cannot read %s", fname);
/* If not listed specifically as a reader, then this user
has write access by default unless writers are also
specified in a file . */
- fclose (fp);
- goto do_writers;
+ if (fclose (fp) < 0)
+ error (0, errno, "cannot close %s", fname);
}
+ free (fname);
+
+ /* Now check the writers file. */
- do_writers:
-
flen = strlen (CVSroot_directory)
+ strlen (CVSROOTADM)
+ strlen (CVSROOTADM_WRITERS)
@@ -1855,19 +2084,28 @@ check_command_legal_p (cmd_name)
CVSROOTADM, CVSROOTADM_WRITERS);
fp = fopen (fname, "r");
- free (fname);
if (fp == NULL)
{
- /* writers file does not exist, so everyone is a writer,
- by default */
if (linebuf)
free (linebuf);
- return 1;
+ if (existence_error (errno))
+ {
+ /* Writers file does not exist, so everyone is a writer,
+ by default. */
+ free (fname);
+ return 1;
+ }
+ else
+ {
+ /* Need to deny access, so that attackers can't fool
+ us with some sort of denial of service attack. */
+ error (0, errno, "cannot read %s", fname);
+ free (fname);
+ return 0;
+ }
}
- /* else */
-
found_it = 0;
while ((num_red = getline (&linebuf, &linebuf_len, fp)) >= 0)
{
@@ -1881,20 +2119,26 @@ check_command_legal_p (cmd_name)
break;
}
}
+ if (num_red < 0 && !feof (fp))
+ error (0, errno, "cannot read %s", fname);
if (found_it)
{
- fclose (fp);
+ if (fclose (fp) < 0)
+ error (0, errno, "cannot close %s", fname);
if (linebuf)
free (linebuf);
+ free (fname);
return 1;
}
else /* writers file exists, but this user not listed in it */
{
handle_illegal:
- fclose (fp);
+ if (fclose (fp) < 0)
+ error (0, errno, "cannot close %s", fname);
if (linebuf)
free (linebuf);
+ free (fname);
return 0;
}
}
@@ -2813,7 +3057,7 @@ static void
serve_log (arg)
char *arg;
{
- do_cvs_command ("cvslog", cvslog);
+ do_cvs_command ("log", cvslog);
}
static void
@@ -3085,6 +3329,8 @@ server_modtime (finfo, vers_ts)
{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+ assert (vers_ts->vn_rcs != NULL);
+
if (!supported_response ("Mod-time"))
return;
@@ -3117,7 +3363,18 @@ server_updated (finfo, vers, updated, file_info, checksum)
unsigned char *checksum;
{
if (noexec)
+ {
+ /* Hmm, maybe if we did the same thing for entries_file, we
+ could get rid of the kludges in server_register and
+ server_scratch which refrain from warning if both
+ Scratch_Entry and Register get called. Maybe. */
+ if (scratched_file)
+ {
+ free (scratched_file);
+ scratched_file = NULL;
+ }
return;
+ }
if (entries_line != NULL && scratched_file == NULL)
{
@@ -3559,6 +3816,11 @@ expand_proc (pargc, argv, where, mwhere, mfile, shorten,
if (mwhere != NULL)
{
buf_output0 (buf_to_net, "Module-expansion ");
+ if (server_dir != NULL)
+ {
+ buf_output0 (buf_to_net, server_dir);
+ buf_output0 (buf_to_net, "/");
+ }
buf_output0 (buf_to_net, mwhere);
if (mfile != NULL)
{
@@ -3574,6 +3836,11 @@ expand_proc (pargc, argv, where, mwhere, mfile, shorten,
if (*pargc == 1)
{
buf_output0 (buf_to_net, "Module-expansion ");
+ if (server_dir != NULL)
+ {
+ buf_output0 (buf_to_net, server_dir);
+ buf_output0 (buf_to_net, "/");
+ }
buf_output0 (buf_to_net, dir);
buf_append_char (buf_to_net, '\n');
}
@@ -3582,6 +3849,11 @@ expand_proc (pargc, argv, where, mwhere, mfile, shorten,
for (i = 1; i < *pargc; ++i)
{
buf_output0 (buf_to_net, "Module-expansion ");
+ if (server_dir != NULL)
+ {
+ buf_output0 (buf_to_net, server_dir);
+ buf_output0 (buf_to_net, "/");
+ }
buf_output0 (buf_to_net, dir);
buf_append_char (buf_to_net, '/');
buf_output0 (buf_to_net, argv[i]);
@@ -3760,6 +4032,7 @@ struct request requests[] =
REQ_LINE("Checkin-prog", serve_checkin_prog, rq_optional),
REQ_LINE("Update-prog", serve_update_prog, rq_optional),
REQ_LINE("Entry", serve_entry, rq_essential),
+ REQ_LINE("Kopt", serve_kopt, rq_optional),
REQ_LINE("Modified", serve_modified, rq_essential),
REQ_LINE("Is-modified", serve_is_modified, rq_optional),
@@ -3778,9 +4051,15 @@ struct request requests[] =
REQ_LINE("Gzip-stream", serve_gzip_stream, rq_optional),
REQ_LINE("Set", serve_set, rq_optional),
#ifdef ENCRYPTION
-#ifdef HAVE_KERBEROS
+# ifdef HAVE_KERBEROS
REQ_LINE("Kerberos-encrypt", serve_kerberos_encrypt, rq_optional),
+# endif
+# ifdef HAVE_GSSAPI
+ REQ_LINE("Gssapi-encrypt", serve_gssapi_encrypt, rq_optional),
+# endif
#endif
+#ifdef HAVE_GSSAPI
+ REQ_LINE("Gssapi-authenticate", serve_gssapi_authenticate, rq_optional),
#endif
REQ_LINE("expand-modules", serve_expand_modules, rq_optional),
REQ_LINE("ci", serve_ci, rq_essential),
@@ -4024,50 +4303,6 @@ server (argc, argv)
protocol to report error messages. */
error_use_protocol = 1;
- /*
- * Put Rcsbin at the start of PATH, so that rcs programs can find
- * themselves.
- */
-#ifdef HAVE_PUTENV
- if (Rcsbin != NULL && *Rcsbin)
- {
- char *p;
- char *env;
-
- p = getenv ("PATH");
- if (p != NULL)
- {
- env = malloc (strlen (Rcsbin) + strlen (p) + sizeof "PATH=:");
- if (env != NULL)
- sprintf (env, "PATH=%s:%s", Rcsbin, p);
- }
- else
- {
- env = malloc (strlen (Rcsbin) + sizeof "PATH=");
- if (env != NULL)
- sprintf (env, "PATH=%s", Rcsbin);
- }
- if (env == NULL)
- {
- printf ("E Fatal server error, aborting.\n\
-error ENOMEM Virtual memory exhausted.\n");
-
- /* I'm doing this manually rather than via error_exit ()
- because I'm not sure whether we want to call server_cleanup.
- Needs more investigation.... */
-
-#ifdef SYSTEM_CLEANUP
- /* Hook for OS-specific behavior, for example socket subsystems on
- NT and OS2 or dealing with windows and arguments on Mac. */
- SYSTEM_CLEANUP ();
-#endif
-
- exit (EXIT_FAILURE);
- }
- putenv (env);
- }
-#endif
-
/* OK, now figure out where we stash our temporary files. */
{
char *p;
@@ -4220,8 +4455,6 @@ error ENOMEM Virtual memory exhausted.\n");
by this server" or something like that instead of usage message. */
argument_vector[0] = "cvs server";
- server_active = 1;
-
while (1)
{
char *cmd, *orig_cmd;
@@ -4274,7 +4507,7 @@ error ENOMEM Virtual memory exhausted.\n");
}
-#if defined (HAVE_KERBEROS) || defined (AUTH_SERVER_SUPPORT)
+#if defined (HAVE_KERBEROS) || defined (AUTH_SERVER_SUPPORT) || defined (HAVE_GSSAPI)
static void switch_to_user PROTO((const char *));
static void
@@ -4301,6 +4534,15 @@ error 0 %s: no such user\n", username);
exit (EXIT_FAILURE);
}
+ /* FIXME? We don't check for errors from initgroups, setuid, &c.
+ I think this mainly would come up if someone is trying to run
+ the server as a non-root user. I think we should be checking for
+ errors and aborting (as with the error above from getpwnam) if
+ there is an error (presumably EPERM). That means that pserver
+ should continue to work right if all of the "system usernames"
+ in CVSROOT/passwd match the user which the server is being run
+ as (in inetd.conf), but fail otherwise. */
+
#if HAVE_INITGROUPS
initgroups (pw->pw_name, pw->pw_gid);
#endif /* HAVE_INITGROUPS */
@@ -4471,7 +4713,7 @@ check_password (username, password, repository)
/* host_user already set by reference, so just return. */
goto handle_return;
}
- else if (rc == 0)
+ else if (rc == 0 && system_auth)
{
/* No cvs password found, so try /etc/passwd. */
@@ -4530,6 +4772,27 @@ error 0 %s: no such user\n", username);
goto handle_return;
}
}
+ else if (rc == 0)
+ {
+ /* Note that the message _does_ distinguish between the case in
+ which we check for a system password and the case in which
+ we do not. It is a real pain to track down why it isn't
+ letting you in if it won't say why, and I am not convinced
+ that the potential information disclosure to an attacker
+ outweighs this. */
+ printf ("error 0 no such user %s in CVSROOT/passwd\n", username);
+
+ /* I'm doing this manually rather than via error_exit ()
+ because I'm not sure whether we want to call server_cleanup.
+ Needs more investigation.... */
+
+#ifdef SYSTEM_CLEANUP
+ /* Hook for OS-specific behavior, for example socket subsystems on
+ NT and OS2 or dealing with windows and arguments on Mac. */
+ SYSTEM_CLEANUP ();
+#endif
+ exit (EXIT_FAILURE);
+ }
else
{
/* Something strange happened. We don't know what it was, but
@@ -4550,6 +4813,10 @@ handle_return:
return host_user;
}
+#endif /* AUTH_SERVER_SUPPORT */
+
+#if defined (AUTH_SERVER_SUPPORT) || defined (HAVE_GSSAPI)
+
/* Read username and password from client (i.e., stdin).
If correct, then switch to run as that user and send an ACK to the
client via stdout, else send NACK and die. */
@@ -4558,6 +4825,7 @@ pserver_authenticate_connection ()
{
char *tmp = NULL;
size_t tmp_allocated = 0;
+#ifdef AUTH_SERVER_SUPPORT
char *repository = NULL;
size_t repository_allocated = 0;
char *username = NULL;
@@ -4567,6 +4835,7 @@ pserver_authenticate_connection ()
char *host_user;
char *descrambled_password;
+#endif /* AUTH_SERVER_SUPPORT */
int verify_and_exit = 0;
/* The Authentication Protocol. Client sends:
@@ -4631,9 +4900,27 @@ pserver_authenticate_connection ()
if (strcmp (tmp, "BEGIN VERIFICATION REQUEST\n") == 0)
verify_and_exit = 1;
- else if (strcmp (tmp, "BEGIN AUTH REQUEST\n") != 0)
+ else if (strcmp (tmp, "BEGIN AUTH REQUEST\n") == 0)
+ ;
+ else if (strcmp (tmp, "BEGIN GSSAPI REQUEST\n") == 0)
+ {
+#ifdef HAVE_GSSAPI
+ free (tmp);
+ gserver_authenticate_connection ();
+ return;
+#else
+ error (1, 0, "GSSAPI authentication not supported by this server");
+#endif
+ }
+ else
error (1, 0, "bad auth protocol start: %s", tmp);
+#ifndef AUTH_SERVER_SUPPORT
+
+ error (1, 0, "Password authentication not supported by this server");
+
+#else /* AUTH_SERVER_SUPPORT */
+
/* Get the three important pieces of information in order. */
/* See above comment about error handling. */
getline (&repository, &repository_allocated, stdin);
@@ -4656,14 +4943,21 @@ pserver_authenticate_connection ()
error (1, 0, "bad auth protocol end: %s", tmp);
}
if (!root_allow_ok (repository))
- /* At least for the moment I'm going to do the paranoid
- security thing and not tell them how it failed. I'm not
- sure that is a good idea; it is a real pain when one needs
- to track down what is going on for legitimate reasons.
- The other issue is that the protocol doesn't really have
- a good way for anything other than I HATE YOU. */
+ /* Just give a generic I HATE YOU. This is because CVS 1.9.10
+ and older clients do not support "error". Once more recent
+ clients are more widespread, probably want to fix this (it is
+ a real pain to track down why it isn't letting you in if it
+ won't say why, and I am not convinced that the potential
+ information disclosure to an attacker outweighs this). */
goto i_hate_you;
+ /* OK, now parse the config file, so we can use it to control how
+ to check passwords. If there was an error parsing the config
+ file, parse_config already printed an error. We keep going.
+ Why? Because if we didn't, then there would be no way to check
+ in a new CVSROOT/config file to fix the broken one! */
+ parse_config (repository);
+
/* We need the real cleartext before we hash it. */
descrambled_password = descramble (password);
host_user = check_password (username, descrambled_password, repository);
@@ -4715,9 +5009,11 @@ pserver_authenticate_connection ()
free (repository);
free (username);
free (password);
-}
#endif /* AUTH_SERVER_SUPPORT */
+}
+
+#endif /* AUTH_SERVER_SUPPORT || HAVE_GSSAPI */
#ifdef HAVE_KERBEROS
@@ -4797,6 +5093,122 @@ error 0 kerberos: can't get local name: %s\n", krb_get_err_text(status));
}
#endif /* HAVE_KERBEROS */
+#ifdef HAVE_GSSAPI
+
+#ifndef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN (256)
+#endif
+
+/* Authenticate a GSSAPI connection. This is called from
+ pserver_authenticate_connection, and it handles success and failure
+ the same way. */
+
+static void
+gserver_authenticate_connection ()
+{
+ char hostname[MAXHOSTNAMELEN];
+ struct hostent *hp;
+ gss_buffer_desc tok_in, tok_out;
+ char buf[1024];
+ OM_uint32 stat_min, ret;
+ gss_name_t server_name, client_name;
+ gss_cred_id_t server_creds;
+ int nbytes;
+ gss_OID mechid;
+
+ gethostname (hostname, sizeof hostname);
+ hp = gethostbyname (hostname);
+ if (hp == NULL)
+ error (1, 0, "can't get canonical hostname");
+
+ sprintf (buf, "cvs@%s", hp->h_name);
+ tok_in.value = buf;
+ tok_in.length = strlen (buf);
+
+ if (gss_import_name (&stat_min, &tok_in, gss_nt_service_name,
+ &server_name) != GSS_S_COMPLETE)
+ error (1, 0, "could not import GSSAPI service name %s", buf);
+
+ /* Acquire the server credential to verify the client's
+ authentication. */
+ if (gss_acquire_cred (&stat_min, server_name, 0, GSS_C_NULL_OID_SET,
+ GSS_C_ACCEPT, &server_creds,
+ NULL, NULL) != GSS_S_COMPLETE)
+ error (1, 0, "could not acquire GSSAPI server credentials");
+
+ gss_release_name (&stat_min, &server_name);
+
+ /* The client will send us a two byte length followed by that many
+ bytes. */
+ if (fread (buf, 1, 2, stdin) != 2)
+ error (1, errno, "read of length failed");
+
+ nbytes = ((buf[0] & 0xff) << 8) | (buf[1] & 0xff);
+ assert (nbytes <= sizeof buf);
+
+ if (fread (buf, 1, nbytes, stdin) != nbytes)
+ error (1, errno, "read of data failed");
+
+ gcontext = GSS_C_NO_CONTEXT;
+ tok_in.length = nbytes;
+ tok_in.value = buf;
+
+ if (gss_accept_sec_context (&stat_min,
+ &gcontext, /* context_handle */
+ server_creds, /* verifier_cred_handle */
+ &tok_in, /* input_token */
+ NULL, /* channel bindings */
+ &client_name, /* src_name */
+ &mechid, /* mech_type */
+ &tok_out, /* output_token */
+ &ret,
+ NULL, /* ignore time_rec */
+ NULL) /* ignore del_cred_handle */
+ != GSS_S_COMPLETE)
+ {
+ error (1, 0, "could not verify credentials");
+ }
+
+ /* FIXME: Use Kerberos v5 specific code to authenticate to a user.
+ We could instead use an authentication to access mapping. */
+ {
+ krb5_context kc;
+ krb5_principal p;
+ gss_buffer_desc desc;
+
+ krb5_init_context (&kc);
+ if (gss_display_name (&stat_min, client_name, &desc,
+ &mechid) != GSS_S_COMPLETE
+ || krb5_parse_name (kc, ((gss_buffer_t) &desc)->value, &p) != 0
+ || krb5_aname_to_localname (kc, p, sizeof buf, buf) != 0
+ || krb5_kuserok (kc, p, buf) != TRUE)
+ {
+ error (1, 0, "access denied");
+ }
+ krb5_free_principal (kc, p);
+ krb5_free_context (kc);
+ }
+
+ if (tok_out.length != 0)
+ {
+ char cbuf[2];
+
+ cbuf[0] = (tok_out.length >> 8) & 0xff;
+ cbuf[1] = tok_out.length & 0xff;
+ if (fwrite (cbuf, 1, 2, stdout) != 2
+ || (fwrite (tok_out.value, 1, tok_out.length, stdout)
+ != tok_out.length))
+ error (1, errno, "fwrite failed");
+ }
+
+ switch_to_user (buf);
+
+ printf ("I LOVE YOU\n");
+ fflush (stdout);
+}
+
+#endif /* HAVE_GSSAPI */
+
#endif /* SERVER_SUPPORT */
#if defined (CLIENT_SUPPORT) || defined (SERVER_SUPPORT)
@@ -4805,320 +5217,232 @@ error 0 kerberos: can't get local name: %s\n", krb_get_err_text(status));
the command line. */
int cvsencrypt;
-#ifdef ENCRYPTION
+/* This global variable is non-zero if the users requests stream
+ authentication on the command line. */
+int cvsauthenticate;
-#ifdef HAVE_KERBEROS
+#ifdef HAVE_GSSAPI
-/* An encryption interface using Kerberos. This is built on top of
- the buffer structure. We encrypt using a big endian two byte count
- field followed by a block of encrypted data. */
+/* An buffer interface using GSSAPI. This is built on top of a
+ packetizing buffer. */
-/* This structure is the closure field of a Kerberos encryption
- buffer. */
+/* This structure is the closure field of the GSSAPI translation
+ routines. */
-struct krb_encrypt_buffer
+struct cvs_gssapi_wrap_data
{
- /* The underlying buffer. */
- struct buffer *buf;
- /* The Kerberos key schedule. */
- Key_schedule sched;
- /* The Kerberos DES block. */
- C_Block block;
- /* For an input buffer, we may have to buffer up data here. */
- /* This is non-zero if the buffered data is decrypted. Otherwise,
- the buffered data is encrypted, and starts with the two byte
- count. */
- int clear;
- /* The amount of buffered data. */
- int holdsize;
- /* The buffer allocated to hold the data. */
- char *holdbuf;
- /* The size of holdbuf. */
- int holdbufsize;
- /* If clear is set, we need another data pointer to track where we
- are in holdbuf. If clear is zero, then this pointer is not
- used. */
- char *holddata;
+ /* The GSSAPI context. */
+ gss_ctx_id_t gcontext;
};
-static int krb_encrypt_buffer_input PROTO((void *, char *, int, int, int *));
-static int krb_encrypt_buffer_output PROTO((void *, const char *, int, int *));
-static int krb_encrypt_buffer_flush PROTO((void *));
-static int krb_encrypt_buffer_block PROTO((void *, int));
-static int krb_encrypt_buffer_shutdown PROTO((void *));
+static int cvs_gssapi_wrap_input PROTO((void *, const char *, char *, int));
+static int cvs_gssapi_wrap_output PROTO((void *, const char *, char *, int,
+ int *));
-/* Create an encryption buffer. */
+/* Create a GSSAPI wrapping buffer. We use a packetizing buffer with
+ GSSAPI wrapping routines. */
struct buffer *
-krb_encrypt_buffer_initialize (buf, input, sched, block, memory)
+cvs_gssapi_wrap_buffer_initialize (buf, input, gcontext, memory)
struct buffer *buf;
int input;
- Key_schedule sched;
- C_Block block;
+ gss_ctx_id_t gcontext;
void (*memory) PROTO((struct buffer *));
{
- struct krb_encrypt_buffer *kb;
+ struct cvs_gssapi_wrap_data *gd;
- kb = (struct krb_encrypt_buffer *) xmalloc (sizeof *kb);
- memset (kb, 0, sizeof *kb);
-
- kb->buf = buf;
- memcpy (kb->sched, sched, sizeof (Key_schedule));
- memcpy (kb->block, block, sizeof (C_Block));
- if (input)
- {
- /* We add some space to the buffer to hold the length. */
- kb->holdbufsize = BUFFER_DATA_SIZE + 16;
- kb->holdbuf = xmalloc (kb->holdbufsize);
- }
+ gd = (struct cvs_gssapi_wrap_data *) xmalloc (sizeof *gd);
+ gd->gcontext = gcontext;
- return buf_initialize (input ? krb_encrypt_buffer_input : NULL,
- input ? NULL : krb_encrypt_buffer_output,
- input ? NULL : krb_encrypt_buffer_flush,
- krb_encrypt_buffer_block,
- krb_encrypt_buffer_shutdown,
- memory,
- kb);
+ return (packetizing_buffer_initialize
+ (buf,
+ input ? cvs_gssapi_wrap_input : NULL,
+ input ? NULL : cvs_gssapi_wrap_output,
+ gd,
+ memory));
}
-/* Input data from a Kerberos encryption buffer. */
+/* Unwrap data using GSSAPI. */
static int
-krb_encrypt_buffer_input (closure, data, need, size, got)
- void *closure;
- char *data;
- int need;
+cvs_gssapi_wrap_input (fnclosure, input, output, size)
+ void *fnclosure;
+ const char *input;
+ char *output;
int size;
- int *got;
{
- struct krb_encrypt_buffer *kb = (struct krb_encrypt_buffer *) closure;
+ struct cvs_gssapi_wrap_data *gd =
+ (struct cvs_gssapi_wrap_data *) fnclosure;
+ gss_buffer_desc inbuf, outbuf;
+ OM_uint32 stat_min;
+ int conf;
- *got = 0;
+ inbuf.value = (void *) input;
+ inbuf.length = size;
- if (kb->holdsize > 0 && kb->clear)
+ if (gss_unwrap (&stat_min, gd->gcontext, &inbuf, &outbuf, &conf, NULL)
+ != GSS_S_COMPLETE)
{
- int copy;
-
- copy = kb->holdsize;
-
- if (copy > size)
- {
- memcpy (data, kb->holddata, size);
- kb->holdsize -= size;
- kb->holddata += size;
- *got = size;
- return 0;
- }
-
- memcpy (data, kb->holddata, copy);
- kb->holdsize = 0;
- kb->clear = 0;
-
- data += copy;
- need -= copy;
- size -= copy;
- *got = copy;
+ error (1, 0, "gss_unwrap failed");
}
- while (need > 0 || *got == 0)
- {
- int get, status, nread, count, dcount;
- char *bytes;
- char stackoutbuf[BUFFER_DATA_SIZE + 16];
- char *outbuf;
+ if (outbuf.length > size)
+ abort ();
- /* If we don't already have the two byte count, get it. */
- if (kb->holdsize < 2)
- {
- get = 2 - kb->holdsize;
- status = buf_read_data (kb->buf, get, &bytes, &nread);
- if (status != 0)
- {
- /* buf_read_data can return -2, but a buffer input
- function is only supposed to return -1, 0, or an
- error code. */
- if (status == -2)
- status = ENOMEM;
- return status;
- }
+ memcpy (output, outbuf.value, outbuf.length);
- if (nread == 0)
- {
- /* The buffer is in nonblocking mode, and we didn't
- manage to read anything. */
- return 0;
- }
+ /* The real packet size is stored in the data, so we don't need to
+ remember outbuf.length. */
- if (get == 1)
- kb->holdbuf[1] = bytes[0];
- else
- {
- kb->holdbuf[0] = bytes[0];
- if (nread < 2)
- {
- /* We only got one byte, but we needed two. Stash
- the byte we got, and try again. */
- kb->holdsize = 1;
- continue;
- }
- kb->holdbuf[1] = bytes[1];
- }
- kb->holdsize = 2;
- }
+ gss_release_buffer (&stat_min, &outbuf);
- /* Read the encrypted block of data. */
+ return 0;
+}
- count = (((kb->holdbuf[0] & 0xff) << 8)
- + (kb->holdbuf[1] & 0xff));
+/* Wrap data using GSSAPI. */
- if (count + 2 > kb->holdbufsize)
- {
- char *n;
+static int
+cvs_gssapi_wrap_output (fnclosure, input, output, size, translated)
+ void *fnclosure;
+ const char *input;
+ char *output;
+ int size;
+ int *translated;
+{
+ struct cvs_gssapi_wrap_data *gd =
+ (struct cvs_gssapi_wrap_data *) fnclosure;
+ gss_buffer_desc inbuf, outbuf;
+ OM_uint32 stat_min;
+ int conf_req, conf;
- /* This should be impossible, since we should have
- allocated space for the largest possible block in the
- initialize function. However, we handle it just in
- case something changes in the future, so that a current
- server can handle a later client. */
+ inbuf.value = (void *) input;
+ inbuf.length = size;
- n = realloc (kb->holdbuf, count + 2);
- if (n == NULL)
- {
- (*kb->buf->memory_error) (kb->buf);
- return ENOMEM;
- }
- kb->holdbuf = n;
- kb->holdbufsize = count + 2;
- }
+#ifdef ENCRYPTION
+ conf_req = cvs_gssapi_encrypt;
+#else
+ conf_req = 0;
+#endif
- get = count - (kb->holdsize - 2);
+ if (gss_wrap (&stat_min, gd->gcontext, conf_req, GSS_C_QOP_DEFAULT,
+ &inbuf, &conf, &outbuf) != GSS_S_COMPLETE)
+ error (1, 0, "gss_wrap failed");
- status = buf_read_data (kb->buf, get, &bytes, &nread);
- if (status != 0)
- {
- /* buf_read_data can return -2, but a buffer input
- function is only supposed to return -1, 0, or an error
- code. */
- if (status == -2)
- status = ENOMEM;
- return status;
- }
+ /* The packetizing buffer only permits us to add 100 bytes.
+ FIXME: I don't know what, if anything, is guaranteed by GSSAPI.
+ This may need to be increased for a different GSSAPI
+ implementation, or we may need a different algorithm. */
+ if (outbuf.length > size + 100)
+ abort ();
- if (nread == 0)
- {
- /* We did not get any data. Presumably the buffer is in
- nonblocking mode. */
- return 0;
- }
+ memcpy (output, outbuf.value, outbuf.length);
- /* FIXME: We could complicate the code here to avoid this
- memcpy in the common case of kb->holdsize == 2 && nread ==
- get. */
- memcpy (kb->holdbuf + kb->holdsize, bytes, nread);
- kb->holdsize += nread;
+ *translated = outbuf.length;
- if (nread < get)
- {
- /* We did not get all the data we need. buf_read_data
- does not promise to return all the bytes requested, so
- we must try again. */
- continue;
- }
+ gss_release_buffer (&stat_min, &outbuf);
- /* We have a complete encrypted block of COUNT bytes at
- KB->HOLDBUF + 2. Decrypt it. */
+ return 0;
+}
- if (count <= sizeof stackoutbuf)
- outbuf = stackoutbuf;
- else
- {
- /* I believe this is currently impossible, but we handle
- it for the benefit of future client changes. */
- outbuf = malloc (count);
- if (outbuf == NULL)
- {
- (*kb->buf->memory_error) (kb->buf);
- return ENOMEM;
- }
- }
+#endif /* HAVE_GSSAPI */
- des_cbc_encrypt ((C_Block *) (kb->holdbuf + 2), (C_Block *) outbuf,
- count, kb->sched, &kb->block, 0);
+#ifdef ENCRYPTION
- /* The first two bytes in the decrypted buffer are the real
- (unaligned) length. */
- dcount = ((outbuf[0] & 0xff) << 8) + (outbuf[1] & 0xff);
+#ifdef HAVE_KERBEROS
- if (((dcount + 2 + 7) & ~7) != count)
- error (1, 0, "Decryption failure");
+/* An encryption interface using Kerberos. This is built on top of a
+ packetizing buffer. */
- if (dcount > size)
- {
- /* We have too much data for the buffer. We need to save
- some of it for the next call. */
+/* This structure is the closure field of the Kerberos translation
+ routines. */
- memcpy (data, outbuf + 2, size);
- *got += size;
+struct krb_encrypt_data
+{
+ /* The Kerberos key schedule. */
+ Key_schedule sched;
+ /* The Kerberos DES block. */
+ C_Block block;
+};
- kb->holdsize = dcount - size;
- memcpy (kb->holdbuf, outbuf + 2 + size, dcount - size);
- kb->holddata = kb->holdbuf;
- kb->clear = 1;
+static int krb_encrypt_input PROTO((void *, const char *, char *, int));
+static int krb_encrypt_output PROTO((void *, const char *, char *, int,
+ int *));
- if (outbuf != stackoutbuf)
- free (outbuf);
+/* Create a Kerberos encryption buffer. We use a packetizing buffer
+ with Kerberos encryption translation routines. */
- return 0;
- }
+struct buffer *
+krb_encrypt_buffer_initialize (buf, input, sched, block, memory)
+ struct buffer *buf;
+ int input;
+ Key_schedule sched;
+ C_Block block;
+ void (*memory) PROTO((struct buffer *));
+{
+ struct krb_encrypt_data *kd;
- memcpy (data, outbuf + 2, dcount);
+ kd = (struct krb_encrypt_data *) xmalloc (sizeof *kd);
+ memcpy (kd->sched, sched, sizeof (Key_schedule));
+ memcpy (kd->block, block, sizeof (C_Block));
- if (outbuf != stackoutbuf)
- free (outbuf);
+ return packetizing_buffer_initialize (buf,
+ input ? krb_encrypt_input : NULL,
+ input ? NULL : krb_encrypt_output,
+ kd,
+ memory);
+}
- kb->holdsize = 0;
+/* Decrypt Kerberos data. */
- data += dcount;
- need -= dcount;
- size -= dcount;
- *got += dcount;
- }
+static int
+krb_encrypt_input (fnclosure, input, output, size)
+ void *fnclosure;
+ const char *input;
+ char *output;
+ int size;
+{
+ struct krb_encrypt_data *kd = (struct krb_encrypt_data *) fnclosure;
+ int tcount;
+
+ des_cbc_encrypt ((C_Block *) input, (C_Block *) output,
+ size, kd->sched, &kd->block, 0);
+
+ /* SIZE is the size of the buffer, which is set by the encryption
+ routine. The packetizing buffer will arrange for the first two
+ bytes in the decrypted buffer to be the real (unaligned)
+ length. As a safety check, make sure that the length in the
+ buffer corresponds to SIZE. Note that the length in the buffer
+ is just the length of the data. We must add 2 to account for
+ the buffer count itself. */
+ tcount = ((output[0] & 0xff) << 8) + (output[1] & 0xff);
+ if (((tcount + 2 + 7) & ~7) != size)
+ error (1, 0, "Decryption failure");
return 0;
}
-/* Output data to a Kerberos encryption buffer. */
+/* Encrypt Kerberos data. */
static int
-krb_encrypt_buffer_output (closure, data, have, wrote)
- void *closure;
- const char *data;
- int have;
- int *wrote;
+krb_encrypt_output (fnclosure, input, output, size, translated)
+ void *fnclosure;
+ const char *input;
+ char *output;
+ int size;
+ int *translated;
{
- struct krb_encrypt_buffer *kb = (struct krb_encrypt_buffer *) closure;
- char inbuf[BUFFER_DATA_SIZE + 16];
- char outbuf[BUFFER_DATA_SIZE + 16];
+ struct krb_encrypt_data *kd = (struct krb_encrypt_data *) fnclosure;
int aligned;
- if (have > BUFFER_DATA_SIZE)
- {
- /* It would be easy to malloc a buffer, but I don't think this
- case can ever arise. */
- abort ();
- }
-
- inbuf[0] = (have >> 8) & 0xff;
- inbuf[1] = have & 0xff;
- memcpy (inbuf + 2, data, have);
-
/* For security against a known plaintext attack, we should
initialize any padding bytes to random values. Instead, we
just pick up whatever is on the stack, which is at least better
than using zero. */
- /* Align (have + 2) (plus 2 for the count) to an 8 byte boundary. */
- aligned = (have + 2 + 7) & ~7;
+ /* Align SIZE to an 8 byte boundary. Note that SIZE includes the
+ two byte buffer count at the start of INPUT which was added by
+ the packetizing buffer. */
+ aligned = (size + 7) & ~7;
/* We use des_cbc_encrypt rather than krb_mk_priv because the
latter sticks a timestamp in the block, and krb_rd_priv expects
@@ -5127,65 +5451,12 @@ krb_encrypt_buffer_output (closure, data, have, wrote)
fail over a long network connection. We trust krb_recvauth to
guard against a replay attack. */
- des_cbc_encrypt ((C_Block *) inbuf, (C_Block *) (outbuf + 2), aligned,
- kb->sched, &kb->block, 1);
-
- outbuf[0] = (aligned >> 8) & 0xff;
- outbuf[1] = aligned & 0xff;
-
- /* FIXME: It would be more efficient to get des_cbc_encrypt to put
- its output directly into a buffer_data structure, which we
- could then append to kb->buf. That would save a memcpy. */
-
- buf_output (kb->buf, outbuf, aligned + 2);
-
- *wrote = have;
-
- /* We will only be here because buf_send_output was called on the
- encryption buffer. That means that we should now call
- buf_send_output on the underlying buffer. */
- return buf_send_output (kb->buf);
-}
-
-/* Flush data to a Kerberos encryption buffer. */
-
-static int
-krb_encrypt_buffer_flush (closure)
- void *closure;
-{
- struct krb_encrypt_buffer *kb = (struct krb_encrypt_buffer *) closure;
-
- /* Flush the underlying buffer. Note that if the original call to
- buf_flush passed 1 for the BLOCK argument, then the buffer will
- already have been set into blocking mode, so we should always
- pass 0 here. */
- return buf_flush (kb->buf, 0);
-}
-
-/* The block routine for a Kerberos encryption buffer. */
+ des_cbc_encrypt ((C_Block *) input, (C_Block *) output, aligned,
+ kd->sched, &kd->block, 1);
-static int
-krb_encrypt_buffer_block (closure, block)
- void *closure;
- int block;
-{
- struct krb_encrypt_buffer *kb = (struct krb_encrypt_buffer *) closure;
-
- if (block)
- return set_block (kb->buf);
- else
- return set_nonblock (kb->buf);
-}
-
-/* Shut down a Kerberos encryption buffer. */
-
-static int
-krb_encrypt_buffer_shutdown (closure)
- void *closure;
-{
- struct krb_encrypt_buffer *kb = (struct krb_encrypt_buffer *) closure;
+ *translated = aligned;
- return buf_shutdown (kb->buf);
+ return 0;
}
#endif /* HAVE_KERBEROS */
@@ -5221,6 +5492,13 @@ cvs_output (str, len)
size_t to_write = len;
const char *p = str;
+ /* For symmetry with cvs_outerr we would call fflush (stderr)
+ here. I guess the assumption is that stderr will be
+ unbuffered, so we don't need to. That sounds like a sound
+ assumption from the manpage I looked at, but if there was
+ something fishy about it, my guess is that calling fflush
+ would not produce a significant performance problem. */
+
while (to_write > 0)
{
written = fwrite (p, 1, to_write, stdout);
@@ -5232,6 +5510,90 @@ cvs_output (str, len)
}
}
+/* Output LEN bytes at STR in binary mode. If LEN is zero, then
+ output zero bytes. */
+
+void
+cvs_output_binary (str, len)
+ char *str;
+ size_t len;
+{
+#ifdef SERVER_SUPPORT
+ if (error_use_protocol || server_active)
+ {
+ struct buffer *buf;
+ char size_text[40];
+
+ if (error_use_protocol)
+ buf = buf_to_net;
+ else if (server_active)
+ buf = protocol;
+
+ if (!supported_response ("Mbinary"))
+ {
+ error (0, 0, "\
+this client does not support writing binary files to stdout");
+ return;
+ }
+
+ buf_output0 (buf, "Mbinary\012");
+ sprintf (size_text, "%lu\012", (unsigned long) len);
+ buf_output0 (buf, size_text);
+
+ /* Not sure what would be involved in using buf_append_data here
+ without stepping on the toes of our caller (which is responsible
+ for the memory allocation of STR). */
+ buf_output (buf, str, len);
+
+ if (!error_use_protocol)
+ buf_send_counted (protocol);
+ }
+ else
+#endif
+ {
+ size_t written;
+ size_t to_write = len;
+ const char *p = str;
+
+ /* For symmetry with cvs_outerr we would call fflush (stderr)
+ here. I guess the assumption is that stderr will be
+ unbuffered, so we don't need to. That sounds like a sound
+ assumption from the manpage I looked at, but if there was
+ something fishy about it, my guess is that calling fflush
+ would not produce a significant performance problem. */
+#ifdef USE_SETMODE_STDOUT
+ int oldmode;
+
+ /* It is possible that this should be the same ifdef as
+ USE_SETMODE_BINARY but at least for the moment we keep them
+ separate. Mostly this is just laziness and/or a question
+ of what has been tested where. Also there might be an
+ issue of setmode vs. _setmode. */
+ /* The Windows doc says to call setmode only right after startup.
+ I assume that what they are talking about can also be helped
+ by flushing the stream before changing the mode. */
+ fflush (stdout);
+ oldmode = _setmode (_fileno (stdout), _O_BINARY);
+ if (oldmode < 0)
+ error (0, errno, "failed to setmode on stdout");
+#endif
+
+ while (to_write > 0)
+ {
+ written = fwrite (p, 1, to_write, stdout);
+ if (written == 0)
+ break;
+ p += written;
+ to_write -= written;
+ }
+#ifdef USE_SETMODE_STDOUT
+ fflush (stdout);
+ if (_setmode (_fileno (stdout), oldmode) != _O_BINARY)
+ error (0, errno, "failed to setmode on stdout");
+#endif
+ }
+}
+
/* Like CVS_OUTPUT but output is for stderr not stdout. */
void
@@ -5325,3 +5687,62 @@ cvs_flushout ()
#endif
fflush (stdout);
}
+
+/* Output TEXT, tagging it according to TAG. There are lots more
+ details about what TAG means in cvsclient.texi but for the simple
+ case (e.g. non-client/server), TAG is just "newline" to output a
+ newline (in which case TEXT must be NULL), and any other tag to
+ output normal text.
+
+ Note that there is no way to output either \0 or \n as part of TEXT. */
+
+void
+cvs_output_tagged (tag, text)
+ char *tag;
+ char *text;
+{
+ if (text != NULL && strchr (text, '\n') != NULL)
+ /* Uh oh. The protocol has no way to cope with this. For now
+ we dump core, although that really isn't such a nice
+ response given that this probably can be caused by newlines
+ in filenames and other causes other than bugs in CVS. Note
+ that we don't want to turn this into "MT newline" because
+ this case is a newline within a tagged item, not a newline
+ as extraneous sugar for the user. */
+ assert (0);
+
+ /* Start and end tags don't take any text, per cvsclient.texi. */
+ if (tag[0] == '+' || tag[0] == '-')
+ assert (text == NULL);
+
+#ifdef SERVER_SUPPORT
+ if (server_active && supported_response ("MT"))
+ {
+ struct buffer *buf;
+
+ if (error_use_protocol)
+ buf = buf_to_net;
+ else
+ buf = protocol;
+
+ buf_output0 (buf, "MT ");
+ buf_output0 (buf, tag);
+ if (text != NULL)
+ {
+ buf_output (buf, " ", 1);
+ buf_output0 (buf, text);
+ }
+ buf_output (buf, "\n", 1);
+
+ if (!error_use_protocol)
+ buf_send_counted (protocol);
+ }
+ else
+#endif
+ {
+ if (strcmp (tag, "newline") == 0)
+ cvs_output ("\n", 1);
+ else if (text != NULL)
+ cvs_output (text, 0);
+ }
+}
diff --git a/contrib/cvs/src/server.h b/contrib/cvs/src/server.h
index 743f090..e5a3c3f 100644
--- a/contrib/cvs/src/server.h
+++ b/contrib/cvs/src/server.h
@@ -113,6 +113,7 @@ extern void server_pause_check PROTO((void));
#ifdef AUTH_SERVER_SUPPORT
extern char *CVS_Username;
+extern int system_auth;
#endif /* AUTH_SERVER_SUPPORT */
#endif /* SERVER_SUPPORT */
@@ -161,3 +162,8 @@ struct request
/* Table of requests ending with an entry with a NULL name. */
extern struct request requests[];
+
+/* Gzip library, see zlib.c. */
+extern void gunzip_and_write PROTO ((int, char *, unsigned char *, size_t));
+extern void read_and_gzip PROTO ((int, char *, unsigned char **, size_t *,
+ size_t *, int));
diff --git a/contrib/cvs/src/status.c b/contrib/cvs/src/status.c
index cdc0949..98be085 100644
--- a/contrib/cvs/src/status.c
+++ b/contrib/cvs/src/status.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Status Information
*/
@@ -26,6 +26,7 @@ static const char *const status_usage[] =
"\t-v\tVerbose format; includes tag information for the file\n",
"\t-l\tProcess this directory only (not recursive).\n",
"\t-R\tProcess directories recursively.\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -77,13 +78,21 @@ status (argc, argv)
send_arg("-l");
send_file_names (argc, argv, SEND_EXPAND_WILD);
- /* Note that by setting SEND_NO_CONTENTS, we do prevent the
+
+ /* For a while, we tried setting SEND_NO_CONTENTS here so this
+ could be a fast operation. That prevents the
server from updating our timestamp if the timestamp is
- unchanged and the file is unmodified. And I think it is a
- user-visible thing in that case (shows "locally modified"
- instead of "up to date" I would think). But the speed seems
- to be worth it. */
- send_files (argc, argv, local, 0, SEND_NO_CONTENTS);
+ changed but the file is unmodified. Worse, it is user-visible
+ (shows "locally modified" instead of "up to date" if
+ timestamp is changed but file is not). And there is no good
+ workaround (you might not want to run "cvs update"; "cvs -n
+ update" doesn't update CVS/Entries; "cvs diff --brief" or
+ something perhaps could be made to work but somehow that
+ seems nonintuitive to me even if so). Given that timestamps
+ seem to have the potential to get munged for any number of
+ reasons, it seems better to not rely too much on them. */
+
+ send_files (argc, argv, local, 0, 0);
send_to_server ("status\012", 0);
err = get_responses_and_close ();
@@ -243,7 +252,7 @@ status_fileproc (callerdat, finfo)
{
char *branch = NULL;
- if (RCS_isbranch (finfo->rcs, edata->tag))
+ if (RCS_nodeisbranch (finfo->rcs, edata->tag))
branch = RCS_whatbranch(finfo->rcs, edata->tag);
cvs_output (" Sticky Tag:\t\t", 0);
@@ -328,7 +337,7 @@ tag_list_proc (p, closure)
char *branch = NULL;
char *buf;
- if (RCS_isbranch (xrcsnode, p->key))
+ if (RCS_nodeisbranch (xrcsnode, p->key))
branch = RCS_whatbranch(xrcsnode, p->key) ;
buf = xmalloc (80 + strlen (p->key)
diff --git a/contrib/cvs/src/subr.c b/contrib/cvs/src/subr.c
index d29942b..61b3103 100644
--- a/contrib/cvs/src/subr.c
+++ b/contrib/cvs/src/subr.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Various useful functions for the CVS support code.
*/
@@ -30,7 +30,8 @@ xmalloc (bytes)
cp = malloc (bytes);
if (cp == NULL)
- error (1, 0, "can not allocate %lu bytes", (unsigned long) bytes);
+ error (1, 0, "out of memory; can not allocate %lu bytes",
+ (unsigned long) bytes);
return (cp);
}
@@ -181,16 +182,17 @@ free_names (pargc, argv)
*pargc = 0; /* and set it to zero when done */
}
-/* Convert LINE into arguments separated by space and tab. Set *ARGC
+/* Convert LINE into arguments separated by SEPCHARS. Set *ARGC
to the number of arguments found, and (*ARGV)[0] to the first argument,
(*ARGV)[1] to the second, etc. *ARGV is malloc'd and so are each of
(*ARGV)[0], (*ARGV)[1], ... Use free_names() to return the memory
allocated here back to the free pool. */
void
-line2argv (pargc, argv, line)
+line2argv (pargc, argv, line, sepchars)
int *pargc;
char ***argv;
char *line;
+ char *sepchars;
{
char *cp;
/* Could make a case for size_t or some other unsigned type, but
@@ -205,7 +207,7 @@ line2argv (pargc, argv, line)
*argv = (char **) xmalloc (argv_allocated * sizeof (**argv));
*pargc = 0;
- for (cp = strtok (line, " \t"); cp; cp = strtok ((char *) NULL, " \t"))
+ for (cp = strtok (line, sepchars); cp; cp = strtok ((char *) NULL, sepchars))
{
if (*pargc == argv_allocated)
{
@@ -234,6 +236,56 @@ numdots (s)
return (dots);
}
+/* Compare revision numbers REV1 and REV2 by consecutive fields.
+ Return negative, zero, or positive in the manner of strcmp. The
+ two revision numbers must have the same number of fields, or else
+ compare_revnums will return an inaccurate result. */
+int
+compare_revnums (rev1, rev2)
+ const char *rev1;
+ const char *rev2;
+{
+ const char *s, *sp;
+ const char *t, *tp;
+ char *snext, *tnext;
+ int result = 0;
+
+ sp = s = rev1;
+ tp = t = rev2;
+ while (result == 0)
+ {
+ result = strtoul (sp, &snext, 10) - strtoul (tp, &tnext, 10);
+ if (*snext == '\0' || *tnext == '\0')
+ break;
+ sp = snext + 1;
+ tp = tnext + 1;
+ }
+
+ return result;
+}
+
+char *
+increment_revnum (rev)
+ const char *rev;
+{
+ char *newrev, *p;
+ int lastfield;
+ size_t len = strlen (rev);
+
+ newrev = (char *) xmalloc (len + 2);
+ memcpy (newrev, rev, len + 1);
+ p = strrchr (newrev, '.');
+ if (p == NULL)
+ {
+ free (newrev);
+ return NULL;
+ }
+ lastfield = atoi (++p);
+ sprintf (p, "%d", lastfield + 1);
+
+ return newrev;
+}
+
/* Return the username by which the caller should be identified in
CVS, in contexts such as the author field of RCS files, various
logs, etc.
@@ -244,10 +296,12 @@ numdots (s)
char *
getcaller ()
{
+#ifndef SYSTEM_GETCALLER
static char uidname[20];
struct passwd *pw;
char *name;
uid_t uid;
+#endif
/* If there is a CVS username, return it. */
#ifdef AUTH_SERVER_SUPPORT
@@ -255,6 +309,9 @@ getcaller ()
return CVS_Username;
#endif
+#ifdef SYSTEM_GETCALLER
+ return SYSTEM_GETCALLER ();
+#else
/* Get the caller's login from his uid. If the real uid is "root"
try LOGNAME USER or getlogin(). If getlogin() and getpwuid()
both fail, return the uid as a string. */
@@ -273,6 +330,7 @@ getcaller ()
return (uidname);
}
return (pw->pw_name);
+#endif
}
#ifdef lint
@@ -296,12 +354,12 @@ get_date (date, now)
char *
gca (rev1, rev2)
- char *rev1;
- char *rev2;
+ const char *rev1;
+ const char *rev2;
{
int dots;
char *gca;
- char *p[2];
+ const char *p[2];
int j[2];
char *retval;
@@ -370,7 +428,7 @@ gca (rev1, rev2)
/* revisions differ in trunk major number. */
char *q;
- char *s;
+ const char *s;
s = (j[0] < j[1]) ? p[0] : p[1];
@@ -408,29 +466,80 @@ gca (rev1, rev2)
return retval;
}
+/* Give fatal error if REV is numeric and ARGC,ARGV imply we are
+ planning to operate on more than one file. The current directory
+ should be the working directory. Note that callers assume that we
+ will only be checking the first character of REV; it need not have
+ '\0' at the end of the tag name and other niceties. Right now this
+ is only called from admin.c, but if people like the concept it probably
+ should also be called from diff -r, update -r, get -r, and log -r. */
+
+void
+check_numeric (rev, argc, argv)
+ const char *rev;
+ int argc;
+ char **argv;
+{
+ if (rev == NULL || !isdigit (*rev))
+ return;
+
+ /* Note that the check for whether we are processing more than one
+ file is (basically) syntactic; that is, we don't behave differently
+ depending on whether a directory happens to contain only a single
+ file or whether it contains more than one. I strongly suspect this
+ is the least confusing behavior. */
+ if (argc != 1
+ || (!wrap_name_has (argv[0], WRAP_TOCVS) && isdir (argv[0])))
+ {
+ error (0, 0, "while processing more than one file:");
+ error (1, 0, "attempt to specify a numeric revision");
+ }
+}
+
/*
* Sanity checks and any required fix-up on message passed to RCS via '-m'.
* RCS 5.7 requires that a non-total-whitespace, non-null message be provided
- * with '-m'. Returns the original argument or a pointer to readonly
- * static storage.
+ * with '-m'. Returns a newly allocated, non-empty buffer with whitespace
+ * stripped from end of lines and end of buffer.
+ *
+ * TODO: We no longer use RCS to manage repository files, so maybe this
+ * nonsense about non-empty log fields can be dropped.
*/
char *
make_message_rcslegal (message)
char *message;
{
- if ((message == NULL) || (*message == '\0') || isspace (*message))
+ char *dst, *dp, *mp;
+
+ if (message == NULL) message = "";
+
+ /* Strip whitespace from end of lines and end of string. */
+ dp = dst = (char *) xmalloc (strlen (message) + 1);
+ for (mp = message; *mp != '\0'; ++mp)
{
- char *t;
+ if (*mp == '\n')
+ {
+ /* At end-of-line; backtrack to last non-space. */
+ while (dp > dst && (dp[-1] == ' ' || dp[-1] == '\t'))
+ --dp;
+ }
+ *dp++ = *mp;
+ }
- if (message)
- for (t = message; *t; t++)
- if (!isspace (*t))
- return message;
+ /* Backtrack to last non-space at end of string, and truncate. */
+ while (dp > dst && isspace (dp[-1]))
+ --dp;
+ *dp = '\0';
- return "*** empty log message ***\n";
+ /* After all that, if there was no non-space in the string,
+ substitute a non-empty message. */
+ if (*dst == '\0')
+ {
+ free (dst);
+ dst = xstrdup ("*** empty log message ***");
}
- return message;
+ return dst;
}
/* Does the file FINFO contain conflict markers? The whole concept
@@ -440,7 +549,7 @@ make_message_rcslegal (message)
is what we do. */
int
file_has_markers (finfo)
- struct file_info *finfo;
+ const struct file_info *finfo;
{
FILE *fp;
char *line = NULL;
@@ -468,3 +577,95 @@ out:
free (line);
return result;
}
+
+/* Read the entire contents of the file NAME into *BUF.
+ If NAME is NULL, read from stdin. *BUF
+ is a pointer returned from malloc (or NULL), pointing to *BUFSIZE
+ bytes of space. The actual size is returned in *LEN. On error,
+ give a fatal error. The name of the file to use in error messages
+ (typically will include a directory if we have changed directory)
+ is FULLNAME. MODE is "r" for text or "rb" for binary. */
+
+void
+get_file (name, fullname, mode, buf, bufsize, len)
+ const char *name;
+ const char *fullname;
+ const char *mode;
+ char **buf;
+ size_t *bufsize;
+ size_t *len;
+{
+ struct stat s;
+ size_t nread;
+ char *tobuf;
+ FILE *e;
+ size_t filesize;
+
+ if (name == NULL)
+ {
+ e = stdin;
+ filesize = 100; /* force allocation of minimum buffer */
+ }
+ else
+ {
+ if (CVS_STAT (name, &s) < 0)
+ error (1, errno, "can't stat %s", fullname);
+ /* Convert from signed to unsigned. */
+ filesize = s.st_size;
+
+ e = open_file (name, mode);
+ }
+
+ if (*bufsize < filesize)
+ {
+ *bufsize = filesize;
+ *buf = xrealloc (*buf, *bufsize);
+ }
+
+ tobuf = *buf;
+ nread = 0;
+ while (1)
+ {
+ size_t got;
+
+ got = fread (tobuf, 1, *bufsize - (tobuf - *buf), e);
+ if (ferror (e))
+ error (1, errno, "can't read %s", fullname);
+ nread += got;
+ tobuf += got;
+
+ if (feof (e))
+ break;
+
+ /* It's probably paranoid to think S.ST_SIZE might be
+ too small to hold the entire file contents, but we
+ handle it just in case. */
+ if (tobuf == *buf + *bufsize)
+ {
+ int c;
+ long off;
+
+ c = getc (e);
+ if (c == EOF)
+ break;
+ off = tobuf - *buf;
+ expand_string (buf, bufsize, *bufsize + 100);
+ tobuf = *buf + off;
+ *tobuf++ = c;
+ ++nread;
+ }
+ }
+
+ if (e != stdin && fclose (e) < 0)
+ error (0, errno, "cannot close %s", fullname);
+
+ *len = nread;
+
+ /* Force *BUF to be large enough to hold a null terminator. */
+ if (*buf != NULL)
+ {
+ if (nread == *bufsize)
+ expand_string (buf, bufsize, *bufsize + 1);
+ (*buf)[nread] = '\0';
+ }
+}
diff --git a/contrib/cvs/src/tag.c b/contrib/cvs/src/tag.c
index 93e6c67..a97da5c 100644
--- a/contrib/cvs/src/tag.c
+++ b/contrib/cvs/src/tag.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* Tag
*
@@ -63,11 +63,13 @@ static const char *const tag_usage[] =
"\t-l\tLocal directory only, not recursive.\n",
"\t-R\tProcess directories recursively.\n",
"\t-d\tDelete the given tag.\n",
- "\t-[rD]\tExisting tag or date.\n",
+ "\t-r rev\tExisting revision/tag.\n",
+ "\t-D\tExisting date.\n",
"\t-f\tForce a head revision if specified tag not found.\n",
"\t-b\tMake the tag a \"branch\" tag, allowing concurrent development.\n",
"\t-F\tMove tag if it already exists.\n",
"\t-c\tCheck that working files are unmodified.\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -370,11 +372,10 @@ pretag_proc(repository, filter)
}
free(s);
}
- run_setup("%s %s %s %s",
- filter,
- symtag,
- delete_flag ? "del" : force_tag_move ? "mov" : "add",
- repository);
+ run_setup (filter);
+ run_arg (symtag);
+ run_arg (delete_flag ? "del" : force_tag_move ? "mov" : "add");
+ run_arg (repository);
walklist(tlist, pretag_list_proc, NULL);
return (run_exec(RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY));
}
@@ -480,7 +481,7 @@ tag_fileproc (callerdat, finfo)
}
free (version);
- if ((retcode = RCS_deltag(vers->srcfile, symtag, 1)) != 0)
+ if ((retcode = RCS_deltag(vers->srcfile, symtag)) != 0)
{
if (!quiet)
error (0, retcode == -1 ? errno : 0,
@@ -489,6 +490,7 @@ tag_fileproc (callerdat, finfo)
freevers_ts (&vers);
return (1);
}
+ RCS_rewrite (vers->srcfile, NULL, NULL);
/* warm fuzzies */
if (!really_quiet)
@@ -554,7 +556,7 @@ tag_fileproc (callerdat, finfo)
(int *) NULL);
if (oversion != NULL)
{
- int isbranch = RCS_isbranch (finfo->rcs, symtag);
+ int isbranch = RCS_nodeisbranch (finfo->rcs, symtag);
/*
* if versions the same and neither old or new are branches don't have
@@ -598,6 +600,7 @@ tag_fileproc (callerdat, finfo)
freevers_ts (&vers);
return (1);
}
+ RCS_rewrite (vers->srcfile, NULL, NULL);
/* more warm fuzzies */
if (!really_quiet)
@@ -752,6 +755,11 @@ Numeric tag %s contains characters other than digits and '.'", name);
|| strcmp (name, TAG_HEAD) == 0)
return;
+ /* FIXME: This routine doesn't seem to do any locking whatsoever
+ (and it is called from places which don't have locks in place).
+ If two processes try to write val-tags at the same time, it would
+ seem like we are in trouble. */
+
mytag.dptr = name;
mytag.dsize = strlen (name);
diff --git a/contrib/cvs/src/update.c b/contrib/cvs/src/update.c
index 8196c1f..48bed3b 100644
--- a/contrib/cvs/src/update.c
+++ b/contrib/cvs/src/update.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*
* "update" updates the version in the present directory with respect to the RCS
* repository. The present version must have been created by "checkout". The
@@ -64,12 +64,8 @@ static int update_fileproc PROTO ((void *callerdat, struct file_info *));
static int update_filesdone_proc PROTO ((void *callerdat, int err,
char *repository, char *update_dir,
List *entries));
-static int write_letter PROTO((char *file, int letter, char *update_dir));
-#ifdef SERVER_SUPPORT
-static void join_file PROTO ((struct file_info *finfo, Vers_TS *vers_ts));
-#else
+static void write_letter PROTO ((struct file_info *finfo, int letter));
static void join_file PROTO ((struct file_info *finfo, Vers_TS *vers_ts));
-#endif
static char *options = NULL;
static char *tag = NULL;
@@ -113,6 +109,7 @@ static const char *const update_usage[] =
"\t-j rev\tMerge in changes made between current revision and rev.\n",
"\t-I ign\tMore files to ignore (! to reset).\n",
"\t-W spec\tWrappers specification line.\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -259,16 +256,18 @@ update (argc, argv)
/* If the server supports the command "update-patches", that means
that it knows how to handle the -u argument to update, which
- means to send patches instead of complete files. */
+ means to send patches instead of complete files.
+
+ We don't send -u if failed_patches != NULL, so that the
+ server doesn't try to send patches which will just fail
+ again. At least currently, the client also clobbers the
+ file and tells the server it is lost, which also will get
+ a full file instead of a patch, but it seems clean to omit
+ -u. */
if (failed_patches == NULL)
{
-#ifndef DONT_USE_PATCH
- /* Systems which don't have the patch program ported to them
- will want to define DONT_USE_PATCH; then CVS won't try to
- invoke patch. */
if (supported_request ("update-patches"))
send_arg ("-u");
-#endif
}
if (failed_patches == NULL)
@@ -548,44 +547,17 @@ update_fileproc (callerdat, finfo)
break;
case T_CONFLICT: /* old punt-type errors */
retval = 1;
- (void) write_letter (finfo->file, 'C', finfo->update_dir);
+ write_letter (finfo, 'C');
break;
case T_NEEDS_MERGE: /* needs merging */
if (noexec)
{
retval = 1;
- (void) write_letter (finfo->file, 'C', finfo->update_dir);
+ write_letter (finfo, 'C');
}
else
{
- if (wrap_merge_is_copy (finfo->file))
-#if 0
- /* Look, we can't clobber the user's file. We
- know it is modified and we're going to
- overwrite their mod? Puh-leeze. The
- correct behavior is probably something like
- what merge_file does for -kb, which is to
- give the users both files and tell them
- what the two filenames are. Of course, -m
- in wrappers needs to be documented *much*
- better. Anyway, until then, make this a
- fatal error. */
-
- /* Should we be warning the user that we are
- * overwriting the user's copy of the file? */
- retval =
- checkout_file (finfo, vers, 0);
-#else
- {
- error (0, 0, "A -m 'COPY' wrapper is specified");
- error (0, 0, "but file %s needs merge",
- finfo->fullname);
- error (1, 0, "\
-You probably want to avoid -m 'COPY' wrappers");
-#endif
- }
- else
- retval = merge_file (finfo, vers);
+ retval = merge_file (finfo, vers);
}
break;
case T_MODIFIED: /* locally modified */
@@ -622,7 +594,7 @@ You probably want to avoid -m 'COPY' wrappers");
if (!retcode)
{
- (void) write_letter (finfo->file, 'C', finfo->update_dir);
+ write_letter (finfo, 'C');
retval = 1;
}
else
@@ -634,7 +606,10 @@ You probably want to avoid -m 'COPY' wrappers");
}
}
if (!retval)
- retval = write_letter (finfo->file, 'M', finfo->update_dir);
+ {
+ write_letter (finfo, 'M');
+ retval = 0;
+ }
break;
#ifdef SERVER_SUPPORT
case T_PATCH: /* needs patch */
@@ -658,10 +633,9 @@ You probably want to avoid -m 'COPY' wrappers");
break;
}
}
- /* Fall through. */
/* If we're not running as a server, just check the
- file out. It's simpler and faster than starting up
- two new processes (diff and patch). */
+ file out. It's simpler and faster than producing
+ and applying patches. */
/* Fall through. */
#endif
case T_CHECKOUT: /* needs checkout */
@@ -674,10 +648,12 @@ You probably want to avoid -m 'COPY' wrappers");
#endif
break;
case T_ADDED: /* added but not committed */
- retval = write_letter (finfo->file, 'A', finfo->update_dir);
+ write_letter (finfo, 'A');
+ retval = 0;
break;
case T_REMOVED: /* removed but not committed */
- retval = write_letter (finfo->file, 'R', finfo->update_dir);
+ write_letter (finfo, 'R');
+ retval = 0;
break;
case T_REMOVE_ENTRY: /* needs to be un-registered */
retval = scratch_file (finfo);
@@ -727,7 +703,23 @@ update_ignproc (file, dir)
char *file;
char *dir;
{
- (void) write_letter (file, '?', dir);
+ struct file_info finfo;
+
+ memset (&finfo, 0, sizeof (finfo));
+ finfo.file = file;
+ finfo.update_dir = dir;
+ if (dir[0] == '\0')
+ finfo.fullname = xstrdup (file);
+ else
+ {
+ finfo.fullname = xmalloc (strlen (file) + strlen (dir) + 10);
+ strcpy (finfo.fullname, dir);
+ strcat (finfo.fullname, "/");
+ strcat (finfo.fullname, file);
+ }
+
+ write_letter (&finfo, '?');
+ free (finfo.fullname);
}
/* ARGSUSED */
@@ -808,7 +800,7 @@ update_dirent_proc (callerdat, dir, repository, update_dir, entries)
if (noexec)
{
/* ignore the missing dir if -n is specified */
- error (0, 0, "New directory `%s' -- ignored", dir);
+ error (0, 0, "New directory `%s' -- ignored", update_dir);
return (R_SKIP_ALL);
}
else
@@ -818,6 +810,7 @@ update_dirent_proc (callerdat, dir, repository, update_dir, entries)
Create_Admin (dir, update_dir, repository, tag, date,
/* This is a guess. We will rewrite it later
via WriteTag. */
+ 0,
0);
rewrite_tag = 1;
nonbranch = 0;
@@ -920,7 +913,8 @@ update_dirleave_proc (callerdat, dir, err, update_dir, entries)
{
if ((cp = strrchr (line, '\n')) != NULL)
*cp = '\0';
- run_setup ("%s %s", line, repository);
+ run_setup (line);
+ run_arg (repository);
cvs_output (program_name, 0);
cvs_output (" ", 1);
cvs_output (command_name, 0);
@@ -1080,6 +1074,9 @@ checkout_file (finfo, vers_ts, adding)
int status;
int file_is_dead;
+ /* Solely to suppress a warning from gcc -Wall. */
+ backup = NULL;
+
/* don't screw with backup files if we're going to stdout */
if (!pipeout)
{
@@ -1093,7 +1090,13 @@ checkout_file (finfo, vers_ts, adding)
else
/* If -f/-t wrappers are being used to wrap up a directory,
then backup might be a directory instead of just a file. */
- (void) unlink_file_dir (backup);
+ if (unlink_file_dir (backup) < 0)
+ {
+ /* Not sure if the existence_error check is needed here. */
+ if (!existence_error (errno))
+ /* FIXME: should include update_dir in message. */
+ error (0, errno, "error removing %s", backup);
+ }
}
file_is_dead = RCS_isdead (vers_ts->srcfile, vers_ts->vn_rcs);
@@ -1133,7 +1136,7 @@ VERS: ", 0);
{
Vers_TS *xvers_ts;
- if (cvswrite == TRUE
+ if (cvswrite
&& !file_is_dead
&& !fileattr_get (finfo->file, "_watched"))
xchmod (finfo->file, 1);
@@ -1155,13 +1158,11 @@ VERS: ", 0);
}
/* set the time from the RCS file iff it was unknown before */
- if (vers_ts->vn_user == NULL ||
- strncmp (vers_ts->ts_rcs, "Initial", 7) == 0)
- {
- set_time = 1;
- }
- else
- set_time = 0;
+ set_time =
+ (!noexec
+ && (vers_ts->vn_user == NULL ||
+ strncmp (vers_ts->ts_rcs, "Initial", 7) == 0)
+ && !file_is_dead);
wrap_fromcvs_process_file (finfo->file);
@@ -1222,7 +1223,7 @@ VERS: ", 0);
if (!really_quiet && !file_is_dead)
{
- write_letter (finfo->file, 'U', finfo->update_dir);
+ write_letter (finfo, 'U');
}
}
}
@@ -1243,7 +1244,13 @@ VERS: ", 0);
{
/* If -f/-t wrappers are being used to wrap up a directory,
then backup might be a directory instead of just a file. */
- (void) unlink_file_dir (backup);
+ if (unlink_file_dir (backup) < 0)
+ {
+ /* Not sure if the existence_error check is needed here. */
+ if (!existence_error (errno))
+ /* FIXME: should include update_dir in message. */
+ error (0, errno, "error removing %s", backup);
+ }
free (backup);
}
@@ -1306,6 +1313,27 @@ patch_file (finfo, vers_ts, docheckout, file_info, checksum)
return 0;
}
+ /* First check that the first revision exists. If it has been nuked
+ by cvs admin -o, then just fall back to checking out entire
+ revisions. In some sense maybe we don't have to do this; after
+ all cvs.texinfo says "Make sure that no-one has checked out a
+ copy of the revision you outdate" but then again, that advice
+ doesn't really make complete sense, because "cvs admin" operates
+ on a working directory and so _someone_ will almost always have
+ _some_ revision checked out. */
+ {
+ char *rev;
+
+ rev = RCS_gettag (finfo->rcs, vers_ts->vn_user, 1, NULL);
+ if (rev == NULL)
+ {
+ *docheckout = 1;
+ return 0;
+ }
+ else
+ free (rev);
+ }
+
backup = xmalloc (strlen (finfo->file)
+ sizeof (CVSADM)
+ sizeof (CVSPREFIX)
@@ -1382,7 +1410,7 @@ patch_file (finfo, vers_ts, docheckout, file_info, checksum)
retcode = 0;
if (! fail)
{
- const char *diff_options;
+ char *diff_options;
/* FIXME: It might be better to come up with a diff library
which can be shared with the diffutils. */
@@ -1400,21 +1428,22 @@ patch_file (finfo, vers_ts, docheckout, file_info, checksum)
}
else
{
- /* FIXME: We should use -a if diff supports it. We should
- probably just copy over most or all of the diff
- handling in the RCS configure script. */
- /* IMHO, we shouldn't copy over anything which even
- vaguely resembles the RCS configure script. That kind of
- thing tends to be ugly, slow, and fragile. It also is a
- a support headache for CVS to behave differently in subtle
- ways based on whether it was installed correctly. Instead we
- should come up with a diff library. -kingdon, Apr 1997. */
+ /* Now that diff is librarified, we could be passing -a if
+ we wanted to. However, it is unclear to me whether we
+ would want to. Does diff -a, in any significant
+ percentage of cases, produce patches which are smaller
+ than the files it is patching? I guess maybe text
+ files with character sets which diff regards as
+ 'binary'. Conversely, do they tend to be much larger
+ in the bad cases? This needs some more
+ thought/investigation, I suspect. */
+
diff_options = "-n";
}
- run_setup ("%s %s %s %s", DIFF, diff_options, file1, file2);
+ retcode = diff_exec (file1, file2, diff_options, finfo->file);
/* A retcode of 0 means no differences. 1 means some differences. */
- if ((retcode = run_exec (RUN_TTY, finfo->file, RUN_TTY, RUN_NORMAL)) != 0
+ if (retcode != 0
&& retcode != 1)
{
fail = 1;
@@ -1434,7 +1463,7 @@ patch_file (finfo, vers_ts, docheckout, file_info, checksum)
file_info->st_mode & ~(S_IWRITE | S_IWGRP | S_IWOTH))
< 0)
error (0, errno, "cannot change mode of file %s", finfo->file);
- if (cvswrite == TRUE
+ if (cvswrite
&& !fileattr_get (finfo->file, "_watched"))
xchmod (finfo->file, 1);
@@ -1482,7 +1511,7 @@ patch_file (finfo, vers_ts, docheckout, file_info, checksum)
if (!really_quiet)
{
- write_letter (finfo->file, 'P', finfo->update_dir);
+ write_letter (finfo, 'P');
}
}
else
@@ -1528,7 +1557,7 @@ patch_file_write (callerdat, buffer, len)
data->final_nl = (buffer[len - 1] == '\n');
if (data->compute_checksum)
- MD5Update (&data->context, buffer, len);
+ MD5Update (&data->context, (unsigned char *) buffer, len);
}
#endif /* SERVER_SUPPORT */
@@ -1537,27 +1566,45 @@ patch_file_write (callerdat, buffer, len)
* Several of the types we process only print a bit of information consisting
* of a single letter and the name.
*/
-static int
-write_letter (file, letter, update_dir)
- char *file;
+static void
+write_letter (finfo, letter)
+ struct file_info *finfo;
int letter;
- char *update_dir;
{
if (!really_quiet)
{
- char buf[2];
+ char *tag = NULL;
+ /* Big enough for "+updated" or any of its ilk. */
+ char buf[80];
+
+ switch (letter)
+ {
+ case 'U':
+ tag = "updated";
+ break;
+ default:
+ /* We don't yet support tagged output except for "U". */
+ break;
+ }
+
+ if (tag != NULL)
+ {
+ sprintf (buf, "+%s", tag);
+ cvs_output_tagged (buf, NULL);
+ }
buf[0] = letter;
buf[1] = ' ';
- cvs_output (buf, 2);
- if (update_dir[0])
+ buf[2] = '\0';
+ cvs_output_tagged ("text", buf);
+ cvs_output_tagged ("fname", finfo->fullname);
+ cvs_output_tagged ("newline", NULL);
+ if (tag != NULL)
{
- cvs_output (update_dir, 0);
- cvs_output ("/", 1);
+ sprintf (buf, "-%s", tag);
+ cvs_output_tagged (buf, NULL);
}
- cvs_output (file, 0);
- cvs_output ("\n", 1);
}
- return (0);
+ return;
}
/*
@@ -1590,7 +1637,8 @@ merge_file (finfo, vers)
copy_file (finfo->file, backup);
xchmod (finfo->file, 1);
- if (strcmp (vers->options, "-kb") == 0)
+ if (strcmp (vers->options, "-kb") == 0
+ || wrap_merge_is_copy (finfo->file))
{
/* For binary files, a merge is always a conflict. We give the
user the two files, and let them resolve it. It is possible
@@ -1609,11 +1657,15 @@ merge_file (finfo, vers)
(struct stat *) NULL, (unsigned char *) NULL);
}
#endif
- error (0, 0, "binary file needs merge");
+ /* Is there a better term than "nonmergeable file"? What we
+ really mean is, not something that CVS cannot or does not
+ want to merge (there might be an external manual or
+ automatic merge process). */
+ error (0, 0, "nonmergeable file needs merge");
error (0, 0, "revision %s from repository is now in %s",
vers->vn_rcs, finfo->fullname);
error (0, 0, "file from working directory is now in %s", backup);
- write_letter (finfo->file, 'C', finfo->update_dir);
+ write_letter (finfo, 'C');
history_write ('C', finfo->update_dir, vers->vn_rcs, finfo->file,
finfo->repository);
@@ -1621,7 +1673,7 @@ merge_file (finfo, vers)
goto out;
}
- status = RCS_merge(vers->srcfile->path,
+ status = RCS_merge(finfo->rcs, vers->srcfile->path, finfo->file,
vers->options, vers->vn_user, vers->vn_rcs);
if (status != 0 && status != 1)
{
@@ -1684,7 +1736,7 @@ merge_file (finfo, vers)
if (!noexec)
error (0, 0, "conflicts found in %s", finfo->fullname);
- write_letter (finfo->file, 'C', finfo->update_dir);
+ write_letter (finfo, 'C');
history_write ('C', finfo->update_dir, vers->vn_rcs, finfo->file, finfo->repository);
@@ -1696,7 +1748,7 @@ merge_file (finfo, vers)
}
else
{
- write_letter (finfo->file, 'M', finfo->update_dir);
+ write_letter (finfo, 'M');
history_write ('G', finfo->update_dir, vers->vn_rcs, finfo->file,
finfo->repository);
}
@@ -1731,14 +1783,6 @@ join_file (finfo, vers)
jdate1 = date_rev1;
jdate2 = date_rev2;
- if (wrap_merge_is_copy (finfo->file))
- {
- error (0, 0,
- "Cannot merge %s because it is a merge-by-copy file.",
- finfo->fullname);
- return;
- }
-
/* Determine if we need to do anything at all. */
if (vers->srcfile == NULL ||
vers->srcfile->path == NULL)
@@ -2034,7 +2078,7 @@ join_file (finfo, vers)
"failed to check out %s file", finfo->fullname);
}
#endif
-
+
/*
* The users currently modified file is moved to a backup file name
* ".#filename.version", so that it will stay around for a few days
@@ -2053,14 +2097,96 @@ join_file (finfo, vers)
xchmod (finfo->file, 1);
options = vers->options;
-#ifdef HAVE_RCS5
#if 0
if (*options == '\0')
options = "-kk"; /* to ignore keyword expansions */
#endif
-#endif
- status = RCS_merge (vers->srcfile->path, options, rev1, rev2);
+ /* If the source of the merge is the same as the working file
+ revision, then we can just RCS_checkout the target (no merging
+ as such). In the text file case, this is probably quite
+ similar to the RCS_merge, but in the binary file case,
+ RCS_merge gives all kinds of trouble. */
+ if (vers->vn_user != NULL
+ && strcmp (rev1, vers->vn_user) == 0
+ /* See comments above about how No_Difference has already been
+ called. */
+ && vers->ts_user != NULL
+ && strcmp (vers->ts_user, vers->ts_rcs) == 0
+
+ /* This is because of the worry below about $Name. If that
+ isn't a problem, I suspect this code probably works for
+ text files too. */
+ && (strcmp (options, "-kb") == 0
+ || wrap_merge_is_copy (finfo->file)))
+ {
+ /* FIXME: what about nametag? What does RCS_merge do with
+ $Name? */
+ if (RCS_checkout (finfo->rcs, finfo->file, rev2, NULL, options,
+ RUN_TTY, (RCSCHECKOUTPROC)0, NULL) != 0)
+ status = 2;
+ else
+ status = 0;
+
+ /* OK, this is really stupid. RCS_checkout carefully removes
+ write permissions, and we carefully put them back. But
+ until someone gets around to fixing it, that seems like the
+ easiest way to get what would seem to be the right mode.
+ I don't check CVSWRITE or _watched; I haven't thought about
+ that in great detail, but it seems like a watched file should
+ be checked out (writable) after a merge. */
+ xchmod (finfo->file, 1);
+
+ /* Traditionally, the text file case prints a whole bunch of
+ scary looking and verbose output which fails to tell the user
+ what is really going on (it gives them rev1 and rev2 but doesn't
+ indicate in any way that rev1 == vn_user). I think just a
+ simple "U foo" is good here; it seems analogous to the case in
+ which the file was added on the branch in terms of what to
+ print. */
+ write_letter (finfo, 'U');
+ }
+ else if (strcmp (options, "-kb") == 0
+ || wrap_merge_is_copy (finfo->file))
+ {
+ /* We are dealing with binary files, but real merging would
+ need to take place. This is a conflict. We give the user
+ the two files, and let them resolve it. It is possible
+ that we should require a "touch foo" or similar step before
+ we allow a checkin. */
+ if (RCS_checkout (finfo->rcs, finfo->file, rev2, NULL, options,
+ RUN_TTY, (RCSCHECKOUTPROC)0, NULL) != 0)
+ status = 2;
+ else
+ status = 0;
+
+ /* OK, this is really stupid. RCS_checkout carefully removes
+ write permissions, and we carefully put them back. But
+ until someone gets around to fixing it, that seems like the
+ easiest way to get what would seem to be the right mode.
+ I don't check CVSWRITE or _watched; I haven't thought about
+ that in great detail, but it seems like a watched file should
+ be checked out (writable) after a merge. */
+ xchmod (finfo->file, 1);
+
+ /* Hmm. We don't give them REV1 anywhere. I guess most people
+ probably don't have a 3-way merge tool for the file type in
+ question, and might just get confused if we tried to either
+ provide them with a copy of the file from REV1, or even just
+ told them what REV1 is so they can get it themself, but it
+ might be worth thinking about. */
+ /* See comment in merge_file about the "nonmergeable file"
+ terminology. */
+ error (0, 0, "nonmergeable file needs merge");
+ error (0, 0, "revision %s from repository is now in %s",
+ rev2, finfo->fullname);
+ error (0, 0, "file from working directory is now in %s", backup);
+ write_letter (finfo, 'C');
+ }
+ else
+ status = RCS_merge (finfo->rcs, vers->srcfile->path, finfo->file,
+ options, rev1, rev2);
+
if (status != 0 && status != 1)
{
error (0, status == -1 ? errno : 0,
diff --git a/contrib/cvs/src/vers_ts.c b/contrib/cvs/src/vers_ts.c
index 613e52e..bae3a43 100644
--- a/contrib/cvs/src/vers_ts.c
+++ b/contrib/cvs/src/vers_ts.c
@@ -3,7 +3,7 @@
* Copyright (c) 1989-1992, Brian Berliner
*
* You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS 1.4 kit.
+ * specified in the README file that comes with the CVS source distribution.
*/
#include "cvs.h"
@@ -12,14 +12,16 @@
static void time_stamp_server PROTO((char *, Vers_TS *, Entnode *));
#endif
-/*
- * Fill in and return a Vers_TS structure "user" is the name of the local
- * file; entries is the entries file - preparsed for our pleasure. rcs is
- * the current source control file - preparsed for our pleasure.
- */
+/* Fill in and return a Vers_TS structure for the file FINFO. TAG and
+ DATE are from the command line. */
+
Vers_TS *
Version_TS (finfo, options, tag, date, force_tag_match, set_time)
struct file_info *finfo;
+
+ /* Keyword expansion options, I think generally from the command
+ line. Can be either NULL or "" to indicate none are specified
+ here. */
char *options;
char *tag;
char *date;
@@ -57,6 +59,18 @@ Version_TS (finfo, options, tag, date, force_tag_match, set_time)
{
entdata = (Entnode *) p->data;
+ if (entdata->type == ENT_SUBDIR)
+ {
+ /* According to cvs.texinfo, the various fields in the Entries
+ file for a directory (other than the name) do not have a
+ defined meaning. We need to pass them along without getting
+ confused based on what is in them. Therefore we make sure
+ not to set vn_user and the like from Entries, add.c and
+ perhaps other code will expect these fields to be NULL for
+ a directory. */
+ vers_ts->entdata = entdata;
+ }
+ else
#ifdef SERVER_SUPPORT
/* An entries line with "D" in the timestamp indicates that the
client sent Is-modified without sending Entry. So we want to
@@ -79,22 +93,25 @@ Version_TS (finfo, options, tag, date, force_tag_match, set_time)
if (!(sdtp && sdtp->aflag))
vers_ts->date = xstrdup (entdata->date);
}
- if (!options || (options && *options == '\0'))
- {
- if (!(sdtp && sdtp->aflag))
- vers_ts->options = xstrdup (entdata->options);
- }
vers_ts->entdata = entdata;
}
+ /* Even if we don't have an "entries line" as such
+ (vers_ts->entdata), we want to pick up options which could
+ have been from a Kopt protocol request. */
+ if (!options || (options && *options == '\0'))
+ {
+ if (!(sdtp && sdtp->aflag))
+ vers_ts->options = xstrdup (entdata->options);
+ }
}
/*
* -k options specified on the command line override (and overwrite)
* options stored in the entries file
*/
- if (options)
+ if (options && *options != '\0')
vers_ts->options = xstrdup (options);
- else if (!vers_ts->options)
+ else if (!vers_ts->options || *vers_ts->options == '\0')
{
if (finfo->rcs != NULL)
{
@@ -175,7 +192,7 @@ Version_TS (finfo, options, tag, date, force_tag_match, set_time)
* get the Date the revision was checked in. If "user" exists, set
* its mtime.
*/
- if (set_time)
+ if (set_time && vers_ts->vn_rcs != NULL)
{
#ifdef SERVER_SUPPORT
if (server_active)
@@ -186,15 +203,18 @@ Version_TS (finfo, options, tag, date, force_tag_match, set_time)
struct utimbuf t;
memset (&t, 0, sizeof (t));
- if (vers_ts->vn_rcs)
+ t.modtime =
+ RCS_getrevtime (rcsdata, vers_ts->vn_rcs, 0, 0);
+ if (t.modtime != (time_t) -1)
{
- t.modtime =
- RCS_getrevtime (rcsdata, vers_ts->vn_rcs, 0, 0);
- if (t.modtime != (time_t) -1)
- {
- t.actime = t.modtime;
- (void) utime (finfo->file, &t);
- }
+ t.actime = t.modtime;
+
+ /* This used to need to ignore existence_errors
+ (for cases like where update.c now clears
+ set_time if noexec, but didn't used to). I
+ think maybe now it doesn't (server_modtime does
+ not like those kinds of cases). */
+ (void) utime (finfo->file, &t);
}
}
}
diff --git a/contrib/cvs/src/version.c b/contrib/cvs/src/version.c
index c442179..19a9973 100644
--- a/contrib/cvs/src/version.c
+++ b/contrib/cvs/src/version.c
@@ -12,7 +12,7 @@
#include "cvs.h"
-char *version_string = "\nConcurrent Versions System (CVS) 1.9.10";
+char *version_string = "\nConcurrent Versions System (CVS) 1.9.23";
#ifdef CLIENT_SUPPORT
#ifdef SERVER_SUPPORT
diff --git a/contrib/cvs/src/watch.c b/contrib/cvs/src/watch.c
index 6cec157..d9ba1d7 100644
--- a/contrib/cvs/src/watch.c
+++ b/contrib/cvs/src/watch.c
@@ -24,6 +24,7 @@ const char *const watch_usage[] =
"-R (on/off/add/remove): Process directories recursively\n",
"-a (add/remove): Specify what actions, one of\n",
" edit,unedit,commit,all,none\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
@@ -417,6 +418,7 @@ static const char *const watchers_usage[] =
"Usage: %s %s [-lR] [files...]\n",
"\t-l\tProcess this directory only (not recursive).\n",
"\t-R\tProcess directories recursively.\n",
+ "(Specify the --help global option for a list of other help options)\n",
NULL
};
diff --git a/contrib/cvs/src/wrapper.c b/contrib/cvs/src/wrapper.c
index 825cdcd..dc8342a 100644
--- a/contrib/cvs/src/wrapper.c
+++ b/contrib/cvs/src/wrapper.c
@@ -57,12 +57,17 @@ static int wrap_size=0;
static int wrap_count=0;
static int wrap_tempcount=0;
-/* FIXME: wrap_saved_count is never set to any non-zero value.
- wrap_name_has and wrap_matching_entry should be using
- wrap_tempcount instead. I believe the consequence of this is that
- .cvswrappers files are ignored (that was my own experience when I
- tried to use one). If this bug is fixed, would be nice to write a
- sanity.sh testcase for .cvswrappers files. */
+/* FIXME: the relationship between wrap_count, wrap_tempcount,
+ * wrap_saved_count, and wrap_saved_tempcount is not entirely clear;
+ * it is certainly suspicious that wrap_saved_count is never set to a
+ * value other than zero! If the variable isn't being used, it should
+ * be removed. And in general, we should describe how temporary
+ * vs. permanent wrappers are implemented, and then make sure the
+ * implementation is actually doing that.
+ *
+ * Right now things seem to be working, but that's no guarantee there
+ * isn't a bug lurking somewhere in the murk.
+ */
static int wrap_saved_count=0;
@@ -79,7 +84,7 @@ void wrap_restore_saved PROTO((void));
void wrap_setup()
{
- struct passwd *pw;
+ char *homedir;
#ifdef CLIENT_SUPPORT
if (!client_active)
@@ -102,14 +107,14 @@ void wrap_setup()
}
/* Then add entries found in home dir, (if user has one) and file
- exists. (FIXME: I think this probably should be using
- get_homedir, i.e. $HOME). */
- if ((pw = (struct passwd *) getpwuid (getuid ())) && pw->pw_dir)
+ exists. */
+ homedir = get_homedir ();
+ if (homedir != NULL)
{
char *file;
- file = xmalloc (strlen (pw->pw_dir) + sizeof (CVSDOTWRAPPER) + 10);
- (void) sprintf (file, "%s/%s", pw->pw_dir, CVSDOTWRAPPER);
+ file = xmalloc (strlen (homedir) + sizeof (CVSDOTWRAPPER) + 10);
+ (void) sprintf (file, "%s/%s", homedir, CVSDOTWRAPPER);
if (isfile (file))
{
wrap_add_file (file, 0);
@@ -383,7 +388,7 @@ wrap_name_has (name,has)
const char *name;
WrapMergeHas has;
{
- int x,count=wrap_count+wrap_saved_count;
+ int x,count=wrap_count+wrap_tempcount;
char *temp;
for(x=0;x<count;++x)
@@ -415,7 +420,7 @@ static WrapperEntry *
wrap_matching_entry (name)
const char *name;
{
- int x,count=wrap_count+wrap_saved_count;
+ int x,count=wrap_count+wrap_tempcount;
for(x=0;x<count;++x)
if (CVS_FNMATCH (wrap_list[x]->wildCard, name, 0) == 0)
@@ -456,6 +461,7 @@ wrap_tocvs_process_file(fileName)
{
WrapperEntry *e=wrap_matching_entry(fileName);
static char *buf = NULL;
+ char *args;
if(e==NULL || e->tocvsFilter==NULL)
return NULL;
@@ -464,8 +470,16 @@ wrap_tocvs_process_file(fileName)
free (buf);
buf = cvs_temp_name ();
- run_setup(e->tocvsFilter,fileName,buf);
+ args = xmalloc (strlen (e->tocvsFilter)
+ + strlen (fileName)
+ + strlen (buf));
+ /* FIXME: sprintf will blow up if the format string contains items other
+ than %s, or contains too many %s's. We should instead be parsing
+ e->tocvsFilter ourselves and giving a real error. */
+ sprintf (args, e->tocvsFilter, fileName, buf);
+ run_setup (args);
run_exec(RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY );
+ free (args);
return buf;
}
@@ -485,12 +499,20 @@ void
wrap_fromcvs_process_file(fileName)
const char *fileName;
{
+ char *args;
WrapperEntry *e=wrap_matching_entry(fileName);
if(e==NULL || e->fromcvsFilter==NULL)
return;
- run_setup(e->fromcvsFilter,fileName);
+ args = xmalloc (strlen (e->fromcvsFilter)
+ + strlen (fileName));
+ /* FIXME: sprintf will blow up if the format string contains items other
+ than %s, or contains too many %s's. We should instead be parsing
+ e->fromcvsFilter ourselves and giving a real error. */
+ sprintf (args, e->fromcvsFilter, fileName);
+ run_setup (args);
run_exec(RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL );
+ free (args);
return;
}
diff --git a/contrib/cvs/src/zlib.c b/contrib/cvs/src/zlib.c
index 02ad70c..ca50130 100644
--- a/contrib/cvs/src/zlib.c
+++ b/contrib/cvs/src/zlib.c
@@ -426,4 +426,197 @@ compress_buffer_shutdown_output (closure)
return buf_shutdown (cb->buf);
}
+
+
+/* Here is our librarified gzip implementation. It is very minimal
+ but attempts to be RFC1952 compliant. */
+/* Note that currently only the client uses the gzip library. If we
+ make the server use it too (which should be straightforward), then
+ filter_stream_through_program, filter_through_gzip, and
+ filter_through_gunzip can go away. */
+
+/* BUF should contain SIZE bytes of gzipped data (RFC1952/RFC1951).
+ We are to uncompress the data and write the result to the file
+ descriptor FD. If something goes wrong, give an error message
+ mentioning FULLNAME as the name of the file for FD (and make it a
+ fatal error if we can't recover from it). */
+
+void
+gunzip_and_write (fd, fullname, buf, size)
+ int fd;
+ char *fullname;
+ unsigned char *buf;
+ size_t size;
+{
+ size_t pos;
+ z_stream zstr;
+ int zstatus;
+ unsigned char outbuf[32768];
+ unsigned long crc;
+
+ if (buf[0] != 31 || buf[1] != 139)
+ error (1, 0, "gzipped data does not start with gzip identification");
+ if (buf[2] != 8)
+ error (1, 0, "only the deflate compression method is supported");
+
+ /* Skip over the fixed header, and then skip any of the variable-length
+ fields. */
+ pos = 10;
+ if (buf[3] & 4)
+ pos += buf[pos] + (buf[pos + 1] << 8) + 2;
+ if (buf[3] & 8)
+ pos += strlen (buf + pos) + 1;
+ if (buf[3] & 16)
+ pos += strlen (buf + pos) + 1;
+ if (buf[3] & 2)
+ pos += 2;
+
+ memset (&zstr, 0, sizeof zstr);
+ /* Passing a negative argument tells zlib not to look for a zlib
+ (RFC1950) header. This is an undocumented feature; I suppose if
+ we wanted to be anal we could synthesize a header instead,
+ but why bother? */
+ zstatus = inflateInit2 (&zstr, -15);
+
+ if (zstatus != Z_OK)
+ compress_error (1, zstatus, &zstr, fullname);
+
+ /* I don't see why we should have to include the 8 byte trailer in
+ avail_in. But I see that zlib/gzio.c does, and it seemed to fix
+ a fairly rare bug in which we'd get a Z_BUF_ERROR for no obvious
+ reason. */
+ zstr.avail_in = size - pos;
+ zstr.next_in = buf + pos;
+
+ crc = crc32 (0, NULL, 0);
+
+ do
+ {
+ zstr.avail_out = sizeof (outbuf);
+ zstr.next_out = outbuf;
+ zstatus = inflate (&zstr, Z_NO_FLUSH);
+ if (zstatus != Z_STREAM_END && zstatus != Z_OK)
+ compress_error (1, zstatus, &zstr, fullname);
+ if (write (fd, outbuf, sizeof (outbuf) - zstr.avail_out) < 0)
+ error (1, errno, "writing decompressed file %s", fullname);
+ crc = crc32 (crc, outbuf, sizeof (outbuf) - zstr.avail_out);
+ } while (zstatus != Z_STREAM_END);
+ zstatus = inflateEnd (&zstr);
+ if (zstatus != Z_OK)
+ compress_error (0, zstatus, &zstr, fullname);
+
+ if (crc != (buf[zstr.total_in + 10]
+ + (buf[zstr.total_in + 11] << 8)
+ + (buf[zstr.total_in + 12] << 16)
+ + (buf[zstr.total_in + 13] << 24)))
+ error (1, 0, "CRC error uncompressing %s", fullname);
+
+ if (zstr.total_out != (buf[zstr.total_in + 14]
+ + (buf[zstr.total_in + 15] << 8)
+ + (buf[zstr.total_in + 16] << 16)
+ + (buf[zstr.total_in + 17] << 24)))
+ error (1, 0, "invalid length uncompressing %s", fullname);
+}
+
+/* Read all of FD and put the gzipped data (RFC1952/RFC1951) into *BUF,
+ replacing previous contents of *BUF. *BUF is malloc'd and *SIZE is
+ its allocated size. Put the actual number of bytes of data in
+ *LEN. If something goes wrong, give an error message mentioning
+ FULLNAME as the name of the file for FD (and make it a fatal error
+ if we can't recover from it). LEVEL is the compression level (1-9). */
+
+void
+read_and_gzip (fd, fullname, buf, size, len, level)
+ int fd;
+ char *fullname;
+ unsigned char **buf;
+ size_t *size;
+ size_t *len;
+ int level;
+{
+ z_stream zstr;
+ int zstatus;
+ unsigned char inbuf[8192];
+ int nread;
+ unsigned long crc;
+
+ if (*size < 1024)
+ {
+ *size = 1024;
+ *buf = (unsigned char *) xrealloc (*buf, *size);
+ }
+ (*buf)[0] = 31;
+ (*buf)[1] = 139;
+ (*buf)[2] = 8;
+ (*buf)[3] = 0;
+ (*buf)[4] = (*buf)[5] = (*buf)[6] = (*buf)[7] = 0;
+ /* Could set this based on level, but why bother? */
+ (*buf)[8] = 0;
+ (*buf)[9] = 255;
+
+ memset (&zstr, 0, sizeof zstr);
+ zstatus = deflateInit2 (&zstr, level, Z_DEFLATED, -15, 8,
+ Z_DEFAULT_STRATEGY);
+ crc = crc32 (0, NULL, 0);
+ if (zstatus != Z_OK)
+ compress_error (1, zstatus, &zstr, fullname);
+ zstr.avail_out = *size;
+ zstr.next_out = *buf + 10;
+
+ while (1)
+ {
+ int finish = 0;
+
+ nread = read (fd, inbuf, sizeof inbuf);
+ if (nread < 0)
+ error (1, errno, "cannot read %s", fullname);
+ else if (nread == 0)
+ /* End of file. */
+ finish = 1;
+ crc = crc32 (crc, inbuf, nread);
+ zstr.next_in = inbuf;
+ zstr.avail_in = nread;
+
+ do
+ {
+ size_t offset;
+
+ /* I don't see this documented anywhere, but deflate seems
+ to tend to dump core sometimes if we pass it Z_FINISH and
+ a small (e.g. 2147 byte) avail_out. So we insist on at
+ least 4096 bytes (that is what zlib/gzio.c uses). */
+
+ if (zstr.avail_out < 4096)
+ {
+ offset = zstr.next_out - *buf;
+ *size *= 2;
+ *buf = xrealloc (*buf, *size);
+ zstr.next_out = *buf + offset;
+ zstr.avail_out = *size - offset;
+ }
+
+ zstatus = deflate (&zstr, finish ? Z_FINISH : 0);
+ if (zstatus == Z_STREAM_END)
+ goto done;
+ else if (zstatus != Z_OK)
+ compress_error (0, zstatus, &zstr, fullname);
+ } while (zstr.avail_out == 0);
+ }
+ done:
+ *(*buf + zstr.total_out + 10) = crc & 0xff;
+ *(*buf + zstr.total_out + 11) = (crc >> 8) & 0xff;
+ *(*buf + zstr.total_out + 12) = (crc >> 16) & 0xff;
+ *(*buf + zstr.total_out + 13) = (crc >> 24) & 0xff;
+
+ *(*buf + zstr.total_out + 14) = zstr.total_in & 0xff;
+ *(*buf + zstr.total_out + 15) = (zstr.total_in >> 8) & 0xff;
+ *(*buf + zstr.total_out + 16) = (zstr.total_in >> 16) & 0xff;
+ *(*buf + zstr.total_out + 17) = (zstr.total_in >> 24) & 0xff;
+
+ *len = zstr.total_out + 18;
+
+ zstatus = deflateEnd (&zstr);
+ if (zstatus != Z_OK)
+ compress_error (0, zstatus, &zstr, fullname);
+}
#endif /* defined (SERVER_SUPPORT) || defined (CLIENT_SUPPORT) */
OpenPOWER on IntegriCloud