summaryrefslogtreecommitdiffstats
path: root/contrib/cvs/src
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-06-22 10:55:49 +0000
committerpeter <peter@FreeBSD.org>1997-06-22 10:55:49 +0000
commit571cfa0005d94d99d1341bf8ab02be04d4df5f9f (patch)
tree8684660dbfd105deed9a44c9e97d4f56b231fac1 /contrib/cvs/src
parentfc35590c6dddf32e1fa855b541dc28a23965f90c (diff)
downloadFreeBSD-src-571cfa0005d94d99d1341bf8ab02be04d4df5f9f.zip
FreeBSD-src-571cfa0005d94d99d1341bf8ab02be04d4df5f9f.tar.gz
Import cvs-1.9.10
Diffstat (limited to 'contrib/cvs/src')
-rw-r--r--contrib/cvs/src/ChangeLog123
-rw-r--r--contrib/cvs/src/checkout.c45
-rw-r--r--contrib/cvs/src/client.c58
-rw-r--r--contrib/cvs/src/cvs.h6
-rw-r--r--contrib/cvs/src/find_names.c4
-rw-r--r--contrib/cvs/src/ignore.c8
-rw-r--r--contrib/cvs/src/import.c142
-rw-r--r--contrib/cvs/src/lock.c2
-rw-r--r--contrib/cvs/src/main.c20
-rw-r--r--contrib/cvs/src/mkmodules.c24
-rw-r--r--contrib/cvs/src/patch.c8
-rw-r--r--contrib/cvs/src/rcs.c12
-rw-r--r--contrib/cvs/src/rcs.h4
-rw-r--r--contrib/cvs/src/rcscmds.c2
-rw-r--r--contrib/cvs/src/root.c80
-rw-r--r--contrib/cvs/src/run.c12
-rwxr-xr-xcontrib/cvs/src/sanity.sh450
-rw-r--r--contrib/cvs/src/server.c47
-rw-r--r--contrib/cvs/src/server.h9
-rw-r--r--contrib/cvs/src/subr.c22
-rw-r--r--contrib/cvs/src/update.c21
-rw-r--r--contrib/cvs/src/vers_ts.c25
-rw-r--r--contrib/cvs/src/version.c2
-rw-r--r--contrib/cvs/src/wrapper.c4
24 files changed, 957 insertions, 173 deletions
diff --git a/contrib/cvs/src/ChangeLog b/contrib/cvs/src/ChangeLog
index 5f4f43e..0c8b0f6 100644
--- a/contrib/cvs/src/ChangeLog
+++ b/contrib/cvs/src/ChangeLog
@@ -1,3 +1,126 @@
+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
diff --git a/contrib/cvs/src/checkout.c b/contrib/cvs/src/checkout.c
index 8209601..e36e729 100644
--- a/contrib/cvs/src/checkout.c
+++ b/contrib/cvs/src/checkout.c
@@ -221,8 +221,11 @@ checkout (argc, argv)
if (shorten == -1)
shorten = 0;
- if ((!(cat + status) && argc == 0) || ((cat + status) && argc != 0))
- usage (valid_usage);
+ if ((cat || status) && argc != 0)
+ error (1, 0, "-c and -s must not get any arguments");
+
+ if (!(cat || status) && argc == 0)
+ error (1, 0, "must specify at least one module or directory");
if (where && pipeout)
error (1, 0, "-d and -p are mutually exclusive");
@@ -230,20 +233,10 @@ checkout (argc, argv)
if (strcmp (command_name, "export") == 0)
{
if (!tag && !date)
- {
- error (0, 0, "must specify a tag or date");
- usage (valid_usage);
- }
+ error (1, 0, "must specify a tag or date");
+
if (tag && isdigit (tag[0]))
error (1, 0, "tag `%s' must be a symbolic tag", tag);
-/*
- * mhy 950615: -kv doesn't work for binaries with RCS keywords.
- * Instead use the default provided in the RCS file (-ko for binaries).
- */
-#if 0
- if (!options)
- options = RCS_check_kflag ("v");/* -kv is default */
-#endif
}
if (!safe_location()) {
@@ -279,10 +272,14 @@ checkout (argc, argv)
client_expand_modules (argc, argv, local);
}
- if (!run_module_prog) send_arg ("-n");
- if (local) send_arg ("-l");
- if (pipeout) send_arg ("-p");
- if (!force_tag_match) send_arg ("-f");
+ if (!run_module_prog)
+ send_arg ("-n");
+ if (local)
+ send_arg ("-l");
+ if (pipeout)
+ send_arg ("-p");
+ if (!force_tag_match)
+ send_arg ("-f");
if (aflag)
send_arg("-A");
if (!shorten)
@@ -293,16 +290,10 @@ checkout (argc, argv)
if (cat)
send_arg("-c");
if (where != NULL)
- {
option_with_arg ("-d", where);
- }
if (status)
send_arg("-s");
- /* Why not send -k for export? This would appear to make
- remote export differ from local export. FIXME. */
- if (strcmp (command_name, "export") != 0
- && options != NULL
- && options[0] != '\0')
+ if (options != NULL && options[0] != '\0')
send_arg (options);
option_with_arg ("-r", tag);
if (date)
@@ -335,6 +326,8 @@ checkout (argc, argv)
if (cat || status)
{
cat_module (status);
+ if (options)
+ free (options);
return (0);
}
db = open_module ();
@@ -432,6 +425,8 @@ checkout (argc, argv)
where, shorten, local, run_module_prog,
(char *) NULL);
close_module (db);
+ if (options)
+ free (options);
return (err);
}
diff --git a/contrib/cvs/src/client.c b/contrib/cvs/src/client.c
index 49f7ac8..a1ed876 100644
--- a/contrib/cvs/src/client.c
+++ b/contrib/cvs/src/client.c
@@ -1,4 +1,14 @@
-/* CVS client-related stuff. */
+/* CVS client-related stuff.
+
+ 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. */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1303,7 +1313,28 @@ handle_mode (args, len)
stored_mode = xstrdup (args);
stored_mode_valid = 1;
}
+
+/* Nonzero if time was specified in Mod-time. */
+static int stored_modtime_valid;
+/* Time specified in Mod-time. */
+static time_t stored_modtime;
+static void handle_mod_time PROTO ((char *, int));
+
+static void
+handle_mod_time (args, len)
+ char *args;
+ int len;
+{
+ if (stored_modtime_valid)
+ error (0, 0, "protocol error: duplicate Mod-time");
+ stored_modtime = get_date (args, NULL);
+ if (stored_modtime == (time_t) -1)
+ error (0, 0, "protocol error: cannot parse date %s", args);
+ else
+ stored_modtime_valid = 1;
+}
+
/*
* If we receive a patch, but the patch program fails to apply it, we
* want to request the original file. We keep a list of files whose
@@ -1787,7 +1818,7 @@ update_entries (data_arg, ent_list, short_pathname, filename)
the file out, so that we don't have to read it
back in again. */
MD5Init (&context);
- MD5Update (&context, patchedbuf, patchedlen);
+ MD5Update (&context, (unsigned char *) patchedbuf, patchedlen);
MD5Final (checksum, &context);
if (memcmp (checksum, stored_checksum, 16) != 0)
{
@@ -1899,6 +1930,19 @@ update_entries (data_arg, ent_list, short_pathname, filename)
change_mode (filename, stored_mode);
stored_mode_valid = 0;
+ if (stored_modtime_valid)
+ {
+ struct utimbuf t;
+
+ memset (&t, 0, sizeof (t));
+ /* There is probably little point in trying to preserved the
+ actime (or is there? What about Checked-in?). */
+ t.modtime = t.actime = stored_modtime;
+ if (utime (filename, &t) < 0)
+ error (0, errno, "cannot set time on %s", filename);
+ stored_modtime_valid = 0;
+ }
+
/*
* Process the entries line. Do this after we've written the file,
* since we need the timestamp.
@@ -2869,6 +2913,7 @@ struct response responses[] =
RSP_LINE("Patched", handle_patched, response_type_normal, rs_optional),
RSP_LINE("Rcs-diff", handle_rcs_diff, response_type_normal, rs_optional),
RSP_LINE("Mode", handle_mode, response_type_normal, rs_optional),
+ RSP_LINE("Mod-time", handle_mod_time, response_type_normal, rs_optional),
RSP_LINE("Removed", handle_removed, response_type_normal, rs_essential),
RSP_LINE("Remove-entry", handle_remove_entry, response_type_normal,
rs_optional),
@@ -3564,7 +3609,12 @@ start_server ()
#endif
case ext_method:
+#if defined (NO_EXT_METHOD)
+ error (0, 0, ":ext: method not supported by this port of CVS");
+ error (1, 0, "try :server: instead");
+#else
start_rsh_server (&tofd, &fromfd);
+#endif
break;
case server_method:
@@ -3873,6 +3923,8 @@ the :server: access method is not supported by this port of CVS");
walklist (variable_list, send_variable_proc, NULL);
}
+#ifndef NO_EXT_METHOD
+
/* Contact the server by starting it with rsh. */
/* Right now, we have two different definitions for this function,
@@ -4039,6 +4091,8 @@ start_rsh_server (tofdp, fromfdp)
#endif /* START_RSH_WITH_POPEN_RW */
+#endif /* NO_EXT_METHOD */
+
/* Send an argument STRING. */
diff --git a/contrib/cvs/src/cvs.h b/contrib/cvs/src/cvs.h
index 81659f3..80bb468 100644
--- a/contrib/cvs/src/cvs.h
+++ b/contrib/cvs/src/cvs.h
@@ -418,10 +418,16 @@ 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 *Name_Root PROTO((char *dir, char *update_dir));
int parse_cvsroot PROTO((char *CVSroot));
void set_local_cvsroot PROTO((char *dir));
void Create_Root PROTO((char *dir, char *rootdir));
+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));
diff --git a/contrib/cvs/src/find_names.c b/contrib/cvs/src/find_names.c
index a7a91bb..5d2a79e 100644
--- a/contrib/cvs/src/find_names.c
+++ b/contrib/cvs/src/find_names.c
@@ -256,7 +256,7 @@ find_rcs (dir, list)
/* read the dir, grabbing the ,v files */
while ((dp = readdir (dirp)) != NULL)
{
- if (fnmatch (RCSPAT, dp->d_name, 0) == 0)
+ if (CVS_FNMATCH (RCSPAT, dp->d_name, 0) == 0)
{
char *comma;
@@ -320,7 +320,7 @@ find_dirs (dir, list, checkadm, entries)
continue;
#endif
/* don't bother stating ,v files */
- if (fnmatch (RCSPAT, dp->d_name, 0) == 0)
+ if (CVS_FNMATCH (RCSPAT, dp->d_name, 0) == 0)
continue;
expand_string (&tmp,
diff --git a/contrib/cvs/src/ignore.c b/contrib/cvs/src/ignore.c
index 05e2f1f..908b5de 100644
--- a/contrib/cvs/src/ignore.c
+++ b/contrib/cvs/src/ignore.c
@@ -269,7 +269,9 @@ ign_name (name)
{
/* We do a case-insensitive match by calling fnmatch on copies of
the pattern and the name which have been converted to
- lowercase. */
+ lowercase. FIXME: would be much cleaner to just unify this
+ with the other case-insensitive fnmatch stuff (FOLD_FN_CHAR
+ in lib/fnmatch.c; os2_fnmatch in emx/system.c). */
char *name_lower;
char *pat_lower;
char *p;
@@ -282,7 +284,7 @@ ign_name (name)
pat_lower = xstrdup (*cpp++);
for (p = pat_lower; *p != '\0'; ++p)
*p = tolower (*p);
- if (fnmatch (pat_lower, name_lower, 0) == 0)
+ if (CVS_FNMATCH (pat_lower, name_lower, 0) == 0)
goto matched;
free (pat_lower);
}
@@ -296,7 +298,7 @@ ign_name (name)
else
{
while (*cpp)
- if (fnmatch (*cpp++, name, 0) == 0)
+ if (CVS_FNMATCH (*cpp++, name, 0) == 0)
return 1;
return 0;
}
diff --git a/contrib/cvs/src/import.c b/contrib/cvs/src/import.c
index c05fa0d..3243a96 100644
--- a/contrib/cvs/src/import.c
+++ b/contrib/cvs/src/import.c
@@ -18,12 +18,11 @@
#include "cvs.h"
#include "savecwd.h"
+#include <assert.h>
#define FILE_HOLDER ".#cvsxxx"
static char *get_comment PROTO((char *user));
-static int add_rcs_file PROTO((char *message, char *rcs, char *user, char *vtag,
- int targc, char *targv[]));
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));
@@ -475,7 +474,8 @@ 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, vtag, targc, targv);
+ retval = add_rcs_file (message, rcs, vfile, vhead, vbranch,
+ vtag, targc, targv, logfp);
free (rcs);
return retval;
}
@@ -876,14 +876,36 @@ get_comment (user)
return retval;
}
-static int
-add_rcs_file (message, rcs, user, vtag, targc, targv)
+/* 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. */
+int
+add_rcs_file (message, rcs, user, add_vhead, add_vbranch, vtag, targc, targv,
+ add_logfp)
+ /* Log message for the addition. */
char *message;
+ /* Filename of the RCS file to create. */
char *rcs;
+ /* Filename of the file to serve as the contents of the initial
+ revision. */
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. */
+ char *add_vhead;
+
+ /* Vendor branch to import to, or NULL if none. If non-NULL, then
+ vtag should also be non-NULL. */
+ char *add_vbranch;
char *vtag;
int targc;
char *targv[];
+
+ /* Write errors to here as well as via error (), or NULL if we should
+ use only error (). */
+ FILE *add_logfp;
{
FILE *fprcs, *fpuser;
struct stat sb;
@@ -918,7 +940,7 @@ add_rcs_file (message, rcs, user, vtag, targc, targv)
if (fpuser == NULL)
{
/* not fatal, continue import */
- fperror (logfp, 0, errno, "ERROR: cannot read file %s", userfile);
+ fperror (add_logfp, 0, errno, "ERROR: cannot read file %s", userfile);
error (0, errno, "ERROR: cannot read file %s", userfile);
goto read_error;
}
@@ -932,20 +954,36 @@ add_rcs_file (message, rcs, user, vtag, targc, targv)
/*
* putadmin()
*/
- if (fprintf (fprcs, "head %s;\012", vhead) < 0 ||
- fprintf (fprcs, "branch %s;\012", vbranch) < 0 ||
- fprintf (fprcs, "access ;\012") < 0 ||
+ if (fprintf (fprcs, "head %s;\012", add_vhead) < 0)
+ goto write_error;
+ if (add_vbranch != NULL)
+ {
+ if (fprintf (fprcs, "branch %s;\012", add_vbranch) < 0)
+ goto write_error;
+ }
+ if (fprintf (fprcs, "access ;\012") < 0 ||
fprintf (fprcs, "symbols ") < 0)
{
goto write_error;
}
- for (i = targc - 1; i >= 0; i--) /* RCS writes the symbols backwards */
- if (fprintf (fprcs, "%s:%s.1 ", targv[i], vbranch) < 0)
+ for (i = targc - 1; i >= 0; i--)
+ {
+ /* RCS writes the symbols backwards */
+ assert (add_vbranch != NULL);
+ if (fprintf (fprcs, "%s:%s.1 ", targv[i], add_vbranch) < 0)
goto write_error;
+ }
+
+ if (add_vbranch != NULL)
+ {
+ if (fprintf (fprcs, "%s:%s", vtag, add_vbranch) < 0)
+ goto write_error;
+ }
+ if (fprintf (fprcs, ";\012") < 0)
+ goto write_error;
- if (fprintf (fprcs, "%s:%s;\012", vtag, vbranch) < 0 ||
- fprintf (fprcs, "locks ; strict;\012") < 0 ||
+ if (fprintf (fprcs, "locks ; strict;\012") < 0 ||
/* XXX - make sure @@ processing works in the RCS file */
fprintf (fprcs, "comment @%s@;\012", get_comment (user)) < 0)
{
@@ -997,16 +1035,33 @@ add_rcs_file (message, rcs, user, vtag, targc, targv)
#endif
author = getcaller ();
- if (fprintf (fprcs, "\012%s\012", vhead) < 0 ||
- fprintf (fprcs, "date %s; author %s; state Exp;\012",
- altdate1, author) < 0 ||
- fprintf (fprcs, "branches %s.1;\012", vbranch) < 0 ||
- fprintf (fprcs, "next ;\012") < 0 ||
- fprintf (fprcs, "\012%s.1\012", vbranch) < 0 ||
+ if (fprintf (fprcs, "\012%s\012", add_vhead) < 0 ||
fprintf (fprcs, "date %s; author %s; state Exp;\012",
- altdate2, author) < 0 ||
- fprintf (fprcs, "branches ;\012") < 0 ||
- fprintf (fprcs, "next ;\012\012") < 0 ||
+ 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)
+ 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)
+ goto write_error;
+ }
+ if (
/*
* putdesc()
*/
@@ -1015,9 +1070,23 @@ add_rcs_file (message, rcs, user, vtag, targc, targv)
/*
* putdelta()
*/
- fprintf (fprcs, "\012%s\012", vhead) < 0 ||
- fprintf (fprcs, "log\012") < 0 ||
- fprintf (fprcs, "@Initial revision\012@\012") < 0 ||
+ 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;
@@ -1041,15 +1110,18 @@ add_rcs_file (message, rcs, user, vtag, targc, targv)
goto write_error;
}
}
- if (fprintf (fprcs, "@\012\012") < 0 ||
- fprintf (fprcs, "\012%s.1\012", 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)
{
ierrno = errno;
@@ -1071,7 +1143,7 @@ add_rcs_file (message, rcs, user, vtag, targc, targv)
if (chmod (rcs, mode) < 0)
{
ierrno = errno;
- fperror (logfp, 0, ierrno,
+ fperror (add_logfp, 0, ierrno,
"WARNING: cannot change mode of file %s", rcs);
error (0, ierrno, "WARNING: cannot change mode of file %s", rcs);
err++;
@@ -1088,12 +1160,12 @@ write_error:
(void) fclose (fprcs);
write_error_noclose:
(void) fclose (fpuser);
- fperror (logfp, 0, ierrno, "ERROR: cannot write file %s", rcs);
+ fperror (add_logfp, 0, ierrno, "ERROR: cannot write file %s", rcs);
error (0, ierrno, "ERROR: cannot write file %s", rcs);
if (ierrno == ENOSPC)
{
(void) CVS_UNLINK (rcs);
- fperror (logfp, 0, 0, "ERROR: out of space - aborting");
+ fperror (add_logfp, 0, 0, "ERROR: out of space - aborting");
error (1, 0, "ERROR: out of space - aborting");
}
read_error:
diff --git a/contrib/cvs/src/lock.c b/contrib/cvs/src/lock.c
index f84eccf..babadef 100644
--- a/contrib/cvs/src/lock.c
+++ b/contrib/cvs/src/lock.c
@@ -485,7 +485,7 @@ again:
errno = 0;
while ((dp = readdir (dirp)) != NULL)
{
- if (fnmatch (CVSRFLPAT, dp->d_name, 0) == 0)
+ if (CVS_FNMATCH (CVSRFLPAT, dp->d_name, 0) == 0)
{
#ifdef CVS_FUDGELOCKS
time_t now;
diff --git a/contrib/cvs/src/main.c b/contrib/cvs/src/main.c
index fcb80a3..3352f60 100644
--- a/contrib/cvs/src/main.c
+++ b/contrib/cvs/src/main.c
@@ -338,13 +338,14 @@ main (argc, argv)
lets us support the `cvs -H cmd'
convention to give help for cmd. */
static struct option long_options[] =
- {
+ {
{"help", 0, NULL, 'H'},
{"version", 0, NULL, 'v'},
{"help-commands", 0, NULL, 1},
{"help-synonyms", 0, NULL, 2},
+ {"allow-root", required_argument, NULL, 3},
{0, 0, 0, 0}
- };
+ };
/* `getopt_long' stores the option index here, but right now we
don't use it. */
int option_index = 0;
@@ -435,9 +436,9 @@ main (argc, argv)
while ((c = getopt_long
(argc, argv, "+Qqrwtnlvb:T:e:d:Hfz:s:x", long_options, &option_index))
!= EOF)
- {
+ {
switch (c)
- {
+ {
case 1:
/* --help-commands */
usage (cmd_usage);
@@ -446,6 +447,10 @@ main (argc, argv)
/* --help-synonyms */
usage (cmd_synonyms());
break;
+ case 3:
+ /* --allow-root */
+ root_allow_add (optarg);
+ break;
case 'Q':
really_quiet = TRUE;
/* FALL THROUGH */
@@ -603,6 +608,12 @@ main (argc, argv)
#if defined(AUTH_SERVER_SUPPORT) && defined(SERVER_SUPPORT)
if (strcmp (command_name, "pserver") == 0)
{
+ /* The reason that --allow-root is not a command option
+ is mainly the comment in server() about how argc,argv
+ might be from .cvsrc. I'm not sure about that, and
+ I'm not sure it is only true of command options, but
+ it seems easier to make it a global option. */
+
/* Gets username and password from client, authenticates, then
switches to run as that user and sends an ACK back to the
client. */
@@ -878,6 +889,7 @@ main (argc, argv)
free (Tmpdir);
if (free_Rcsbin)
free (Rcsbin);
+ root_allow_free ();
#ifdef SYSTEM_CLEANUP
/* Hook for OS-specific behavior, for example socket subsystems on
diff --git a/contrib/cvs/src/mkmodules.c b/contrib/cvs/src/mkmodules.c
index cff993a..ec5d770 100644
--- a/contrib/cvs/src/mkmodules.c
+++ b/contrib/cvs/src/mkmodules.c
@@ -708,6 +708,8 @@ init (argc, argv)
char *info;
/* Name of ,v file for this administrative file. */
char *info_v;
+ /* Exit status. */
+ int err;
const struct admin_file *fileptr;
@@ -739,7 +741,10 @@ init (argc, argv)
strcat (adm, CVSROOTADM);
mkdir_if_needed (adm);
- /* This is needed by the call to "ci" below. */
+ /* This is needed because we pass "fileptr->filename" not "info"
+ to add_rcs_file below. I think this would be easy to change,
+ thus nuking the need for CVS_CHDIR here, but I haven't looked
+ closely (e.g. see wrappers calls within add_rcs_file). */
if ( CVS_CHDIR (adm) < 0)
error (1, errno, "cannot change to directory %s", adm);
@@ -776,16 +781,15 @@ init (argc, argv)
if (fclose (fp) < 0)
error (1, errno, "cannot close %s", info);
}
- /* Now check the file in. FIXME: we could be using
- add_rcs_file from import.c which is faster (if it were
- tweaked slightly). */
- run_setup ("%s%s -x,v/ -q -u -t-", Rcsbin, RCS_CI);
- run_args ("-minitial checkin of %s", fileptr->filename);
- run_arg (fileptr->filename);
- retcode = run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL);
+ /* The message used to say " of " and fileptr->filename after
+ "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);
if (retcode != 0)
- error (1, retcode == -1 ? errno : 0,
- "failed to check in %s", info);
+ /* add_rcs_file already printed an error message. */
+ err = 1;
}
}
diff --git a/contrib/cvs/src/patch.c b/contrib/cvs/src/patch.c
index 1cf8397..194999b 100644
--- a/contrib/cvs/src/patch.c
+++ b/contrib/cvs/src/patch.c
@@ -514,7 +514,9 @@ patch_fileproc (callerdat, finfo)
memset ((char *) &t, 0, sizeof (t));
if ((t.actime = t.modtime = RCS_getrevtime (rcsfile, vers_tag,
(char *) 0, 0)) != -1)
- (void) utime (tmpfile1, &t);
+ /* I believe this timestamp only affects the dates in our diffs,
+ and therefore should be on the server, not the client. */
+ (void) utime (tmpfile1, &t);
}
else if (toptwo_diffs)
{
@@ -536,7 +538,9 @@ patch_fileproc (callerdat, finfo)
}
if ((t.actime = t.modtime = RCS_getrevtime (rcsfile, vers_head,
(char *) 0, 0)) != -1)
- (void) utime (tmpfile2, &t);
+ /* I believe this timestamp only affects the dates in our diffs,
+ 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);
diff --git a/contrib/cvs/src/rcs.c b/contrib/cvs/src/rcs.c
index 8be6ea4..a49c449 100644
--- a/contrib/cvs/src/rcs.c
+++ b/contrib/cvs/src/rcs.c
@@ -1048,8 +1048,13 @@ getrcsrev (fp, revp)
do {
c = getc (fp);
if (c == EOF)
+ {
/* FIXME: should be including filename in error message. */
- error (1, errno, "cannot read rcs file");
+ if (ferror (fp))
+ error (1, errno, "cannot read rcs file");
+ else
+ error (1, 0, "unexpected end of file reading rcs file");
+ }
} while (whitespace (c));
if (!(isdigit (c) || c == '.'))
@@ -1073,7 +1078,10 @@ getrcsrev (fp, revp)
if (c == EOF)
{
/* FIXME: should be including filename in error message. */
- error (1, errno, "cannot read rcs file");
+ if (ferror (fp))
+ error (1, errno, "cannot read rcs file");
+ else
+ error (1, 0, "unexpected end of file reading rcs file");
}
}
diff --git a/contrib/cvs/src/rcs.h b/contrib/cvs/src/rcs.h
index 3de8c91..1855fb9 100644
--- a/contrib/cvs/src/rcs.h
+++ b/contrib/cvs/src/rcs.h
@@ -126,3 +126,7 @@ int RCS_lock PROTO ((RCSNode *, const char *, int));
int RCS_unlock PROTO ((RCSNode *, const char *, int));
int rcs_change_text PROTO ((const char *, char *, size_t, const char *,
size_t, char **, size_t *));
+
+/* From import.c. */
+extern int add_rcs_file PROTO ((char *, char *, char *, char *,
+ char *, char *, int, char **, FILE *));
diff --git a/contrib/cvs/src/rcscmds.c b/contrib/cvs/src/rcscmds.c
index 1f93fcf..1f356cf 100644
--- a/contrib/cvs/src/rcscmds.c
+++ b/contrib/cvs/src/rcscmds.c
@@ -199,7 +199,7 @@ RCS_checkin (rcsfile, workfile, message, rev, flags)
if (!existence_error (errno))
error (0, errno, "warning: cannot stat %s", rcsfile);
}
- run_setup ("%s%s -x,v/ -f %s%s", Rcsbin, RCS_CI,
+ 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");
diff --git a/contrib/cvs/src/root.c b/contrib/cvs/src/root.c
index 2691032..bf5c89e 100644
--- a/contrib/cvs/src/root.c
+++ b/contrib/cvs/src/root.c
@@ -199,6 +199,86 @@ Create_Root (dir, rootdir)
#endif /* ! DEBUG */
+/* The root_allow_* stuff maintains a list of legal CVSROOT
+ directories. Then we can check against them when a remote user
+ hands us a CVSROOT directory. */
+
+static unsigned int root_allow_count;
+static char **root_allow_vector;
+static unsigned int root_allow_size;
+
+void
+root_allow_add (arg)
+ char *arg;
+{
+ char *p;
+
+ if (root_allow_size <= root_allow_count)
+ {
+ if (root_allow_size == 0)
+ {
+ root_allow_size = 1;
+ root_allow_vector =
+ (char **) malloc (root_allow_size * sizeof (char *));
+ }
+ else
+ {
+ root_allow_size *= 2;
+ root_allow_vector =
+ (char **) realloc (root_allow_vector,
+ root_allow_size * sizeof (char *));
+ }
+
+ if (root_allow_vector == NULL)
+ {
+ no_memory:
+ /* Strictly speaking, we're not supposed to output anything
+ now. But we're about to exit(), give it a try. */
+ 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);
+ }
+ }
+ p = malloc (strlen (arg) + 1);
+ if (p == NULL)
+ goto no_memory;
+ strcpy (p, arg);
+ root_allow_vector[root_allow_count++] = p;
+}
+
+void
+root_allow_free ()
+{
+ if (root_allow_vector != NULL)
+ free (root_allow_vector);
+ root_allow_count = 0;
+ root_allow_size = 0;
+}
+
+int
+root_allow_ok (arg)
+ char *arg;
+{
+ unsigned int i;
+ for (i = 0; i < root_allow_count; ++i)
+ if (strcmp (root_allow_vector[i], arg) == 0)
+ return 1;
+ return 0;
+}
+
+
/* Parse a CVSROOT variable into its constituent parts -- method,
* username, hostname, directory. The prototypical CVSROOT variable
* looks like:
diff --git a/contrib/cvs/src/run.c b/contrib/cvs/src/run.c
index 74e418d..5b59bca 100644
--- a/contrib/cvs/src/run.c
+++ b/contrib/cvs/src/run.c
@@ -445,6 +445,13 @@ piped_child (command, tofdp, fromfdp)
if (pipe (from_child_pipe) < 0)
error (1, errno, "cannot create pipe");
+#ifdef USE_SETMODE_BINARY
+ setmode (to_child_pipe[0], O_BINARY);
+ setmode (to_child_pipe[1], O_BINARY);
+ setmode (from_child_pipe[0], O_BINARY);
+ setmode (from_child_pipe[1], O_BINARY);
+#endif
+
#ifdef HAVE_VFORK
pid = vfork ();
#else
@@ -506,6 +513,11 @@ filter_stream_through_program (oldfd, dir, prog, pidp)
if (pipe (p))
error (1, errno, "cannot create pipe");
+#ifdef USE_SETMODE_BINARY
+ setmode (p[0], O_BINARY);
+ setmode (p[1], O_BINARY);
+#endif
+
#ifdef HAVE_VFORK
newpid = vfork ();
#else
diff --git a/contrib/cvs/src/sanity.sh b/contrib/cvs/src/sanity.sh
index 38e32b4..a815fc0 100755
--- a/contrib/cvs/src/sanity.sh
+++ b/contrib/cvs/src/sanity.sh
@@ -481,9 +481,9 @@ 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 info"
- tests="${tests} serverpatch log log2 crerepos rcs big modes"
- tests="${tests} sticky keyword"
+ tests="${tests} devcom3 ignore binfiles binfiles2 binwrap mwrap info"
+ tests="${tests} serverpatch log log2 crerepos rcs big modes stamps"
+ tests="${tests} sticky keyword toplevel"
else
tests="$*"
fi
@@ -560,7 +560,7 @@ for what in $tests; do
dotest basica-0b "${testcvs} add first-dir" \
"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
cd ..
- rm -rf 1
+ rm -r 1
dotest basica-1 "${testcvs} -q co first-dir" ''
cd first-dir
@@ -716,21 +716,21 @@ diff -r1\.2 -r1\.3"
"${PROG} [a-z]*: scheduling file .topfile. for addition
${PROG} [a-z]*: use .cvs 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 -rf 1
+ rm -r 1
mkdir 2; cd 2
dotest basicb-0d "${testcvs} -q co -l ." "U topfile"
mkdir first-dir
dotest basicb-0e "${testcvs} add first-dir" \
"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
cd ..
- rm -rf 2
+ rm -r 2
: mkdir ${CVSROOT_DIRNAME}/first-dir
dotest basicb-1 "${testcvs} -q co first-dir" ''
@@ -819,9 +819,9 @@ done"
dotest basicb-cod-1 "${testcvs} -q co -d first-dir1 first-dir" \
'U first-dir1/sdir1/sfile1
U first-dir1/sdir2/sfile2'
- rm -rf first-dir1
+ rm -r first-dir1
- rm -rf first-dir
+ rm -r first-dir
dotest basicb-9 \
"${testcvs} -q co -d newdir -r release-1 first-dir/sdir1 first-dir/sdir2" \
'U newdir/sdir1/sfile1
@@ -836,7 +836,7 @@ U newdir/sdir2/sfile2'
"sfile1 develops
sfile2 starts"
- rm -rf newdir
+ rm -r newdir
# Hmm, this might be a case for CVSNULLREPOS, but CVS doesn't
# seem to deal with it...
@@ -873,7 +873,7 @@ ${TESTDIR}/cvsroot/second-dir/aa,v <-- aa
initial revision: 1\.1
done"
cd ../..
- rm -rf 1
+ 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,
@@ -914,10 +914,16 @@ done"
cd ..
rmdir 1
- rm -rf test2
+ 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
;;
@@ -1292,7 +1298,7 @@ done"
exit 0
fi
- rm -rf 1
+ rm -r 1
rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
@@ -1384,7 +1390,7 @@ done"
# CVS *will* recreate it, and we might want to make it so
# that "cvs release -d" is the way to delete the directory
# and have it stay gone -kingdon, Oct1996).
- rm -rf dir6
+ rm -r dir6
dotest deep-4b1 "${testcvs} -q update" ''
dotest deep-4b2 "${testcvs} -q update -d -P" \
'U dir6/file1
@@ -1624,7 +1630,6 @@ done"
fi
# now export by rtagged-by-head and rtagged-by-tag and compare.
- rm -rf first-dir
if ${CVS} export -r rtagged-by-head first-dir ; then
echo "PASS: test 50" >>${LOGFILE}
else
@@ -1645,7 +1650,7 @@ done"
else
echo "PASS: test 52" >>${LOGFILE}
fi
- rm -rf 1dir first-dir
+ 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
@@ -1704,9 +1709,9 @@ No conflicts created by this import"
echo "PASS: test 58" >>${LOGFILE}
fi
- rm -rf second-dir
+ rm -r second-dir
- rm -rf export-dir first-dir
+ rm -r export-dir first-dir
mkdir first-dir
(cd first-dir.cpy ; tar cf - . | (cd ../first-dir ; tar xf -))
@@ -1755,7 +1760,7 @@ No conflicts created by this import"
# else
# echo "PASS: test 63" >>${LOGFILE}
# fi
- rm -rf 1dir first-dir
+ rm -r 1dir first-dir
# Test the cvs history command.
@@ -1879,7 +1884,7 @@ File: foo Status: Up-to-date
TRDIFF (branch: 1\.1\.1)"
cd ..
- rm -rf trdiff
+ rm -r trdiff
dotest rdiff-8 \
"${testcvs} rdiff -r T1 -r local-v0 trdiff" \
@@ -1913,7 +1918,7 @@ diff -c /dev/null trdiff/new:1\.1
# fi
cd ..
- rm -rf testimport
+ rm -r testimport
rm -rf ${CVSROOT_DIRNAME}/trdiff
;;
@@ -2225,7 +2230,7 @@ done"
dotest 89a "${testcvs} -q co first-dir" 'U first-dir/file1
U first-dir/file3'
cd ..
- rm -rf 2
+ rm -r 2
cd first-dir
# remove first file.
@@ -3073,8 +3078,10 @@ import should not expand \$''Id: imported-f2,v 1\.1\.1\.2 [0-9/]* [0-9:]* [a-z0-
rev 2 of file 2
[>]>>>>>> 1\.1\.1\.2'
- cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
- rm -rf import-dir
+ cd ..
+ rm -r first-dir
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ rm -r import-dir
;;
join)
@@ -3360,7 +3367,7 @@ M file4'
# revision which can be used as the source for files added
# on branches.
cd ../../3
- rm -rf first-dir
+ rm -r first-dir
dotest join-20 "${testcvs} -q co -jbranch first-dir" \
"U first-dir/file1
U first-dir/file2
@@ -3384,7 +3391,7 @@ R file3'
# Checkout the main line again.
cd ../../1
- rm -rf first-dir
+ rm -r first-dir
dotest join-22 "${testcvs} -q co first-dir" \
'U first-dir/file2
U first-dir/file3
@@ -3415,7 +3422,8 @@ R file3
M file4'
cd ../..
- rm -rf 1 2 3 ${CVSROOT_DIRNAME}/first-dir
+ rm -r 1 2 3
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
new) # look for stray "no longer pertinent" messages.
@@ -3468,7 +3476,9 @@ M file4'
echo "PASS: test 123" >>${LOGFILE}
fi
- cd .. ; rm -rf first-dir ; rm -rf ${CVSROOT_DIRNAME}/first-dir
+ cd ..
+ rm -r first-dir
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
newb)
@@ -3499,7 +3509,7 @@ done"
# Check out the branch.
cd ..
- rm -rf first-dir
+ rm -r first-dir
mkdir 1
cd 1
dotest newb-123e "${testcvs} -q co -r branch first-dir" \
@@ -3526,7 +3536,7 @@ done"
# that the file is not pertinent, but it should not
# say anything else.
cd ..
- rm -rf first-dir
+ rm -r first-dir
dotest newb-123i "${testcvs} -q co -r branch first-dir/a" \
"${PROG} [a-z]*: warning: first-dir/a is not (any longer) pertinent"
@@ -3555,7 +3565,8 @@ File: a Status: Needs \(Patch\|Checkout\)
fi
cd ../..
- rm -rf 1 2 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
+ rm -r 1 2
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
conflicts)
@@ -3795,7 +3806,7 @@ File: a Status: Up-to-date
echo 'FAIL: test 142' | tee -a ${LOGFILE}
fi
cd ../..
- rm -rf 1 2 3 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
+ rm -r 1 2 3 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
conflicts2)
@@ -3915,7 +3926,7 @@ C aa\.c"
fi
cd ../..
- rm -rf 1 2 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
+ rm -r 1 2 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
modules)
@@ -4089,7 +4100,7 @@ realmodule NONE first-dir/subdir a'
else
echo 'PASS: test 150g2' >>${LOGFILE}
fi
- rm -rf dirmodule
+ rm -r dirmodule
# Now test that a module using -d checks out to the specified
# directory.
@@ -4141,7 +4152,7 @@ U nameddir/b'
fi
cd ..
- rm -rf 1
+ rm -r 1
mkdir 2
cd 2
@@ -4155,7 +4166,7 @@ U nameddir/b'
"CVS
first-dir"
cd ..
- rm -rf 2
+ rm -r 2
# Test checking out everything.
mkdir 1
@@ -4165,7 +4176,7 @@ first-dir"
U first-dir/subdir/a
U first-dir/subdir/b"
cd ..
- rm -rf 1
+ rm -r 1
# Test checking out a module which lists at least two
# specific files twice. At one time, this failed over
@@ -4198,13 +4209,13 @@ initial revision: 1\.1
done"
cd ..
- rm -rf first-dir
+ rm -r first-dir
dotest modules-155c4 "${testcvs} -q co topfiles" \
"U first-dir/file1
U first-dir/file2"
dotest modules-155c5 "${testcvs} -q co topfiles" ""
cd ..
- rm -rf 1
+ rm -r 1
rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
@@ -4269,9 +4280,9 @@ ${PROG} [a-z]*: Rebuilding administrative file database"
${PROG} \[[a-z]* aborted\]: cannot expand modules"
# Clean up.
- rm -rf CVSROOT
+ rm -r CVSROOT
cd ..
- rm -rf 1
+ rm -r 1
rm -rf ${CVSROOT_DIRNAME}/first-dir
rm -rf ${CVSROOT_DIRNAME}/second-dir
;;
@@ -4322,7 +4333,7 @@ ${PROG} [a-z]*: Rebuilding administrative file database"
cd ..
dotest modules3-6 "${testcvs} -q co bigmod" ''
- rm -rf first-dir
+ rm -r first-dir
dotest modules3-7 "${testcvs} -q co bigmod" 'U first-dir/file1'
cd ..
rm -r 1
@@ -4481,7 +4492,7 @@ done"
exit 1
fi
# Test handling of -m during ci
- cd ..; rm -rf a-dir;
+ cd ..; rm -r a-dir
if ${testcvs} co a-dir >>${LOGFILE} 2>&1; then
echo 'PASS: test 158' >>${LOGFILE}
else
@@ -4511,7 +4522,9 @@ done"
exit 1
fi
# Clean up
- cd ..; rm -rf a-dir ${CVSROOT_DIRNAME}/a-dir
+ cd ..
+ rm -r a-dir
+ rm -rf ${CVSROOT_DIRNAME}/a-dir
done
;;
errmsg1)
@@ -4583,7 +4596,8 @@ EOF
cd ..
chmod u+w 1dir
cd ..
- rm -rf 1 2 ${CVSROOT_DIRNAME}/1dir
+ rm -r 1 2
+ rm -rf ${CVSROOT_DIRNAME}/1dir
;;
devcom)
@@ -4781,6 +4795,7 @@ T abc'
dotest devcom-t1 "${testcvs} -q co -rtag first-dir/abb" \
'U first-dir/abb'
cd ..
+ # Since first-dir/abb is readonly, use -f.
rm -rf 3
# Now remove all the file attributes
@@ -4806,7 +4821,9 @@ U first-dir/abc'
exit 0
fi
- rm -rf 1 2 3 ${CVSROOT_DIRNAME}/first-dir
+ # Use -f because of the readonly files.
+ rm -rf 1 2 3
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
devcom2)
@@ -4857,7 +4874,9 @@ U first-dir/w3'
dotest_fail devcom2-11 "test -w first-dir/w3" ''
cd ..
- rm -rf 1 2 ${CVSROOT_DIRNAME}/first-dir
+ # Use -f because of the readonly files.
+ rm -rf 1 2
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
devcom3)
@@ -4912,7 +4931,9 @@ G@#..!@#=&"
cd ../..
- rm -rf 1 ${CVSROOT_DIRNAME}/first-dir
+ # Use -f because of the readonly files.
+ rm -rf 1
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
ignore)
@@ -4976,7 +4997,7 @@ N second-dir/optig.c
No conflicts created by this import'
cd ..
- rm -rf dir-to-import
+ rm -r dir-to-import
mkdir 1
cd 1
@@ -5069,7 +5090,7 @@ Are you sure you want to release (and delete) directory .first-dir': "
You have \[1\] altered files in this repository.
Are you sure you want to release (and delete) directory .second-dir': "
cd ..
- rm -rf 1
+ rm -r 1
rm ${TESTDIR}/ignore.tmp
rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir
;;
@@ -5130,7 +5151,7 @@ File: binfile Status: Up-to-date
Sticky Date: (none)
Sticky Options: -kb"
cd ../..
- rm -rf 3
+ rm -r 3
cd 2/first-dir
cp ../../1/binfile2.dat binfile
@@ -5180,7 +5201,7 @@ done"
fi
cd ../..
- rm -rf 1
+ rm -r 1
mkdir 3
cd 3
@@ -5197,7 +5218,7 @@ File: binfile Status: Up-to-date
Sticky Date: (none)
Sticky Options: -kb"
cd ../..
- rm -rf 3
+ rm -r 3
cd 2/first-dir
echo 'this file is $''RCSfile$' >binfile
@@ -5348,7 +5369,7 @@ done"
fail binwrap-1
fi
cd ..
- rm -rf dir-to-import
+ rm -r dir-to-import
dotest binwrap-2 "${testcvs} -q co first-dir" 'U first-dir/foo.c
U first-dir/foo.exe'
dotest binwrap-3 "${testcvs} -q status first-dir" \
@@ -5369,7 +5390,75 @@ File: foo\.exe Status: Up-to-date
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: -kb"
- rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
+ rm -r first-dir
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
+ mwrap)
+ # Tests relating to the -m wrappers options. -k tests are in
+ # binwrap and -t/-f tests haven't been written yet.
+ dotest mwrap-c1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
+ cd CVSROOT
+ echo "* -m 'COPY'" >>cvswrappers
+ dotest mwrap-c2 "${testcvs} -q ci -m wrapper-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 ..
+ mkdir m1; cd m1
+ dotest mwrap-1 "${testcvs} -q co -l ." ''
+ mkdir first-dir
+ dotest mwrap-2 "${testcvs} add first-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
+ cd first-dir
+ 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"
+ dotest mwrap-4 "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/aa,v
+done
+Checking in aa;
+${TESTDIR}/cvsroot/first-dir/aa,v <-- aa
+initial revision: 1\.1
+done"
+ cd ../..
+ mkdir m2; cd m2
+ dotest mwrap-5 "${testcvs} -q co first-dir" "U first-dir/aa"
+ cd first-dir
+ echo "changed in m2" >aa
+ dotest mwrap-6 "${testcvs} -q ci -m m2-mod" \
+"Checking in aa;
+${TESTDIR}/cvsroot/first-dir/aa,v <-- aa
+new revision: 1\.2; previous revision: 1\.1
+done"
+ cd ../..
+ 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"
+ cd ../..
+ cd CVSROOT
+ echo '# comment out' >cvswrappers
+ dotest mwrap-ce "${testcvs} -q ci -m wrapper-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 ..
+ rm -r CVSROOT
+ rm -r m1 m2
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
info)
@@ -5571,7 +5660,8 @@ done"
U file1'
cd ../..
- rm -rf 1 2 ${CVSROOT_DIRNAME}/first-dir
+ rm -r 1 2
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
log)
@@ -5797,7 +5887,8 @@ ${log_rev1}
${log_trailer}"
cd ..
- rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
+ rm -r first-dir
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
log2)
@@ -5840,7 +5931,8 @@ date: [0-9/]* [0-9:]*; author: ${username}; state: Exp;
============================================================================="
cd ..
- rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
+ rm -r first-dir
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
fi # end of tests skipped for remote
@@ -5886,7 +5978,7 @@ ${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then
else
fail crerepos-5
fi
- rm -rf CVS
+ rm -r CVS
cd ..
# The directory tmp should be empty
dotest crerepos-6 "rmdir tmp" ''
@@ -5905,13 +5997,13 @@ ${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then
dotest_fail crerepos-6a "${testcvs} -q -d ../crerepos get ." \
"${PROG} \[[a-z]* aborted\]: CVSROOT ../crerepos must be an absolute pathname"
cd ..
- rm -rf 1
+ rm -r 1
mkdir 1; cd 1
dotest_fail crerepos-6b "${testcvs} -d crerepos init" \
"${PROG} \[[a-z]* aborted\]: CVSROOT crerepos must be an absolute pathname"
cd ..
- rm -rf 1
+ rm -r 1
else # remote
# Test that CVS rejects a relative path in CVSROOT.
mkdir 1; cd 1
@@ -5919,14 +6011,14 @@ ${testcvs} -d ${TESTDIR}/crerepos release -d CVSROOT >>${LOGFILE}; then
"${testcvs} -q -d :ext:`hostname`:../crerepos get ." \
"Root ../crerepos must be an absolute pathname"
cd ..
- rm -rf 1
+ rm -r 1
mkdir 1; cd 1
dotest_fail crerepos-6b \
"${testcvs} -d :ext:`hostname`:crerepos init" \
"Root crerepos must be an absolute pathname"
cd ..
- rm -rf 1
+ rm -r 1
fi # end of tests to be skipped for remote
# CVS better not create a history file--if the administrator
@@ -6108,8 +6200,10 @@ add file1
else
fail rcs-4
fi
+ cd ..
- rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir ${TESTDIR}/rcs4.tmp
+ rm -r first-dir ${TESTDIR}/rcs4.tmp
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
big)
@@ -6146,7 +6240,7 @@ ${TESTDIR}/cvsroot/first-dir/file1,v <-- file1
initial revision: 1\.1
done"
cd ..
- rm -rf first-dir
+ rm -r first-dir
dotest big-4 "${testcvs} -q get first-dir" "U first-dir/file1"
if test "$keep" = yes; then
@@ -6154,7 +6248,7 @@ done"
exit 0
fi
- rm -rf first-dir
+ rm -r first-dir
rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
@@ -6276,11 +6370,152 @@ done"
fi
cd ../..
- rm -rf 1 ${CVSROOT_DIRNAME}/first-dir
+ rm -r 1
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
# Perhaps should restore the umask and CVSUMASK. But the other
# tests "should" not care about them...
;;
+ stamps)
+ # Test timestamps.
+ mkdir 1; cd 1
+ dotest stamps-1 "${testcvs} -q co -l ." ''
+ mkdir first-dir
+ dotest stamps-2 "${testcvs} add first-dir" \
+"Directory ${TESTDIR}/cvsroot/first-dir added to the repository"
+ cd first-dir
+ touch aa
+ echo '$''Id$' >kw
+ ls -l aa >${TESTDIR}/1/stamp.aa.touch
+ ls -l kw >${TESTDIR}/1/stamp.kw.touch
+ # "sleep 1" would suffice if we could assume ls --full-time, but
+ # that is as far as I know unique to GNU ls. Is there some POSIX.2
+ # way to get the timestamp of a file, including the seconds?
+ sleep 60
+ 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"
+ ls -l aa >${TESTDIR}/1/stamp.aa.add
+ ls -l kw >${TESTDIR}/1/stamp.kw.add
+ # "cvs add" should not muck with the timestamp.
+ dotest stamps-4aa \
+"cmp ${TESTDIR}/1/stamp.aa.touch ${TESTDIR}/1/stamp.aa.add" ''
+ dotest stamps-4kw \
+"cmp ${TESTDIR}/1/stamp.kw.touch ${TESTDIR}/1/stamp.kw.add" ''
+ sleep 60
+ dotest stamps-5 "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/first-dir/aa,v
+done
+Checking in aa;
+${TESTDIR}/cvsroot/first-dir/aa,v <-- aa
+initial revision: 1\.1
+done
+RCS file: ${TESTDIR}/cvsroot/first-dir/kw,v
+done
+Checking in kw;
+${TESTDIR}/cvsroot/first-dir/kw,v <-- kw
+initial revision: 1\.1
+done"
+ ls -l aa >${TESTDIR}/1/stamp.aa.ci
+ ls -l kw >${TESTDIR}/1/stamp.kw.ci
+ # If there are no keywords, "cvs ci" leaves the timestamp alone
+ # If there are, it sets the timestamp to the date of the commit.
+ # I'm not sure how logical this is, but it is intentional.
+ # If we wanted to get fancy we would make sure the time as
+ # reported in "cvs log kw" matched stamp.kw.ci. But that would
+ # be a lot of work.
+ dotest stamps-6aa \
+ "cmp ${TESTDIR}/1/stamp.aa.add ${TESTDIR}/1/stamp.aa.ci" ''
+ if cmp ${TESTDIR}/1/stamp.kw.add ${TESTDIR}/1/stamp.kw.ci >/dev/null
+ then
+ fail stamps-6kw
+ else
+ pass stamps-6kw
+ fi
+ cd ../..
+ sleep 60
+ mkdir 2
+ cd 2
+ dotest stamps-7 "${testcvs} -q get first-dir" "U first-dir/aa
+U first-dir/kw"
+ cd first-dir
+ ls -l aa >${TESTDIR}/1/stamp.aa.get
+ ls -l kw >${TESTDIR}/1/stamp.kw.get
+ # On checkout, CVS should set the timestamp to the date that the
+ # file was committed. Could check that the time as reported in
+ # "cvs log aa" matches stamp.aa.get, but that would be a lot of
+ # work.
+ if cmp ${TESTDIR}/1/stamp.aa.ci ${TESTDIR}/1/stamp.aa.get >/dev/null
+ then
+ fail stamps-8aa
+ else
+ pass stamps-8aa
+ fi
+ dotest stamps-8kw \
+ "cmp ${TESTDIR}/1/stamp.kw.ci ${TESTDIR}/1/stamp.kw.get" ''
+
+ # Now we want to see what "cvs update" does.
+ sleep 60
+ echo add a line >>aa
+ echo add a line >>kw
+ dotest stamps-9 "${testcvs} -q ci -m change-them" \
+"Checking in aa;
+${TESTDIR}/cvsroot/first-dir/aa,v <-- aa
+new revision: 1\.2; previous revision: 1\.1
+done
+Checking in kw;
+${TESTDIR}/cvsroot/first-dir/kw,v <-- kw
+new revision: 1\.2; previous revision: 1\.1
+done"
+ ls -l aa >${TESTDIR}/1/stamp.aa.ci2
+ ls -l kw >${TESTDIR}/1/stamp.kw.ci2
+ cd ../..
+ cd 1/first-dir
+ sleep 60
+ dotest stamps-10 "${testcvs} -q update" '[UP] aa
+[UP] kw'
+ # this doesn't serve any function other than being able to
+ # look at it manually, as we have no machinery for dates being
+ # newer or older than other dates.
+ date >${TESTDIR}/1/stamp.debug.update
+ ls -l aa >${TESTDIR}/1/stamp.aa.update
+ ls -l kw >${TESTDIR}/1/stamp.kw.update
+ # stamp.aa.update and stamp.kw.update should both be approximately
+ # the same as stamp.debug.update. Perhaps we could be testing
+ # this in a more fancy fashion by "touch stamp.before" before
+ # stamps-10, "touch stamp.after" after, and then using ls -t
+ # to check them. But for now we just make sure that the *.update
+ # stamps differ from the *.ci2 ones.
+ # As for the rationale, this is so that if one updates and gets
+ # a new revision, then "make" will be sure to regard those files
+ # as newer than .o files which may be sitting around.
+ if cmp ${TESTDIR}/1/stamp.aa.update ${TESTDIR}/1/stamp.aa.ci2 \
+ >/dev/null
+ then
+ fail stamps-11aa
+ else
+ pass stamps-11aa
+ fi
+ if cmp ${TESTDIR}/1/stamp.kw.update ${TESTDIR}/1/stamp.kw.ci2 \
+ >/dev/null
+ then
+ fail stamps-11kw
+ else
+ pass stamps-11kw
+ fi
+
+ cd ../..
+
+ if test "$keep" = yes; then
+ echo Keeping ${TESTDIR} and exiting due to --keep
+ exit 0
+ fi
+
+ rm -r 1 2
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
sticky)
# More tests of sticky tags, particularly non-branch sticky tags.
mkdir 1; cd 1
@@ -6323,7 +6558,8 @@ ${QUESTION} file2" "${QUESTION} file2
${PROG} [a-z]*: use .cvs commit. to add this file permanently"
cd ../..
- rm -rf 1 ${CVSROOT_DIRNAME}/first-dir
+ rm -r 1
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
;;
keyword)
@@ -6494,7 +6730,7 @@ xx "'\$'"Log"'\$'
# This workaround should be removed when the bug is fixed.
if test "x$remote" = "xyes"; then
cd ..
- rm -rf first-dir
+ rm -r first-dir
dotest keyword-17 "${testcvs} -q co first-dir" "U first-dir/file1"
cd first-dir
else
@@ -6560,7 +6796,79 @@ xx
change"
cd ../..
- rm -rf 1 ${CVSROOT_DIRNAME}/first-dir
+ rm -r 1
+ rm -rf ${CVSROOT_DIRNAME}/first-dir
+ ;;
+
+ toplevel)
+ # test the feature that cvs creates a CVS subdir also for
+ # the toplevel directory
+
+ # Some test, somewhere, is creating Emptydir. That test
+ # should, perhaps, clean up for itself, but I don't know which
+ # one it is.
+ rm -rf ${CVSROOT_DIRNAME}/CVSROOT/Emptydir
+
+ 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"
+ 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"
+ dotest toplevel-4 "${testcvs} -q ci -m add" \
+"RCS file: ${TESTDIR}/cvsroot/top-dir/file1,v
+done
+Checking in file1;
+${TESTDIR}/cvsroot/top-dir/file1,v <-- file1
+initial revision: 1\.1
+done"
+
+ cd ../..
+ rm -r 1; mkdir 1; cd 1
+ dotest toplevel-5 "${testcvs} co top-dir" \
+"${PROG} [a-z]*: Updating top-dir
+U top-dir/file1"
+
+ dotest toplevel-6 "${testcvs} update top-dir" \
+"${PROG} [a-z]*: Updating top-dir"
+ dotest toplevel-7 "${testcvs} update" \
+"${PROG} [a-z]*: Updating \.
+${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
+ # "${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.
+ #
+ # The DOTSTAR matches of a bunch of lines like
+ # "U CVSROOT/checkoutlist". Trying to match them more precisely
+ # seemed to cause trouble. For example CVSROOT/cvsignore will
+ # be present or absent depending on whether we ran the "ignore"
+ # test or not.
+ dotest toplevel-9 "${testcvs} update -d" \
+"${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
;;
*)
diff --git a/contrib/cvs/src/server.c b/contrib/cvs/src/server.c
index 65b1dd3..dece2ca 100644
--- a/contrib/cvs/src/server.c
+++ b/contrib/cvs/src/server.c
@@ -89,7 +89,7 @@ static Key_schedule sched;
the same as the system username the server eventually switches to
run as. CVS_Username gets set iff password authentication is
successful. */
-static char *CVS_Username = NULL;
+char *CVS_Username = NULL;
/* Used to check that same repos is transmitted in pserver auth and in
later CVS protocol. Exported because root.c also uses. */
@@ -3073,6 +3073,42 @@ server_copy_file (file, update_dir, repository, newfile)
/* See server.h for description. */
void
+server_modtime (finfo, vers_ts)
+ struct file_info *finfo;
+ Vers_TS *vers_ts;
+{
+ char date[MAXDATELEN];
+ int year, month, day, hour, minute, second;
+ /* Note that these strings are specified in RFC822 and do not vary
+ according to locale. */
+ static const char *const month_names[] =
+ {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+
+ if (!supported_response ("Mod-time"))
+ return;
+
+ /* The only hard part about this routine is converting the date
+ formats. In terms of functionality it all boils down to the
+ call to RCS_getrevtime. */
+ if (RCS_getrevtime (finfo->rcs, vers_ts->vn_rcs, date, 0) == (time_t) -1)
+ /* FIXME? should we be printing some kind of warning? For one
+ thing I'm not 100% sure whether this happens in non-error
+ circumstances. */
+ return;
+
+ sscanf (date, SDATEFORM, &year, &month, &day, &hour, &minute, &second);
+ sprintf (date, "%d %s %d %d:%d:%d -0000", day,
+ month < 1 || month > 12 ? "???" : month_names[month - 1],
+ year, hour, minute, second);
+ buf_output0 (protocol, "Mod-time ");
+ buf_output0 (protocol, date);
+ buf_output0 (protocol, "\n");
+}
+
+/* See server.h for description. */
+
+void
server_updated (finfo, vers, updated, file_info, checksum)
struct file_info *finfo;
Vers_TS *vers;
@@ -4619,6 +4655,14 @@ 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. */
+ goto i_hate_you;
/* We need the real cleartext before we hash it. */
descrambled_password = descramble (password);
@@ -4632,6 +4676,7 @@ pserver_authenticate_connection ()
}
else
{
+ i_hate_you:
printf ("I HATE YOU\n");
fflush (stdout);
/* I'm doing this manually rather than via error_exit ()
diff --git a/contrib/cvs/src/server.h b/contrib/cvs/src/server.h
index cbda7a5..743f090 100644
--- a/contrib/cvs/src/server.h
+++ b/contrib/cvs/src/server.h
@@ -29,6 +29,11 @@ extern void server_register
PROTO((char *name, char *version, char *timestamp,
char *options, char *tag, char *date, char *conflict));
+/* Set the modification time of the next file sent. This must be
+ followed by a call to server_updated on the same file. */
+extern void server_modtime PROTO ((struct file_info *finfo,
+ Vers_TS *vers_ts));
+
/*
* We want to nuke the Entries line for a file, and (unless
* server_scratch_entry_only is subsequently called) the file itself.
@@ -106,6 +111,10 @@ extern void server_cleanup PROTO((int sig));
extern void server_pause_check PROTO((void));
#endif /* SERVER_FLOWCONTROL */
+#ifdef AUTH_SERVER_SUPPORT
+extern char *CVS_Username;
+#endif /* AUTH_SERVER_SUPPORT */
+
#endif /* SERVER_SUPPORT */
/* Stuff shared with the client. */
diff --git a/contrib/cvs/src/subr.c b/contrib/cvs/src/subr.c
index a098123..d29942b 100644
--- a/contrib/cvs/src/subr.c
+++ b/contrib/cvs/src/subr.c
@@ -234,11 +234,13 @@ numdots (s)
return (dots);
}
-/*
- * 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.
- */
+/* 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.
+
+ Returns a pointer to storage that we manage; it is good until the
+ next call to getcaller () (provided that the caller doesn't call
+ getlogin () or some such themself). */
char *
getcaller ()
{
@@ -247,6 +249,16 @@ getcaller ()
char *name;
uid_t uid;
+ /* If there is a CVS username, return it. */
+#ifdef AUTH_SERVER_SUPPORT
+ if (CVS_Username != NULL)
+ return CVS_Username;
+#endif
+
+ /* 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. */
+
uid = getuid ();
if (uid == (uid_t) 0)
{
diff --git a/contrib/cvs/src/update.c b/contrib/cvs/src/update.c
index 1956c6f..8196c1f 100644
--- a/contrib/cvs/src/update.c
+++ b/contrib/cvs/src/update.c
@@ -559,10 +559,31 @@ update_fileproc (callerdat, finfo)
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);
}
diff --git a/contrib/cvs/src/vers_ts.c b/contrib/cvs/src/vers_ts.c
index 03a0036..613e52e 100644
--- a/contrib/cvs/src/vers_ts.c
+++ b/contrib/cvs/src/vers_ts.c
@@ -177,13 +177,26 @@ Version_TS (finfo, options, tag, date, force_tag_match, set_time)
*/
if (set_time)
{
- struct utimbuf t;
+#ifdef SERVER_SUPPORT
+ if (server_active)
+ server_modtime (finfo, vers_ts);
+ else
+#endif
+ {
+ struct utimbuf t;
- memset ((char *) &t, 0, sizeof (t));
- if (vers_ts->vn_rcs &&
- (t.actime = t.modtime = RCS_getrevtime (rcsdata,
- vers_ts->vn_rcs, (char *) 0, 0)) != -1)
- (void) utime (finfo->file, &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.actime = t.modtime;
+ (void) utime (finfo->file, &t);
+ }
+ }
+ }
}
}
diff --git a/contrib/cvs/src/version.c b/contrib/cvs/src/version.c
index 606c43d..c442179 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.9";
+char *version_string = "\nConcurrent Versions System (CVS) 1.9.10";
#ifdef CLIENT_SUPPORT
#ifdef SERVER_SUPPORT
diff --git a/contrib/cvs/src/wrapper.c b/contrib/cvs/src/wrapper.c
index 13e7e43..825cdcd 100644
--- a/contrib/cvs/src/wrapper.c
+++ b/contrib/cvs/src/wrapper.c
@@ -387,7 +387,7 @@ wrap_name_has (name,has)
char *temp;
for(x=0;x<count;++x)
- if (fnmatch (wrap_list[x]->wildCard, name, 0) == 0){
+ if (CVS_FNMATCH (wrap_list[x]->wildCard, name, 0) == 0){
switch(has){
case WRAP_TOCVS:
temp=wrap_list[x]->tocvsFilter;
@@ -418,7 +418,7 @@ wrap_matching_entry (name)
int x,count=wrap_count+wrap_saved_count;
for(x=0;x<count;++x)
- if (fnmatch (wrap_list[x]->wildCard, name, 0) == 0)
+ if (CVS_FNMATCH (wrap_list[x]->wildCard, name, 0) == 0)
return wrap_list[x];
return (WrapperEntry *)NULL;
}
OpenPOWER on IntegriCloud