[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 07da629: nnmail-cache-close should not use nofollow

From: Paul Eggert
Subject: master 07da629: nnmail-cache-close should not use nofollow
Date: Wed, 26 Feb 2020 20:10:53 -0500 (EST)

branch: master
commit 07da629926daf849aab248175c88cf53a5e21558
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    nnmail-cache-close should not use nofollow
    nnmail-cache-close did not work when ~/.nnmail-cache was a symlink
    to some other directory.  Reported by Michael Albinus (Bug#39793).
    * lisp/gnus/nnbabyl.el (nnbabyl-create-mbox):
    * lisp/gnus/nndiary.el (nndiary-generate-nov-file):
    * lisp/gnus/nnfolder.el (nnfolder-possibly-change-group):
    * lisp/gnus/nnmbox.el (nnmbox-create-mbox):
    * lisp/gnus/nnml.el (nnml-generate-nov-file):
    Pass ‘excl’ to nnmail-write-region when creating a file, for safety.
    * lisp/gnus/nnmail.el (nnmail-write-region):
    Add optional MUSTBENEW arg, to stay consistent with write-region.
    Past ‘nofollow’ to set-file-modes only when MUSTBENEW is ‘excl’.
 lisp/gnus/nnbabyl.el  | 2 +-
 lisp/gnus/nndiary.el  | 2 +-
 lisp/gnus/nnfolder.el | 2 +-
 lisp/gnus/nnmail.el   | 8 +++++---
 lisp/gnus/nnmbox.el   | 2 +-
 lisp/gnus/nnml.el     | 2 +-
 6 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/lisp/gnus/nnbabyl.el b/lisp/gnus/nnbabyl.el
index cb22933..480d794 100644
--- a/lisp/gnus/nnbabyl.el
+++ b/lisp/gnus/nnbabyl.el
@@ -544,7 +544,7 @@
       (setq buffer-file-name nnbabyl-mbox-file)
       (insert "BABYL OPTIONS:\n\n\^_")
-       (point-min) (point-max) nnbabyl-mbox-file t 'nomesg))))
+       (point-min) (point-max) nnbabyl-mbox-file t 'nomesg nil 'excl))))
 (defun nnbabyl-read-mbox ()
   (nnmail-activate 'nnbabyl)
diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el
index ac394ae..945ef03 100644
--- a/lisp/gnus/nndiary.el
+++ b/lisp/gnus/nndiary.el
@@ -1115,7 +1115,7 @@ all.  This may very well take some time.")
        (setq files (cdr files)))
       (with-current-buffer nov-buffer
-       (nnmail-write-region 1 (point-max) nov nil 'nomesg)
+       (nnmail-write-region 1 (point-max) nov nil 'nomesg nil 'excl)
        (kill-buffer (current-buffer))))))
 (defun nndiary-nov-delete-article (group article)
diff --git a/lisp/gnus/nnfolder.el b/lisp/gnus/nnfolder.el
index d1eeb04..c27af17 100644
--- a/lisp/gnus/nnfolder.el
+++ b/lisp/gnus/nnfolder.el
@@ -735,7 +735,7 @@ deleted.  Point is left where the deleted region was."
                       (or nnfolder-file-coding-system-for-write
                  (nnmail-write-region (point-min) (point-min)
-                                      file t 'nomesg)))
+                                      file t 'nomesg nil 'excl)))
              (when (setq nnfolder-current-buffer (nnfolder-read-folder group))
                (set-buffer nnfolder-current-buffer)
                (push (list group nnfolder-current-buffer)
diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el
index 93e4b0e..3be843c 100644
--- a/lisp/gnus/nnmail.el
+++ b/lisp/gnus/nnmail.el
@@ -1953,12 +1953,14 @@ If TIME is nil, then return the cutoff time for oldness 
       (unless (re-search-forward "^Message-ID[ \t]*:" nil t)
        (insert "Message-ID: " (nnmail-message-id) "\n")))))
-(defun nnmail-write-region (start end filename &optional append visit lockname)
+(defun nnmail-write-region (start end filename
+                                 &optional append visit lockname mustbenew)
   "Do a `write-region', and then set the file modes."
   (let ((coding-system-for-write nnmail-file-coding-system)
        (file-name-coding-system nnmail-pathname-coding-system))
-    (write-region start end filename append visit lockname)
-    (set-file-modes filename nnmail-default-file-modes 'nofollow)))
+    (write-region start end filename append visit lockname mustbenew)
+    (set-file-modes filename nnmail-default-file-modes
+                   (when (eq mustbenew 'excl) 'nofollow))))
 ;;; Status functions
diff --git a/lisp/gnus/nnmbox.el b/lisp/gnus/nnmbox.el
index a191f88..8b3d802 100644
--- a/lisp/gnus/nnmbox.el
+++ b/lisp/gnus/nnmbox.el
@@ -613,7 +613,7 @@
          (dir (file-name-directory nnmbox-mbox-file)))
       (and dir (gnus-make-directory dir))
       (nnmail-write-region (point-min) (point-min)
-                          nnmbox-mbox-file t 'nomesg))))
+                          nnmbox-mbox-file t 'nomesg nil 'excl))))
 (defun nnmbox-read-mbox ()
   (nnmail-activate 'nnmbox)
diff --git a/lisp/gnus/nnml.el b/lisp/gnus/nnml.el
index 2c39ab8..baf5d54 100644
--- a/lisp/gnus/nnml.el
+++ b/lisp/gnus/nnml.el
@@ -901,7 +901,7 @@ Unless no-active is non-nil, update the active file too."
                (nnheader-insert-nov headers)))
       (with-current-buffer nov-buffer
-       (nnmail-write-region (point-min) (point-max) nov nil 'nomesg)
+       (nnmail-write-region (point-min) (point-max) nov nil 'nomesg nil 'excl)
        (kill-buffer (current-buffer))))))
 (defun nnml-nov-delete-article (group article)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]