From: Noam Postavsky <npostavs@users.sourceforge.net>
To: "Lennart Borgman \(gmail\)" <lennart.borgman@gmail.com>
Cc: 865@debbugs.gnu.org
Subject: bug#865: 23.0.60; The directory is unsafe today
Date: Sun, 24 Sep 2017 17:25:37 -0400 [thread overview]
Message-ID: <87r2uvlrfy.fsf@users.sourceforge.net> (raw)
In-Reply-To: <48BD642C.5050405@gmail.com> (Lennart Borgman's message of "Tue, 02 Sep 2008 18:05:00 +0200")
[-- Attachment #1: Type: text/plain, Size: 487 bytes --]
"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> server-ensure-safe-dir complained today during server-start. Examining
> the values in server-ensure-safe-dir I found the following:
I don't know how to solve this bug, but I recently handled a similar bug
report from a macOS user[1] (still open, it's intermittent so very slow
to track down) and I found the error message rather unhelpful. I'll
push the following to emacs-26 in a few days if there are no objections.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 3088 bytes --]
From b8e526e3861e64115f1458b2e53c2c0a838eb25d Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sun, 27 Aug 2017 23:09:32 -0400
Subject: [PATCH] Make "unsafe directory" error message more informative
(Bug#865)
* lisp/server.el (server-ensure-safe-dir): Produce a description for
each "unsafe" condition.
---
lisp/server.el | 47 ++++++++++++++++++++++++++---------------------
1 file changed, 26 insertions(+), 21 deletions(-)
diff --git a/lisp/server.el b/lisp/server.el
index 8aafa1c257..33800a9868 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -525,30 +525,35 @@ server-ensure-safe-dir
;; Check that it's safe for use.
(let* ((uid (nth 2 attrs))
(w32 (eq system-type 'windows-nt))
- (safe (cond
- ((not (eq t (car attrs))) nil) ; is a dir?
- ((and w32 (zerop uid)) ; on FAT32?
- (display-warning
- 'server
- (format-message "\
+ (unsafe (cond
+ ((not (eq t (car attrs)))
+ (format "it is a %s" (if (stringp (car attrs))
+ "symlink" "file")))
+ ((and w32 (zerop uid)) ; on FAT32?
+ (display-warning
+ 'server
+ (format-message "\
Using `%s' to store Emacs-server authentication files.
Directories on FAT32 filesystems are NOT secure against tampering.
See variable `server-auth-dir' for details."
- (file-name-as-directory dir))
- :warning)
- t)
- ((and (/= uid (user-uid)) ; is the dir ours?
- (or (not w32)
- ;; Files created on Windows by Administrator
- ;; (RID=500) have the Administrators (RID=544)
- ;; group recorded as the owner.
- (/= uid 544) (/= (user-uid) 500)))
- nil)
- (w32 t) ; on NTFS?
- (t ; else, check permissions
- (zerop (logand ?\077 (file-modes dir)))))))
- (unless safe
- (error "The directory `%s' is unsafe" dir)))))
+ (file-name-as-directory dir))
+ :warning)
+ nil)
+ ((and (/= uid (user-uid)) ; is the dir ours?
+ (or (not w32)
+ ;; Files created on Windows by Administrator
+ ;; (RID=500) have the Administrators (RID=544)
+ ;; group recorded as the owner.
+ (/= uid 544) (/= (user-uid) 500)))
+ (format "it is not owned by you (owner = %s (%d))"
+ (user-full-name (user-uid)) (user-uid)))
+ (w32 nil) ; on NTFS?
+ ((/= 0 (logand ?\077 (file-modes dir)))
+ (format "it is accessible by others (%03o)"
+ (file-modes dir)))
+ (t nil))))
+ (when unsafe
+ (error "`%s' is not a safe directory because %s" dir unsafe)))))
(defun server-generate-key ()
"Generate and return a random authentication key.
--
2.11.0
[-- Attachment #3: Type: text/plain, Size: 49 bytes --]
[1]: https://github.com/magit/magit/issues/3148
next prev parent reply other threads:[~2017-09-24 21:25 UTC|newest]
Thread overview: 87+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-02 16:05 bug#865: 23.0.60; The directory is unsafe today Lennart Borgman (gmail)
2008-09-02 17:16 ` Jason Rumney
2008-09-02 18:06 ` Lennart Borgman (gmail)
2008-09-02 18:41 ` Eli Zaretskii
2008-09-02 19:10 ` Lennart Borgman (gmail)
2008-09-02 19:31 ` Eli Zaretskii
2008-09-02 19:37 ` Lennart Borgman (gmail)
2008-09-02 22:38 ` Juanma Barranquero
2008-09-02 22:40 ` Lennart Borgman (gmail)
2008-09-02 22:42 ` Juanma Barranquero
2008-09-02 23:01 ` Lennart Borgman (gmail)
2008-09-02 23:06 ` Juanma Barranquero
2008-09-02 23:11 ` Lennart Borgman (gmail)
2008-09-02 23:17 ` Juanma Barranquero
2008-09-02 23:19 ` Lennart Borgman (gmail)
2008-09-02 23:25 ` Juanma Barranquero
2008-09-02 23:27 ` Lennart Borgman (gmail)
2008-09-02 23:38 ` Juanma Barranquero
2008-09-02 23:41 ` Lennart Borgman (gmail)
2008-09-02 23:44 ` Juanma Barranquero
2008-09-02 23:50 ` Lennart Borgman (gmail)
2008-09-02 23:52 ` Juanma Barranquero
2008-09-02 23:58 ` Lennart Borgman (gmail)
2008-09-03 0:00 ` Juanma Barranquero
2008-09-03 0:05 ` Lennart Borgman (gmail)
2008-09-03 16:29 ` Stefan Monnier
2008-09-03 16:35 ` Lennart Borgman (gmail)
2008-09-03 18:05 ` Stefan Monnier
2008-09-03 18:57 ` Eli Zaretskii
2008-09-03 18:13 ` Eli Zaretskii
2008-09-02 19:19 ` Eli Zaretskii
2008-09-02 23:50 ` Jason Rumney
2008-09-03 3:27 ` Eli Zaretskii
2008-09-03 18:31 ` Eli Zaretskii
2008-09-03 23:44 ` Jason Rumney
2008-09-04 0:16 ` Lennart Borgman (gmail)
2008-09-04 3:22 ` Eli Zaretskii
2008-09-04 3:30 ` Jason Rumney
2008-09-04 16:10 ` Eli Zaretskii
2008-09-04 22:51 ` Jason Rumney
2008-09-05 10:21 ` Eli Zaretskii
2008-09-05 3:11 ` Stefan Monnier
2008-09-05 10:52 ` Eli Zaretskii
2008-09-05 13:16 ` Stefan Monnier
2008-09-05 15:11 ` Eli Zaretskii
2008-09-05 21:36 ` Stefan Monnier
2008-09-06 7:08 ` Eli Zaretskii
2008-09-06 19:45 ` Stefan Monnier
2008-09-06 21:38 ` Eli Zaretskii
2008-09-07 3:43 ` Stefan Monnier
2008-09-07 18:33 ` Eli Zaretskii
2008-09-08 3:33 ` Stefan Monnier
2008-09-08 3:40 ` Jason Rumney
2008-09-08 11:25 ` Stefan Monnier
2008-09-08 20:08 ` Eli Zaretskii
2008-09-09 14:37 ` Stefan Monnier
2008-09-09 18:52 ` Eli Zaretskii
2008-09-10 16:32 ` Stefan Monnier
[not found] ` <mailman.18638.1220760463.18990.bug-gnu-emacs@gnu.org>
2008-09-07 15:44 ` Francis Litterio
2008-09-07 17:36 ` Lennart Borgman (gmail)
2008-09-07 18:41 ` Eli Zaretskii
[not found] ` <mailman.18580.1220686060.18990.bug-gnu-emacs@gnu.org>
2008-09-06 17:04 ` Francis Litterio
2008-09-06 17:41 ` Lennart Borgman (gmail)
2008-09-05 13:18 ` Lennart Borgman
2008-09-05 14:27 ` Eli Zaretskii
2008-09-05 15:34 ` Stefan Monnier
2008-09-05 17:19 ` Eli Zaretskii
2008-09-05 14:28 ` Jason Rumney
2008-09-05 15:16 ` Lennart Borgman
2008-09-05 17:13 ` Eli Zaretskii
[not found] ` <mailman.18384.1220500061.18990.bug-gnu-emacs@gnu.org>
2008-09-04 15:56 ` Francis Litterio
2008-09-04 17:40 ` Eli Zaretskii
[not found] ` <mailman.18443.1220551657.18990.bug-gnu-emacs@gnu.org>
2008-09-04 18:08 ` Francis Litterio
2008-09-05 9:54 ` Eli Zaretskii
2008-09-05 10:29 ` Lennart Borgman
2008-09-04 22:46 ` Jason Rumney
2008-09-04 23:17 ` Lennart Borgman (gmail)
2008-09-04 23:25 ` Lennart Borgman (gmail)
2008-09-05 10:32 ` Eli Zaretskii
[not found] ` <mailman.18512.1220611660.18990.bug-gnu-emacs@gnu.org>
2008-09-05 14:23 ` Francis Litterio
2008-09-05 17:12 ` Eli Zaretskii
[not found] ` <mailman.18547.1220635661.18990.bug-gnu-emacs@gnu.org>
2008-09-05 20:29 ` Francis Litterio
2008-09-06 1:30 ` Lennart Borgman (gmail)
[not found] ` <mailman.18565.1220665659.18990.bug-gnu-emacs@gnu.org>
2008-09-06 3:33 ` Francis Litterio
2008-09-06 11:44 ` Eli Zaretskii
2017-09-24 21:25 ` Noam Postavsky [this message]
2017-10-21 19:56 ` Noam Postavsky
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r2uvlrfy.fsf@users.sourceforge.net \
--to=npostavs@users.sourceforge.net \
--cc=865@debbugs.gnu.org \
--cc=lennart.borgman@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.