Subject: Re: bug#4197: 23.1; error when try to run `server-start': directory .emacs.d/server is unsafe

From: Eli Zaretskii <[email-masked]>
Date: Sat, 22 Aug 2009 13:07:04 +0300

> Date: Fri, 21 Aug 2009 23:35:58 +0300
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked]
> 
> > From: "Drew Adams" <[email-masked]>
> > Cc: <[email-masked]>, <[email-masked]>
> > Date: Fri, 21 Aug 2009 11:55:27 -0700
> > 
> > But if the default value of the variable is inappropriate for some platform
> > (disk format), then it should be changed - at least on that platform.
> > 
> > Can you not test for this (e.g. using code similar to what you asked me to
> > evaluate to test this), and set the default value accordingly?
> 
> I don't think we need to change the value of
> w32-get-true-file-attributes on FAT32 volumes.  All we need is fix
> server.el to not barf on FAT32 volumes.  I'll see what I can do.

Can you please try the following patch to server.el?  It is checked in
on the release branch.

2009-08-22  Eli Zaretskii  <[email-masked]>

	* server.el (server-ensure-safe-dir): Disable the security check
	for Windows.

Index: lisp/server.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/server.el,v
retrieving revision 1.192
diff -u -r1.192 server.el
--- lisp/server.el	10 Mar 2009 14:09:26 -0000	1.192
+++ lisp/server.el	22 Aug 2009 10:06:05 -0000
@@ -452,9 +452,10 @@
     (unless attrs
       (letf (((default-file-modes) ?\700)) (make-directory dir t))
       (setq attrs (file-attributes dir)))
-    ;; Check that it's safe for use.
-    (unless (and (eq t (car attrs)) (eql (nth 2 attrs) (user-uid))
-                 (or (eq system-type 'windows-nt)
+    ;; Check that it's safe for use.  Windows doesn't support
+    ;; Posix-style file security, so don't check there.
+    (unless (or (eq system-type 'windows-nt)
+		(and (eq t (car attrs)) (eql (nth 2 attrs) (user-uid))
                      (zerop (logand ?\077 (file-modes dir)))))
       (error "The directory %s is unsafe" dir))))