From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: (tramp-handleverify-visited-file-modtime Date: Sat, 24 Jul 2004 21:11:01 -0500 (CDT) Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <200407250211.i6P2B1j28553@raven.dms.auburn.edu> References: <200407111634.i6BGYpw11715@raven.dms.auburn.edu> <87acxpjla1.fsf@gmx.de> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1090721698 4274 80.91.224.253 (25 Jul 2004 02:14:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 25 Jul 2004 02:14:58 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 25 04:14:48 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BoYXI-0002a6-00 for ; Sun, 25 Jul 2004 04:14:48 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BoYaG-0007tA-5g for ged-emacs-devel@m.gmane.org; Sat, 24 Jul 2004 22:17:52 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BoYaA-0007t5-8L for emacs-devel@gnu.org; Sat, 24 Jul 2004 22:17:46 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BoYa8-0007se-Rm for emacs-devel@gnu.org; Sat, 24 Jul 2004 22:17:45 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BoYa8-0007sY-DC for emacs-devel@gnu.org; Sat, 24 Jul 2004 22:17:44 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BoYX4-000298-U4 for emacs-devel@gnu.org; Sat, 24 Jul 2004 22:14:35 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id i6P2ECuE000843; Sat, 24 Jul 2004 21:14:12 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id i6P2B1j28553; Sat, 24 Jul 2004 21:11:01 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: michael.albinus@gmx.de In-reply-to: <87acxpjla1.fsf@gmx.de> (message from Michael Albinus on Sat, 24 Jul 2004 20:46:30 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:25934 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25934 Michael Albinus wrote: Luc Teirlinck writes: > Because `tramp-handle-verify-visited-file-modtime' is supposed to > emulate `verify-visited-file-modtime' I believe it should return t, > like `visited-visited-file-modtime' does. > > So what about the following patch? I've committed a looks-like-this patch to Tramp CVS. Best regards, Michael. Actually, I recommend the following patch to the present Tramp CVS version (not the Emacs CVS version) of tramp.el. The reason is that we want to return t for a file that does not exist according to `file-attributes' _and_ for which (visited-file-modtime) returns -1, but nil if `file-attributes' returns nil and `visited-file-modtime' returns a "real" modtime (neither 0 nor -1), meaning the file _did_ exist the last time we checked, but has been deleted in the meantime. To be completely consistent with `verify-visited-file-modtime' we should also return nil if the file system could not handle the file name because it was too long (never happens on the GNU system) or because there were too many symbolic links to follow. I do not know whether this case is important enough to worry about. (The patch below does not.) How were we even able to visit the file in the first place in such a situation? ===File ~/tramp-CVS-diff==================================== *** tramp.el 24 Jul 2004 14:12:22 -0500 2.381 --- tramp.el 24 Jul 2004 19:34:27 -0500 *************** *** 2342,2360 **** (let ((f (buffer-file-name))) (with-parsed-tramp-file-name f nil (let* ((attr (file-attributes f)) ! (modtime (nth 5 attr))) (cond ((and attr (not (equal modtime '(0 0)))) ! (let ((mt (visited-file-modtime))) ! (< (abs (tramp-time-diff ! modtime ! ;; For compatibility, deal with both the old ! ;; (HIGH . LOW) and the new (HIGH LOW) ! ;; return values of `visited-file-modtime'. ! (if (atom (cdr mt)) ! (list (car mt) (cdr mt)) ! mt))) ! 2))) ;; modtime has the don't know value. (attr (save-excursion --- 2342,2360 ---- (let ((f (buffer-file-name))) (with-parsed-tramp-file-name f nil (let* ((attr (file-attributes f)) ! (modtime (nth 5 attr)) ! (mt (visited-file-modtime))) (cond ((and attr (not (equal modtime '(0 0)))) ! (< (abs (tramp-time-diff ! modtime ! ;; For compatibility, deal with both the old ! ;; (HIGH . LOW) and the new (HIGH LOW) ! ;; return values of `visited-file-modtime'. ! (if (atom (cdr mt)) ! (list (car mt) (cdr mt)) ! mt))) ! 2)) ;; modtime has the don't know value. (attr (save-excursion *************** *** 2368,2375 **** (setq attr (buffer-substring (point) (progn (end-of-line) (point))))) (equal tramp-buffer-file-attributes attr)) ! ;; If file does not exist, say it is not modified. ! (t t)))))))) (defadvice clear-visited-file-modtime (after tramp activate) "Set `tramp-buffer-file-attributes' back to nil. --- 2368,2376 ---- (setq attr (buffer-substring (point) (progn (end-of-line) (point))))) (equal tramp-buffer-file-attributes attr)) ! ;; If file does not exist, say it is not modified ! ;; if and only if that agrees with the buffer's record. ! (t (equal mt '(-1 65535)))))))))) (defadvice clear-visited-file-modtime (after tramp activate) "Set `tramp-buffer-file-attributes' back to nil. ============================================================