This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Proposed change in Cygwin emacs


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]