Subject: bug#36598: 26.1; (error "‘/tmp/emacs1000’ is not a safe directory because it is a symlink")

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 13 Jul 2019 15:06:06 +0200

Noam Postavsky <[email-masked]> writes:

> [email-masked] (Mark A. Hershberger) writes:
>
>> $ ls -l /tmp/emacs1000
>> lrwxrwxrwx 1 mah mah 20 Jul 11 09:53 /tmp/emacs1000 -> /run/user/1000/emacs
>>
>> Whoever set up the symlink for /tmp/emacs1000
>
> Do you know who that is?

It's probably this code?  But it works for me; it just sets up a symlink
from /tmp for compatibility with older emacsclients, I think?

(defun server-ensure-safe-dir (dir)

[...]

    (let ((olddir (or (getenv "TMPDIR") "/tmp")))
      (when (and (equal dir (format "%s/emacs" (getenv "XDG_RUNTIME_DIR")))
                 (file-writable-p olddir))
        (let ((link (format "%s/emacs%d" olddir (user-uid))))
          (unless (file-directory-p link)
            ;; We're using the new location, so try and setup a symlink from
            ;; the old location, in case we want to use an old emacsclient.
            ;; FIXME: Check that it's safe to use!
            (make-symbolic-link dir link t)))))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no