Peter Szilagyi  committed 75e1103

Provisional fix to the permissions problems when creating /tmp/omake-server.

  • Participants
  • Parent commits 5aa0dd9

Comments (0)

Files changed (3)

File elisp/jane/jane-defaults.el

 ;; This is repeated in jane-common and jane-defaults.  Either can be
 ;; loaded from a user's ~/.emacs.
-(if load-file-name
-    (add-to-list 'load-path (directory-file-name (file-name-directory load-file-name))))
+(when load-file-name
+  (add-to-list 'load-path (directory-file-name (file-name-directory load-file-name))))
 (require 'jane-common)

File elisp/omake/omake-errors.el

 (defun Omake.notify-maintainer-of-error ()
   (make-directory Omake.File.bug-report-dir t)
+  (Omake.File.check-root-perms)
         ((id (Omake.Id.current))
          (n (1+ (apply 'max existing)))
          (dir (expand-file-name (number-to-string n) Omake.File.bug-report-dir))
          (_ (make-directory dir t))
+         (_ (Omake.File.check-root-perms))
          (tramp (format "%s:%s" (system-name) dir))
          (recipients (list Omake.maintainer-email-addr))
          (subject "[omake-mode bug report]")

File elisp/omake/omake-file.el

   (format "%s/%d" Omake.File.emacs-log-dir (emacs-pid)))
 (condition-case _
-    (make-directory Omake.File.emacs-log-pid-dir t)
+    (progn (make-directory Omake.File.emacs-log-pid-dir t)
+           (Omake.File.check-root-perms))
+  ;; CR pszilagyi: I think this is wrong.  The first "error" is a
+  ;; condition name; I think the intension is that the handler then
+  ;; call the ERROR function, given the arguments.  There may be other
+  ;; instances, although Omake.handle-errors looks right.
   (error "Couldn't create the Omake emacs-log.  Check the permissions on %s"
 ;;        Omake.File.mode-log
 ;;        Omake.File.server-log))
+(defun Omake.File.check-root-perms ()
+  "Because the /tmp/omake-server directory is shared between
+users, it needs to have appropriate permissions set.  In
+particular, call this function at least after potentially
+creating /tmp/omake-server with the default umask."
+  (let ((required #o1777)
+        (present (file-modes Omake.File.root)))
+    (unless (= required (logand required present))
+      (ignore-errors
+        ;; Don't try unless we can usefully report errors.
+        (when (called-interactively-p 'any)
+          (condition-case err (set-file-modes Omake.File.root (logor required present))
+            (error (message "Couldn't fix wrong permissions %o on %s: %s"
+                            present
+                            Omake.File.root
+                            (error-message-string err)))))))))
 (provide 'omake-file)