From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Will Parsons Newsgroups: gmane.emacs.help Subject: Re: mismatch between what Emacs considers read-only and file permissions Date: 4 Feb 2015 19:53:33 GMT Message-ID: References: Reply-To: gyliamos@gmail.com NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1423079732 10734 80.91.229.3 (4 Feb 2015 19:55:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 4 Feb 2015 19:55:32 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 04 20:55:31 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YJ62r-00065w-Bc for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Feb 2015 20:55:29 +0100 Original-Received: from localhost ([::1]:38490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJ62q-0005bv-UH for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Feb 2015 14:55:28 -0500 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 43 Original-X-Trace: individual.net kryN3ukAJxwfpUnynbTkaQNxi0Tj7QpvG1TioYNXyYD+29Sx3B Cancel-Lock: sha1:zavwuo1GZ26QKNfETQKEYDQ0Ujg= User-Agent: slrn/1.0.2 (FreeBSD) Original-Xref: usenet.stanford.edu gnu.emacs.help:210204 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:102481 Archived-At: Eli Zaretskii wrote: >> From: Will Parsons >> Date: 4 Feb 2015 17:12:52 GMT >> >> How does Emacs determine whether to mark a buffer read-only when >> visiting a file that is writable? > > By looking at the file permission bits. > >> 1) Under Windows >> >> I make heavy use of the Cygwin environment under Windows, but usually >> use the native Windows Emacs. I've never bothered to track down the >> exact circumstances, but assume that Cygwin is setting file >> permissions in a way that confuses native Emacs. > > Cygwin attempts to emulate Posix user/group/other permission bits by > manipulating Windows NT security attributes. The way it does that > will only work as you'd expect when those attributes are tested by > Cygwin programs. Native Windows build of Emacs, OTOH, not only doesn't > support the Cygwin fiddling with the NTSec features, it doesn't even > look at those attributes when it checks files for accessibility; > instead, it probes only the read-only bit (which is not affected by > NTSec). > > My advice is not to mix Cygwin programs with native Emacs on Windows. > Good native ports of Unix and GNU software to Windows are available, > and you are advised to use them instead, if you don't want to deal > with these incompatibilities. I've been using Cywin for over a decade and find it far too useful to live without. As I had stated, I'm perfectly happy to deal the incompatibilities simply by changing the read-only attribute on the buffer when needed. My real question is the second circumstance, where a file with the Unix write bit set is marked read-only by Emacs. Since it only occurs when I log in directly as root in console mode (which I don't do that often), I can live with that too, using the same method. By *why* does it happen? -- Will