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]

Re: chmod and DOS vs POSIX paths


I agree that the having an R/O attribute conflicts with the concept of ACLS; 
however, it is not true that the chmod command does not change this flag.
For example, 
if you chmod +w a file with the R/O flag 'set' the R/O flag is reset.
(maybe this is a side-effect of the ACL-based processing within windows?)
moreover, say you 'chmod +w FILE', then 'attrib +r FILE' ... ls -l FILE
shows the file as read-only ... 
that is, the R/O flag affects the permissions on the file and are reflected
in the cygwin/posix attributes 
(which makes good sense.)

so the current behavior is somewhat inconsistent, especially given that
chmod works differently depending upon whether it is 'given' a DOS or a
POSIX path. I.e., chmod will not set the r/o flag when working with a POSIX
path but will set it when working with an equivalent DOS path. Thus if you
use 'chmod' to make a file writable (thus resetting the r/o flag) and then
use chmod to make the file not writable using just POSIX paths - the r/o
flag has been changed.

from a cygwin/posix perspective, doesn't 'chmod a-w FILE' mean that the file
should not writable? and doesn't setting the 'r/o flag' (if supported by the
underlying file system) capture this concept better than some combination of
acl entries?

Given the various workarounds, this is not a significant issue, but it
surprised me when scripts that i have had working for years stopped working.


On Jan 25 07:55, brassrat wrote:
> 
> The source control package i use at work is sensitive to the 'read-only'
> attribute of Windows files.
> prior to 1.7, the command 'chmod -w DIR/FILE' worked fine.
> now, with 1.7, chmod -w FILE no longer sets the read-only attribute - i
> guess because 
> fortunately, there is a 'work-around': chmod -w 'DIR\FILE' (or chmod -w
> $(cygpath -w DIR/FILE))
> i.e., using a DOS path makes cygwin treat the file system as not having
> acls
> and i guess that kicks in the old behavior.
> 
> Is this the only way to change the 'read-only' attribute on windows files?
> Would it make sense for something like: chmod ugo-w DIR/FILE to set it?

The R/O attribute is really in the way on filesystems supporting ACLs
due to the way it's implemented.  Therefore, no, Cygwin will not return
to set the flag in calls to chmod.  The official workaround is, use
the Windows attrib command.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat



-- 
View this message in context: http://old.nabble.com/chmod-and-DOS-vs-POSIX-paths-tp27307971p27312068.html
Sent from the Cygwin list mailing list archive at Nabble.com.


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