unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Michael Hoffman" <emacs-hoffman@snkmail.com>
Cc: 41218@debbugs.gnu.org
Subject: bug#41218: 26.3; Windows: file-writable-p returns t for a file owned by the Administrators group but not writable by the user, a member of the Administrators group
Date: Wed, 13 May 2020 19:40:22 +0300	[thread overview]
Message-ID: <83y2pv6b61.fsf@gnu.org> (raw)
In-Reply-To: <9557-1589385966-320243@sneakemail.com> (emacs-hoffman@snkmail.com)

> From: "Michael Hoffman" <emacs-hoffman@snkmail.com>
> Date: Wed, 13 May 2020 12:05:51 -0400
> 
> The situation arises for me when viewing files within `%ProgramFiles%` which are often set by installers or
> similar systems to be owned by Administrators when installed for all users.
> 
> Specifically, it most often comes up when I am using Emacs, as installed by Chocolatey. Chocolatey installs
> Emacs to be owned by the Administrators group.

That has a simple solution: take ownership of all the files in the
Emacs distribution, so that they are owned by your Windows user and
not by Administrators.

(It is generally not a good idea to install stuff under
%ProgramFiles%, because taking ownership there requires elevation, but
since you evidently don't have a problem with elevation, you should be
able to take ownership on that directory and all of its
subdirectories.)

>  Of course, if someone can explain how to perform this test in a way that takes ACLs into account and
>  would be reliable, we could consider implementing it (assuming it isn't too expensive, since such a
>  test will have to be performed each time a user saves a buffer to its file).
> 
> The `AuthzAccessCheck()` function from the Authz API might be able to do this:

No, it doesn't, not AFAIK.  That's exactly one of those APIs which
it's tempting to use, but which produce false negatives.  This API
only checks the ACLs against your user and your main group's
permissions.  But on Windows many users are members of several groups,
especially if they are developers, and access granted via those other
groups, and also through inheritance of access rights from group to
other groups, is not tested.

At least that's what I know.  If someone can write code to solve this
issue, I'm sure it will be welcome.





      reply	other threads:[~2020-05-13 16:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12 20:30 bug#41218: 26.3; Windows: file-writable-p returns t for a file owned by the Administrators group but not writable by the user, a member of the Administrators group Michael Hoffman
2020-05-13 14:25 ` Eli Zaretskii
2020-05-13 16:05   ` Michael Hoffman
2020-05-13 16:40     ` Eli Zaretskii [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83y2pv6b61.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=41218@debbugs.gnu.org \
    --cc=emacs-hoffman@snkmail.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).