unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andre Spiegel <spiegel@gnu.org>
Subject: VC and CVS/Entries under NT
Date: Wed, 24 Sep 2003 14:06:15 +0200	[thread overview]
Message-ID: <1064405175.551.136.camel@localhost> (raw)

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.

             reply	other threads:[~2003-09-24 12:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-24 12:06 Andre Spiegel [this message]
2003-09-24 16:00 ` VC and CVS/Entries under NT Kevin Rodgers
2003-09-25 23:21   ` Richard Stallman
2003-09-26  7:31   ` Andre Spiegel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1064405175.551.136.camel@localhost \
    --to=spiegel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).