* chmod: unexpected results when uid = gid for a file
@ 2002-09-21 20:21 Matt Swift
2002-09-22 8:45 ` Pierre A. Humblet
0 siblings, 1 reply; 2+ messages in thread
From: Matt Swift @ 2002-09-21 20:21 UTC (permalink / raw)
To: cygwin
I have observed the following reproducible strange behavior of chmod.
You will notice that several of the commands do something different
than they would do on a Unix system (I've marked these commands with
"!!!" in the right margin). I think chmod is doing the wrong thing in
those cases, but possibly someone can explain why it is the desired
and documented thing.
My conjecture consistent with tests so far is that problems occur only
when a file's owner is the same as the file's group.
When I was trying to figure this out, I came across another question:
what is the "mask" that one can read/set with getfacl and setfacl? I
do not understand it and it does not seem to be documented anywhere.
[vav] test> umask
0000
[vav] test> alias d='ls -lAn'
[vav] test>
[vav] test> d
total 0
-rw-rw-rw- 1 500 544 0 Sep 21 19:11 a
-rw-rw-rw- 1 500 544 0 Sep 21 19:11 b
-rw-rw-rw- 1 500 544 0 Sep 21 19:11 c
-rw-rw-rw- 1 500 544 0 Sep 21 19:11 d
[vav] test> chmod o-w *; d
total 0
-rw-rw-r-- 1 500 544 0 Sep 21 19:11 a
-rw-rw-r-- 1 500 544 0 Sep 21 19:11 b
-rw-rw-r-- 1 500 544 0 Sep 21 19:11 c
-rw-rw-r-- 1 500 544 0 Sep 21 19:11 d
[vav] test> chmod g-w *; d
total 0
-rw-r--r-- 1 500 544 0 Sep 21 19:11 a
-rw-r--r-- 1 500 544 0 Sep 21 19:11 b
-rw-r--r-- 1 500 544 0 Sep 21 19:11 c
-rw-r--r-- 1 500 544 0 Sep 21 19:11 d
[vav] test> chmod go+w *; d
total 0
-rw-rw-rw- 1 500 544 0 Sep 21 19:11 a
-rw-rw-rw- 1 500 544 0 Sep 21 19:11 b
-rw-rw-rw- 1 500 544 0 Sep 21 19:11 c
-rw-rw-rw- 1 500 544 0 Sep 21 19:11 d
[vav] test> chown 544 *
[vav] test> d
total 0
-rw-rw-rw- 1 544 544 0 Sep 21 19:11 a
-rw-rw-rw- 1 544 544 0 Sep 21 19:11 b
-rw-rw-rw- 1 544 544 0 Sep 21 19:11 c
-rw-rw-rw- 1 544 544 0 Sep 21 19:11 d
[vav] test> chmod o-w *; d !!!
total 0
-rw-r--r-- 1 544 544 0 Sep 21 19:11 a
-rw-r--r-- 1 544 544 0 Sep 21 19:11 b
-rw-r--r-- 1 544 544 0 Sep 21 19:11 c
-rw-r--r-- 1 544 544 0 Sep 21 19:11 d
[vav] test> chmod g+w *; d !!!
total 0
-rw-r--r-- 1 544 544 0 Sep 21 19:11 a
-rw-r--r-- 1 544 544 0 Sep 21 19:11 b
-rw-r--r-- 1 544 544 0 Sep 21 19:11 c
-rw-r--r-- 1 544 544 0 Sep 21 19:11 d
[vav] test> chown 500 a b
[vav] test> d
total 0
-rw-r--r-- 1 500 544 0 Sep 21 19:11 a
-rw-r--r-- 1 500 544 0 Sep 21 19:11 b
-rw-r--r-- 1 544 544 0 Sep 21 19:11 c
-rw-r--r-- 1 544 544 0 Sep 21 19:11 d
[vav] test> chmod g+w *; d !!!
total 0
-rw-rw-r-- 1 500 544 0 Sep 21 19:11 a
-rw-rw-r-- 1 500 544 0 Sep 21 19:11 b
-rw-r--r-- 1 544 544 0 Sep 21 19:11 c
-rw-r--r-- 1 544 544 0 Sep 21 19:11 d
[vav] test> chmod go+w *; d
total 0
-rw-rw-rw- 1 500 544 0 Sep 21 19:11 a
-rw-rw-rw- 1 500 544 0 Sep 21 19:11 b
-rw-rw-rw- 1 544 544 0 Sep 21 19:11 c
-rw-rw-rw- 1 544 544 0 Sep 21 19:11 d
[vav] test> chmod a-w *; d
total 0
-r--r--r-- 1 500 544 0 Sep 21 19:11 a
-r--r--r-- 1 500 544 0 Sep 21 19:11 b
-r--r--r-- 1 544 544 0 Sep 21 19:11 c
-r--r--r-- 1 544 544 0 Sep 21 19:11 d
[vav] test> chmod u+w *; d
total 0
-rw-r--r-- 1 500 544 0 Sep 21 19:11 a
-rw-r--r-- 1 500 544 0 Sep 21 19:11 b
-rw-r--r-- 1 544 544 0 Sep 21 19:11 c
-rw-r--r-- 1 544 544 0 Sep 21 19:11 d
[vav] test> chmod o+w *; d !!!
total 0
-rw-r--rw- 1 500 544 0 Sep 21 19:11 a
-rw-r--rw- 1 500 544 0 Sep 21 19:11 b
-r--rw-rw- 1 544 544 0 Sep 21 19:11 c
-r--rw-rw- 1 544 544 0 Sep 21 19:11 d
[vav] test>
[vav] test> chmod --version
chmod (fileutils) 4.1
Written by David MacKenzie.
Copyright (C) 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[vav] test> bash --version
GNU bash, version 2.05b.0(5)-release (i686-pc-cygwin)
Copyright (C) 2002 Free Software Foundation, Inc.
[vav] test> uname -a
CYGWIN_NT-5.1 VAV 1.3.12(0.54/3/2) 2002-07-06 02:16 i686 unknown
[vav] test> echo $CYGWIN
binmode ntsec tty ntea
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: chmod: unexpected results when uid = gid for a file
2002-09-21 20:21 chmod: unexpected results when uid = gid for a file Matt Swift
@ 2002-09-22 8:45 ` Pierre A. Humblet
0 siblings, 0 replies; 2+ messages in thread
From: Pierre A. Humblet @ 2002-09-22 8:45 UTC (permalink / raw)
To: Matt Swift, cygwin
At 10:44 PM 9/21/2002 -0400, Matt Swift wrote:
>
>I have observed the following reproducible strange behavior of chmod.
>
>My conjecture consistent with tests so far is that problems occur only
>when a file's owner is the same as the file's group.
>
More precisely, uids and gids are mapped to internal Windows identifiers
called SIDs (stored in passwd and group). The phenomenon occurs when the
uid and the gid have the same SID.
Cygwin's file security system is based on Windows Access Control Lists
that allow and deny access rights for specific SIDs.
During an ls -l Cygwin reads the SIDS in the ACL of a file and see if they
correspond to the owner SID (first) or else group SID (second) and maps
then to the mode bits. If the SIDs are the same, the code for group isn't
run and "group" shows "other" (this is a simplified description).
Some of the cases you show can be improved (it's a display issue). However the
very fact that the uid and gid SIDs are the same is bound to cause problems,
for example when uid and gid have different permissions, so this situation
can't really be supported.
Unfortunately there are other cases where mode bits can't be mapped to ACLs.
Pierre
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-09-22 15:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-21 20:21 chmod: unexpected results when uid = gid for a file Matt Swift
2002-09-22 8:45 ` Pierre A. Humblet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).