This is the mail archive of the cygwin@cygwin.com 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]

chmod: unexpected results when uid = gid for a file


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/


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