delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/03/28/09:06:41

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=tdko1OPKCSLltoJA
mlZBcTk4Q8tz0IUF9RYUTFAPm25jh/2haTlGWC9cw5d+IyH20Oi7m2qE2+0wPMOO
uZNR2cbCam8cCoYS9Jb7iyd4kMrzvRtOGJysjWV++CiywXZ1v/bMSLFrfN1BnbaJ
Ra6uHbosMUD2j+9LdJTo1EvnSMo=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=aUg5iNMgv3EdXcFp1H+mpT
1OD5I=; b=mFJ7r1XQN+s1Gp3+cNLHPxBBYZUcytF4kASR7NQaiDQMvEJe7bBOYd
fVMxrktVjhrp6x53ib+2CE38/ZnHzGq4t3BsjNVWObxdYjJdEGow/Hg+YTRdNttH
4TVucHQCzKO3D/LwdPIJrJEDVJR8QNzTROx2Zqtp3PCoBX3hEr/L8=
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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=smooth, job, H*R:D*edu, umask
X-HELO: mailsrv.cs.umass.edu
Reply-To: moss AT cs DOT umass DOT edu
Subject: Re: Filemode change by windows applications
To: cygwin AT cygwin DOT com
References: <CAFeO1eoW52-4S4gD0=YL7g1YKsjjn9Jk8twV22e57HmmKQc5vg AT mail DOT gmail DOT com>
From: Eliot Moss <moss AT cs DOT umass DOT edu>
Message-ID: <06ceaabb-dd38-881b-c900-4c695e31e95a@cs.umass.edu>
Date: Wed, 28 Mar 2018 09:06:23 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0
MIME-Version: 1.0
In-Reply-To: <CAFeO1eoW52-4S4gD0=YL7g1YKsjjn9Jk8twV22e57HmmKQc5vg@mail.gmail.com>
X-IsSubscribed: yes

On 3/28/2018 3:09 AM, Kjetil Østerås wrote:

> I notice that when I edit and save a file in a windows application this
> file sometimes get the execute file permission set in cygwin. Some windows
> applications do this and some don't. For instance in my setup if i modify a
> .c file using Meld then the execute bit is set, however when I modify the
> same file with sublime text 3 then the execute bit is not set.
> 
> Why does this happen? and is there anything I can do to prevent windows
> applications from setting the execute bit on my files?

The Windows file permissions (access control) is substantially different
from the Posix model that Cygwin attempts to present.  The mapping from
Windows to Posix that Cygwin implements is arguably the best / most
reasonable mapping between the disparate schemes, and has been carefully
refined over time.  But it is just a mapping from the underlying scheme.

So, if some Windows program sets permissions a particular way, that it how
they show up under Cygwin.  To answer your question more directly: No, you
can't prevent a Windows program from setting (the underlying access modes
that translate to what is presented as) the execute bit under Cygwin -
short of preventing the programs from accessing the file altogether,
presumably not what you want.

File access translation is perhaps one of the roughest edges that Cygwin
*tries* to smooth over.  I think it does a good job with what it has, but
the Windows scheme is complex and there is no perfect way to do this.

Note, though, that there is no good way to prevent a Unix program from
setting execute bits on a particular file either (well, the umask, and
possibly ACLs may give you some control if you want to go to the bother).
It's just that Unix programs don't tend to set that bit unless they are
creating an executable.

Someone more versed in the Windows access control scheme and the intention
of various permissions might be able to clarify why some many Windows
programs think it is a good thing to set the access mode(s) that Cygwin
reflects as the x bit ...

Regards - Eliot Moss

--
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