rcs bug: An update
Ray Chen
chenr at tilt.FUN
Sun Dec 2 12:44:44 AEST 1984
A correction to a 3:00 AM mistake. The idea was right but the code
wasn't. Updated diffs follow.
File: (whatever)/rcs/src/rcs/ci.c
Description: ci allows names following -[nN] to have name delimiter
characters such as white space in them. This results in
later operations on the file producing errors.
Repeat-by: ci -n"test 1" file
ci -Ntest2 file
Fix: The problem results from the fact the routine checkid()
checks a symbol for validity but stops on symbol delimiting
characters, the set of which which includes characters other
than \0. ci, however, assumes that the entire name string
is a valid symbol if no error occurs, so it installs the
entire string as the name. This results in a situation where a
name could be installed consisting of one valid symbol and an
arbitrary number of possibly invalid symbols. The fix is simply
to make ci use the information that checkid() returns -- a
pointer to the character it stopped on, and to exit with a
fatal error (and error message) if the delimiting character was
a non-NULL one.
Ray Chen
princeton!tilt!chenr
RCS file: RCS/ci.c,v
retrieving revision 3.11
retrieving revision 3.9
diff -c -r3.11 -r3.9
*** /tmp/,RCSt1001960 Sat Dec 1 21:39:33 1984
--- /tmp/,RCSt2001960 Sat Dec 1 21:39:42 1984
***************
*** 2,8
* RCS checkin operation
*/
static char rcsid[]=
! "$Header: ci.c,v 3.11 84/12/01 21:31:17 chenr Exp $ Purdue CS";
/*******************************************************************
* check revisions into RCS files
*******************************************************************
--- 2,8 -----
* RCS checkin operation
*/
static char rcsid[]=
! "$Header: ci.c,v 3.9 83/02/15 15:25:44 wft Exp $ Purdue CS";
/*******************************************************************
* check revisions into RCS files
*******************************************************************
***************
*** 21,36
/* $Log: ci.c,v $
- * Revision 3.11 84/12/01 21:31:17 chenr
- * Changed checkid() test in -[nN] handling section to test the character
- * pointed to by the pointer and not the pointer itself.
- *
- * Revision 3.10 84/11/30 01:23:01 chenr
- * Added char *nametest to force name in -[nN]name to be a one word
- * symbol. If this isn't the case, then ci aborts with a fatal error.
- * A quick and dirty fix to prevent names from being placed into the
- * delta files that won't be properly handled later.
- *
* Revision 3.9 83/02/15 15:25:44 wft
* original ci.c
*
--- 21,26 -----
/* $Log: ci.c,v $
* Revision 3.9 83/02/15 15:25:44 wft
* original ci.c
*
***************
*** 136,142
{
register int i;
register char * sp, *tp;
- char *nametest;
char * cmdusage; /* holds command format */
char command[NCPPN+50]; /* holds diff commands */
char curdate[datelength];/* date for new delta */
--- 126,131 -----
{
register int i;
register char * sp, *tp;
char * cmdusage; /* holds command format */
char command[NCPPN+50]; /* holds diff commands */
char curdate[datelength];/* date for new delta */
***************
*** 208,217
if ((*argv)[2]!='\0'){
if (symbol!=nil)warn("Redefinition of symbolic name");
symbol = (*argv)+2;
! nametest = checkid(symbol,' ');
! if (*nametest != NULL)
! faterror("Name %s must be one word",
! symbol);
} else warn("Missing name for -n option");
break;
--- 197,203 -----
if ((*argv)[2]!='\0'){
if (symbol!=nil)warn("Redefinition of symbolic name");
symbol = (*argv)+2;
! checkid(symbol,' ');
} else warn("Missing name for -n option");
break;
***************
*** 220,229
if ((*argv)[2]!='\0'){
if (symbol!=nil)warn("Redefinition of symbolic name");
symbol = (*argv)+2;
! nametest = checkid(symbol,' ');
! if (*nametest != NULL)
! faterror("Name %s must be one word",
! symbol);
} else warn("Missing name for -N option");
break;
--- 206,212 -----
if ((*argv)[2]!='\0'){
if (symbol!=nil)warn("Redefinition of symbolic name");
symbol = (*argv)+2;
! checkid(symbol,' ');
} else warn("Missing name for -N option");
break;
More information about the Net.bugs
mailing list