delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/12/16/13:19:30

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_NEUTRAL
X-Spam-Check-By: sourceware.org
Message-ID: <4EEB8B93.8090108@cornell.edu>
Date: Fri, 16 Dec 2011 13:18:59 -0500
From: Ken Brown <kbrown AT cornell DOT edu>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: cygwin <cygwin AT cygwin DOT com>
Subject: Proposed change in Cygwin emacs
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

An emacs bug report by a Cygwin user has led to a proposed change (for 
Cygwin only) in the way emacs checks to see if a file is writable.  See

   http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10257 .

The proposed change is in message #98.  I'd like to know if Cygwin emacs 
users can see any downside to this change.  Here's the background:

Sometimes Cygwin doesn't know the user id and group id of a file because 
the necessary entries are missing from /etc/passwd and /etc/group.  You 
know you're in this situation when you see ???????? in place of user and 
group names in a directory listing.  I'm aware of two situations where 
this happens:

1. The file was created by the TrustedInstaller virtual user.

2. The file is on a network share that does not report accurate user and 
group information to Windows.

If you try to visit such a file in emacs, it will always report that the 
file is read-only, even if you do in fact have write access, and it will 
not let you edit the buffer.  You can override this with the command 
`C-x C-q' and do your editing.  When you try to save the file, emacs 
will warn you that the file is read-only and ask you to confirm that you 
want to try to save it anyway.  This will succeed if you do in fact have 
write access.

The problem occurs because emacs calls euidaccess, which will always 
report that there's no access when UID and GID are not known.  The 
proposed change would make emacs think a file is writable if euidaccess 
reports no access but UID and GID are unknown (*).  I don't feel too 
guilty about this lie because euidaccess is documented to be unreliable 
anyway; see

http://www.kernel.org/doc/man-pages/online/pages/man3/euidaccess.3.html

With this change, you would not get a warning when you visit such a 
file, the buffer would not be set to be read-only, and you would not be 
prompted to confirm when you try to save the file.  The save will of 
course fail if you don't in fact have write access.

Please let me know if you see a problem with this proposal.

Ken

(*) A variant of the proposal would be more permissive and just require 
that one of UID and GID is unknown.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019