CVS Windows NT Bug & Fix: wrong timestamps with "cvs -r checkout"

CVS Windows NT Bug & Fix: wrong timestamps with "cvs -r checkout"

Post by Johannes Stezenbac » Sun, 27 Sep 1998 04:00:00



When checking files out read only (via "cvs -r" or when
watches are enabled), the Windows NT version of CVS
fails to set correct timestamps, so all files are effectively
touched.

The reason for this is that the utime() library function
on NT (MSVC++ 4.2) does not work for read only files.

I applied the same workaround which has already been used
in client.c to vers_ts.c (#ifdef UTIME_EXPECTS_WRITABLE).

I also checked all other utime() calls, but as far
as I can see they are only invoked on freshly created,
writable files.

The diff is against CVS 1.10.2, but since the last modification
date of vers_ts.c is in february it should also work against
CVS 1.10.

------------------------- vers_ts.diff ------------------
Index: ccvs/vers_ts.c
diff -c ccvs/vers_ts.c:1.1 ccvs/vers_ts.c:1.2
*** ccvs/vers_ts.c:1.1  Mon Feb 16 19:57:38 1998
--- ccvs/vers_ts.c      Sat Sep 26 16:07:21 1998
***************
*** 34,39 ****
--- 34,43 ----
      struct stickydirtag *sdtp;
      Entnode *entdata;

+ #ifdef UTIME_EXPECTS_WRITABLE
+     int change_it_back = 0;
+ #endif
+
      /* get a new Vers_TS struct */
      vers_ts = (Vers_TS *) xmalloc (sizeof (Vers_TS));
      memset ((char *) vers_ts, 0, sizeof (*vers_ts));
***************
*** 214,220 ****
--- 218,240 ----
                       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).  */
+ #ifdef UTIME_EXPECTS_WRITABLE
+                       if (!iswritable (finfo->file))
+                       {
+                               xchmod (finfo->file, 1);
+                               change_it_back = 1;
+                       }
+ #endif  /* UTIME_EXPECTS_WRITABLE  */
+
                    (void) utime (finfo->file, &t);
+
+ #ifdef UTIME_EXPECTS_WRITABLE
+                       if (change_it_back == 1)
+                       {
+                               xchmod (finfo->file, 0);
+                               change_it_back = 0;
+                       }
+ #endif  /*  UTIME_EXPECTS_WRITABLE  */
                }
            }
        }

------------------------- vers_ts.diff ------------------

--
Johannes Stezenbach, Systementwickler
Propack Data GmbH, D-76131 Karlsruhe, Vincenz-Priessnitz-Str. 1
Tel: 0721/9650-850 Fax: 0721/9650-888  http://www.propack-data.de/

 
 
 

1. CVS Windos NT Bug: "cvs watch" vs. case insensitive file names

During tests of CVS (1.10.2) I found that watches are
effectively unusable on NT since CVS does nothing to
deal with case insensitive file names.

It seems to me that cvs sometimes uses the case of the
files as they appear in the file system (bad because
some brain dead tools/editors change it) and sometimes
even uses the case like the user types it on the
cvs command line (even worse).

I think every file name written to the "fileattr" files
in the repositiy should be lowercase only, and similarly
all lookups are to be made with lowercase file names
(NT only, of course).

Another buglet: "cvs watch add yxcv" where yxcv does either not
exist or is a directory without CVS subdir gives:

cvs watch: cannot open CVS/Entries for reading: No such file or directory
Assertion failed: fileattr_stored_repos != NULL, file src\fileattr.c, line 80

--
Johannes Stezenbach, Systementwickler
Propack Data GmbH, D-76131 Karlsruhe, Vincenz-Priessnitz-Str. 1
Tel: 0721/9650-850 Fax: 0721/9650-888  http://www.propack-data.de/

2. 2000 Cluster Networking question..

3. CVS: Can "update" be told to create new subdirectories ala "checkout"?

4. Illustrator & Windows 95

5. Force "cvs tag" before "cvs commit"?

6. bind8.2.2 dies without a notice

7. (Bug report) CVS on VMS - cvs update sets "revised" attribute

8. NeXTSTEP drivers for Toshiba Tecra 700ct?

9. Help: "Result of merge" status in timestamp column of CVS Entries file

10. Copying cvs "checkouts".

11. CVS files "Changed" on Checkout

12. About CVS's "-o" option in file "module"

13. "cvs stat" fails with remote CVS and absolute paths