unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: 39793@debbugs.gnu.org
Subject: bug#39793: 28.0.50; set-file-modes nofollow does not work on mounted directories
Date: Wed, 26 Feb 2020 17:13:45 -0800	[thread overview]
Message-ID: <db09231e-e787-c783-1ad7-3506645c4305@cs.ucla.edu> (raw)
In-Reply-To: <87sgiygyd1.fsf@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 94 bytes --]

Thanks for reporting that. I installed the attached patch into master; 
please give it a try.

[-- Attachment #2: 0001-nnmail-cache-close-should-not-use-nofollow.patch --]
[-- Type: text/x-patch, Size: 4836 bytes --]

From 07da629926daf849aab248175c88cf53a5e21558 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Wed, 26 Feb 2020 17:10:21 -0800
Subject: [PATCH] nnmail-cache-close should not use nofollow
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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 cb22933b52..480d794b9a 100644
--- a/lisp/gnus/nnbabyl.el
+++ b/lisp/gnus/nnbabyl.el
@@ -544,7 +544,7 @@ nnbabyl-create-mbox
       (setq buffer-file-name nnbabyl-mbox-file)
       (insert "BABYL OPTIONS:\n\n\^_")
       (nnmail-write-region
-       (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 ac394ae53d..945ef0351e 100644
--- a/lisp/gnus/nndiary.el
+++ b/lisp/gnus/nndiary.el
@@ -1115,7 +1115,7 @@ nndiary-generate-nov-file
 	  (widen))
 	(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 d1eeb04697..c27af1742d 100644
--- a/lisp/gnus/nnfolder.el
+++ b/lisp/gnus/nnfolder.el
@@ -735,7 +735,7 @@ nnfolder-possibly-change-group
 		       (or nnfolder-file-coding-system-for-write
 			   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 93e4b0e7a8..3be843c91f 100644
--- a/lisp/gnus/nnmail.el
+++ b/lisp/gnus/nnmail.el
@@ -1953,12 +1953,14 @@ nnmail-check-syntax
       (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 a191f887c7..8b3d80266e 100644
--- a/lisp/gnus/nnmbox.el
+++ b/lisp/gnus/nnmbox.el
@@ -613,7 +613,7 @@ nnmbox-create-mbox
 	  (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 2c39ab8e36..baf5d54b74 100644
--- a/lisp/gnus/nnml.el
+++ b/lisp/gnus/nnml.el
@@ -901,7 +901,7 @@ nnml-generate-nov-file
 		(nnheader-insert-nov headers)))
 	    (widen))))
       (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)
-- 
2.24.1


  reply	other threads:[~2020-02-27  1:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25 21:18 bug#39793: 28.0.50; set-file-modes nofollow does not work on mounted directories Michael Albinus
2020-02-27  1:13 ` Paul Eggert [this message]
2020-02-27  8:22   ` Michael Albinus
2020-02-27 19:33     ` Paul Eggert
2020-02-27 20:02       ` Michael Albinus

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=db09231e-e787-c783-1ad7-3506645c4305@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=39793@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    /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).