From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Andre Spiegel Newsgroups: gmane.emacs.devel Subject: VC and CVS/Entries under NT Date: Wed, 24 Sep 2003 14:06:15 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <1064405175.551.136.camel@localhost> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1064406139 21222 80.91.224.253 (24 Sep 2003 12:22:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 24 Sep 2003 12:22:19 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Sep 24 14:22:17 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A28ev-0003UI-00 for ; Wed, 24 Sep 2003 14:22:17 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1A28ld-0004LW-00 for ; Wed, 24 Sep 2003 14:29:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 1A28R7-0004wu-Da for emacs-devel@quimby.gnus.org; Wed, 24 Sep 2003 08:08:01 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.22) id 1A28R4-0004wf-5r for emacs-devel@gnu.org; Wed, 24 Sep 2003 08:07:58 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.22) id 1A28R2-0004wE-2H for emacs-devel@gnu.org; Wed, 24 Sep 2003 08:07:56 -0400 Original-Received: from [193.113.160.14] (helo=mail.o2.co.uk) by monty-python.gnu.org with esmtp (Exim 4.22) id 1A28R0-0004w3-Gp for emacs-devel@gnu.org; Wed, 24 Sep 2003 08:07:54 -0400 Original-Received: from [217.231.77.165] (217.231.77.165) by mail.o2.co.uk (7.0.020) (authenticated as 01792247376@o2online.de) id 3F6F007000099D2A for emacs-devel@gnu.org; Wed, 24 Sep 2003 13:01:45 +0100 Original-To: emacs-devel@gnu.org X-Mailer: Ximian Evolution 1.4.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:16597 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:16597 Dave Abrahams recently reported a problem where VC incorrectly assumed that files were edited, when they were in fact unmodified. The reason was that Emacs did not correctly compare the file's modification time with the time stamp in CVS/Entries. After a recent patch by Stefan Monnier, vc-cvs.el tried to do that by converting the modification time to a string and comparing it textually to the time stamp: (let* ((mtime (nth 5 (file-attributes file))) (system-time-locale "C") (mtstr (format-time-string "%c" mtime 'utc))) ;; Solaris sometimes uses "Wed Sep 05" instead of "Wed Sep 5". ;; See "grep '[^a-z_]ctime' cvs/src/*.c" for reference. (if (= (aref mtstr 8) ?0) (setq mtstr (concat (substring mtstr 0 8) " " (substring mtstr 9)))) The problem is that under NT, the resulting string is still not in "C" locale format, but looks like "8/15/02 18:37:55", when it should be "Thu Aug 15 18:37:55 2002". This may be a bug of Emacs and/or NT, and should be investigated. In any case, I find it simply wrong to compare the time stamps textually, rather than to parse the time stamp from CVS/Entries and compare it numerically to the file's modification time. Stefan's argument for his code is that CVS does it the same way, but the problem reported by Dave shows how easily this can break, for whatever reason (the Solaris problem mentioned in the comment is another example for such an issue). We simply cannot guarantee that Emacs' way of producing the time string yields exactly the same result as whatever CVS did to make it. To isolate ourselves from such issues, I have installed my previous version of the code which does a numerical comparison: (let ((mtime (nth 5 (file-attributes file)))) (require 'parse-time) (let ((parsed-time (parse-time-string (concat (match-string 2) " +0000")))) (cond ((and (not (string-match "\\+" (match-string 2))) (car parsed-time) (equal mtime (apply 'encode-time parsed-time))) This code fixes Dave's problem, and the Solaris issue mentioned in Stefan's comment. If anybody sees any problems with it, or has suggestions how to improve it, please let me know.