Subject: Visiting archives changes directory time

From: Juri Linkov <[email-masked]>
Date: Wed, 25 Jan 2012 22:03:52 +0200

Using archive-mode or tar-mode to visit archives touches
directory modification dates.  This is especially annoying
when archives are located in backup directories.  The problem
is in the function `insert' that temporarily modifies the
archive summary buffer causing lock-file to create a lock file
in the current directory that modifies the directory timestamp.

A similar bug#2295 was fixed by let-binding `buffer-file-truename'
to nil to prevent directory time modification in `lock_file'.

This is not a regression, so I propose to install in 24.2 something like

=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el	2012-01-19 07:21:25 +0000
+++ lisp/arc-mode.el	2012-01-25 19:54:01 +0000
@@ -783,7 +784,8 @@ (defun archive-summarize (&optional shut
 Optional argument SHUT-UP, if non-nil, means don't print messages
 when parsing the archive."
   (widen)
-  (let ((inhibit-read-only t))
+  (let ((buffer-file-truename nil) ; avoid changing dir mtime by lock_file
+	(inhibit-read-only t))
     (setq archive-proper-file-start (copy-marker (point-min) t))
     (set (make-local-variable 'change-major-mode-hook) 'archive-desummarize)
     (or shut-up

=== modified file 'lisp/tar-mode.el'
--- lisp/tar-mode.el	2012-01-19 07:21:25 +0000
+++ lisp/tar-mode.el	2012-01-25 19:54:01 +0000
@@ -520,12 +520,13 @@ (defun tar-summarize-buffer ()
         (progress-reporter-done progress-reporter)
       (message "Warning: premature EOF parsing tar file"))
     (goto-char (point-min))
-    (let ((inhibit-read-only t)
+    (let ((buffer-file-truename nil) ; avoid changing dir mtime by lock_file
+	  (inhibit-read-only t)
           (total-summaries
            (mapconcat 'tar-header-block-summarize tar-parse-info "\n")))
-      (insert total-summaries "\n"))
+      (insert total-summaries "\n")
     (goto-char (point-min))
-    (restore-buffer-modified-p modified)))
+      (restore-buffer-modified-p modified))))
 
 (defvar tar-mode-map
   (let ((map (make-keymap)))