summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2008-01-10 09:54:05 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2008-01-10 09:54:05 +0000
commitd3f2cec67dd31e7e95a09626a862253a6968b66c (patch)
treee11fbd39346db5ad5b3c0867dfe8696e76cb63a4 /usr.bin
parentbe5ceccfa10c09496a4cf5cdcfb29ca97f40cb94 (diff)
Our keyword expansion had a big flaw, due to this construction:
if (!(mode & RCS_KWEXP_NONE)) RCS_KWEXP_NONE is defined to 0, so expansion happened always. Left shifted all RCS_KWEXP defines and looked carefully at hard-coded values throughout the code.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/checkout.c6
-rw-r--r--usr.bin/cvs/commit.c4
-rw-r--r--usr.bin/cvs/import.c7
-rw-r--r--usr.bin/cvs/rcs.h14
4 files changed, 16 insertions, 15 deletions
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index 2e814037689..6fbd875f0a4 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checkout.c,v 1.105 2007/09/23 11:19:24 joris Exp $ */
+/* $OpenBSD: checkout.c,v 1.106 2008/01/10 09:54:04 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -271,7 +271,7 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, char *tag, int co_flags)
(cvs_server_active) ? "to client" : "to disk");
if (co_flags & CO_DUMP) {
- rcs_rev_write_fd(cf->file_rcs, rnum, STDOUT_FILENO, 1);
+ rcs_rev_write_fd(cf->file_rcs, rnum, STDOUT_FILENO, 0);
return;
}
@@ -290,7 +290,7 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, char *tag, int co_flags)
fatal("cvs_checkout_file: open: %s",
strerror(errno));
- rcs_rev_write_fd(cf->file_rcs, rnum, cf->fd, 1);
+ rcs_rev_write_fd(cf->file_rcs, rnum, cf->fd, 0);
} else {
cvs_merge_file(cf, 1);
}
diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c
index b388e5bdbb9..d4e149deabc 100644
--- a/usr.bin/cvs/commit.c
+++ b/usr.bin/cvs/commit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commit.c,v 1.116 2008/01/10 09:37:26 tobias Exp $ */
+/* $OpenBSD: commit.c,v 1.117 2008/01/10 09:54:04 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -521,7 +521,7 @@ commit_diff(struct cvs_file *cf, RCSNUM *rev, int reverse)
}
(void)xasprintf(&p2, "%s/diff2.XXXXXXXXXX", cvs_tmpdir);
- rcs_rev_write_stmp(cf->file_rcs, rev, p2, 0);
+ rcs_rev_write_stmp(cf->file_rcs, rev, p2, RCS_KWEXP_NONE);
if ((b2 = cvs_buf_alloc(128, BUF_AUTOEXT)) == NULL)
fatal("commit_diff: failed to create diff buf");
diff --git a/usr.bin/cvs/import.c b/usr.bin/cvs/import.c
index 59a636906be..9591616a476 100644
--- a/usr.bin/cvs/import.c
+++ b/usr.bin/cvs/import.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: import.c,v 1.78 2008/01/10 09:37:26 tobias Exp $ */
+/* $OpenBSD: import.c,v 1.79 2008/01/10 09:54:04 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -300,7 +300,8 @@ import_update(struct cvs_file *cf)
fatal("import_update: rcsnum_parse failed");
if (rev != NULL) {
- if ((b1 = rcs_rev_getbuf(cf->file_rcs, rev, 0)) == NULL)
+ if ((b1 = rcs_rev_getbuf(cf->file_rcs, rev, RCS_KWEXP_NONE))
+ == NULL)
fatal("import_update: failed to grab revision");
if ((b2 = cvs_buf_load_fd(cf->fd, BUF_AUTOEXT)) == NULL)
@@ -389,7 +390,7 @@ import_get_rcsdiff(struct cvs_file *cf, RCSNUM *rev)
cvs_buf_free(b1);
(void)xasprintf(&p2, "%s/diff2.XXXXXXXXXX", cvs_tmpdir);
- rcs_rev_write_stmp(cf->file_rcs, rev, p2, 0);
+ rcs_rev_write_stmp(cf->file_rcs, rev, p2, RCS_KWEXP_NONE);
diff_format = D_RCSDIFF;
if (cvs_diffreg(p2, p1, b2) == D_ERROR)
diff --git a/usr.bin/cvs/rcs.h b/usr.bin/cvs/rcs.h
index 39f8d50ae2d..fde7394f32e 100644
--- a/usr.bin/cvs/rcs.h
+++ b/usr.bin/cvs/rcs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.h,v 1.82 2008/01/10 09:39:32 tobias Exp $ */
+/* $OpenBSD: rcs.h,v 1.83 2008/01/10 09:54:04 tobias Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -78,12 +78,12 @@
#define RCS_KW_HEADER (RCS_KW_ID | RCS_KW_FULLPATH)
/* RCS keyword expansion modes (kflags) */
-#define RCS_KWEXP_NONE 0x00
-#define RCS_KWEXP_NAME 0x01 /* include keyword name */
-#define RCS_KWEXP_VAL 0x02 /* include keyword value */
-#define RCS_KWEXP_LKR 0x04 /* include name of locker */
-#define RCS_KWEXP_OLD 0x08 /* generate old keyword string */
-#define RCS_KWEXP_ERR 0x10 /* mode has an error */
+#define RCS_KWEXP_NONE 0x01 /* do not expand keywords */
+#define RCS_KWEXP_NAME 0x02 /* include keyword name */
+#define RCS_KWEXP_VAL 0x04 /* include keyword value */
+#define RCS_KWEXP_LKR 0x08 /* include name of locker */
+#define RCS_KWEXP_OLD 0x10 /* generate old keyword string */
+#define RCS_KWEXP_ERR 0x20 /* mode has an error */
#define RCS_KWEXP_DEFAULT (RCS_KWEXP_NAME | RCS_KWEXP_VAL)
#define RCS_KWEXP_KVL (RCS_KWEXP_NAME | RCS_KWEXP_VAL | RCS_KWEXP_LKR)