friesen@psivax.UUCP (Stanley Friesen) (11/19/85)
DESCRIPTION: On BSD 4.2 systems (and presumably 4.3) 'rcs' may incorrectly set the file access and modification times. This is due to an invalid assumption about the stability of the fields in a 'struct stat'. The code as it exists assumes that st_mtime will always follow immediately after st_atime. This is *not* true on BSD 4.2. The bug will only appear if the command has been compiled with the -DVARIAN option. REPEAT BY: Choose an RCS file to play with. Then do the following: rcs -l filename ls -l filename,v the result will be: -r--r--r-- 1 user 48802 Feb 5 206 filename,v FIX: A context diff of the fix follows ------------------------CUT HERE----------------------------------------- *** rcs.c.old Mon Nov 18 14:08:15 1985 --- rcs.c Mon Nov 18 14:08:20 1985 *************** *** 164,169 struct Status * curstate; struct hshentry * target; struct access *temp, *temptr; nerror = 0; catchints(); --- 164,172 ----- struct Status * curstate; struct hshentry * target; struct access *temp, *temptr; + #ifdef VARIAN + time_t timep[2]; /* Temporary for utime call */ + #endif VARIAN nerror = 0; catchints(); *************** *** 521,527 { if (chmod(RCSfilename,filestatus.st_mode & ~0222)<0) warn("Can't set mode of %s",RCSfilename); ! utime(RCSfilename,&filestatus.st_atime); } #else if (chmod(RCSfilename,filestatus.st_mode & ~0222)<0) --- 524,532 ----- { if (chmod(RCSfilename,filestatus.st_mode & ~0222)<0) warn("Can't set mode of %s",RCSfilename); ! timep[0] = filestatus.st_atime; ! timep[1] = filestatus.st_mtime; ! utime(RCSfilename,timep); } #else if (chmod(RCSfilename,filestatus.st_mode & ~0222)<0) -- Sarima (Stanley Friesen) UUCP: {ttidca|ihnp4|sdcrdcf|quad1|nrcvax|bellcore|logico}!psivax!friesen ARPA: ttidca!psivax!friesen@rand-unix.arpa