From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs 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 Message-ID: <83y2pv6b61.fsf@gnu.org> References: <29272-1589315462-76131@sneakemail.com> <83mu6b7vzg.fsf@gnu.org> <9557-1589385966-320243@sneakemail.com> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="68353"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41218@debbugs.gnu.org To: "Michael Hoffman" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 13 18:44:49 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jYuUw-000HZn-KD for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 May 2020 18:44:46 +0200 Original-Received: from localhost ([::1]:60712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYuUv-0004Mo-IC for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 May 2020 12:44:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYuRL-0008Sp-8d for bug-gnu-emacs@gnu.org; Wed, 13 May 2020 12:41:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47669) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYuRK-0004lK-Ax for bug-gnu-emacs@gnu.org; Wed, 13 May 2020 12:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jYuRK-0007l9-6l for bug-gnu-emacs@gnu.org; Wed, 13 May 2020 12:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 May 2020 16:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41218 X-GNU-PR-Package: emacs Original-Received: via spool by 41218-submit@debbugs.gnu.org id=B41218.158938804929802 (code B ref 41218); Wed, 13 May 2020 16:41:02 +0000 Original-Received: (at 41218) by debbugs.gnu.org; 13 May 2020 16:40:49 +0000 Original-Received: from localhost ([127.0.0.1]:59215 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYuR7-0007kb-6a for submit@debbugs.gnu.org; Wed, 13 May 2020 12:40:49 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:45970) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYuR5-0007kN-Hn for 41218@debbugs.gnu.org; Wed, 13 May 2020 12:40:48 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:41173) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYuR0-0004i0-2Y; Wed, 13 May 2020 12:40:42 -0400 Original-Received: from [176.228.60.248] (port=2704 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jYuQz-0008GD-7V; Wed, 13 May 2020 12:40:41 -0400 In-Reply-To: <9557-1589385966-320243@sneakemail.com> (emacs-hoffman@snkmail.com) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:180165 Archived-At: > From: "Michael Hoffman" > 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.