Subject: Re: bug#865: 23.0.60; The directory is unsafe today

From: Eli Zaretskii <[email-masked]>
Date: Thu, 04 Sep 2008 19:10:51 +0300

> Date: Thu, 04 Sep 2008 11:30:57 +0800
> From: Jason Rumney <[email-masked]>
> CC: [email-masked], [email-masked]
> 
> > I think the only good solution in that venue would be to have a new
> > primitive for such tests, and implement it on Windows so that it will
> > cater to this special case.  Any other solution is likely to lie about
> > the file's security attributes.
> >   
> 
> We are telling a lie already by attempting to map ACLs to POSIX 
> ownership.

The current lie is relatively small: it is limited to the
interpretation of the group ID, while the owner of the file is
displayed and interpreted correctly.

> If we are going to attempt this, then it is better to tell a lie
> that fits with the expectations of POSIX (ie that owners of files
> are individual users).

The problem is, I don't see how we can do this reliably.  In this
particular case, Emacs compares the file's ownership with the UID of
the user running Emacs, so we could pretend the file is owned by that
user.  But in other cases, Emacs could compare the ownership to a UID
of some other user, and what will we do then?

That said, I won't necessarily object if you find a clever way out of
this that leaves existing Lisp code intact.

> A different API that tells the full story might be a good idea, but
> any new API is only going to be used by future developers who know
> about the API, it cannot fix problems in existing Lisp code that
> might make the same assumptions as server.el.

We are talking about Emacs 23, so it's not too late to find all those
places (only in the Emacs distro, of course) and fix them.  I just
looked, there aren't so many of them.  And server.el should have an
entirely different code to do what it wants on Windows, anyway.