On 7/1/2022 11:23 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote:
That way I'm sure I won't have any surprises with permissions when working in
/cygdrive/g/cygwin. Do you want to try that and see if it makes a difference?
I have no problems with /cygdrive/g/cygwin -- my socket file gets created there
with proper
permissions and reported so, too (both fstat and stat).
Right, I understood that. But the (default) ACL on that directory influences
the ACL on subdirectories that are created. And there's also interaction between
the default ACL and the umask
(https://man7.org/linux/man-pages/man2/umask.2.html). So I think it couldn't
hurt to try my suggestion and then see if you continue to see weird behavior on
newly created subdirectories.
I just tried this myself on an external hard drive on which I've never touched
the permissions on the top-level directory. I do see some weirdness (though not
as extreme as yours), and the weirdness goes away when I change the ACL as I
suggested you do. Here's what I see. [Note: I use /mnt as the cygdrive prefix.]
$ pwd
/mnt/d
$ getfacl .
# file: .
# owner: Administrators
# group: Unknown+Group
user::---
group::rwx #effective:---
group:SYSTEM:rwx #effective:---
mask::---
other::rwx
default:user::rwx
default:group::---
default:group:SYSTEM:rwx #effective:---
default:mask::---
default:other::rwx
$ mkdir cygwin
$ cd cygwin/
$ getfacl .
# file: .
# owner: kbrown
# group: None
user::rwx
group::r-x
group:SYSTEM:rwx #effective:r-x
mask::r-x
other::r-x
default:user::rwx
default:group::r-x
default:group:SYSTEM:rwx #effective:r-x
default:mask::r-x
default:other::rwx
$ ./sun
fstat mode = 140666
stat mode = 140646
$ ls -l .socket
srw-r--rw- 1 kbrown None 0 2022-07-02 09:47 .socket=
$ mkdir sub
$ cd sub
$ ../sun.exe
fstat mode = 140666
stat mode = 140646
$ ls -l .socket
srw-r--rw- 1 kbrown None 0 2022-07-02 09:49 .socket=
$ cd ..
$ getfacl ~ | setfacl -f - .
$ getfacl .
# file: .
# owner: kbrown
# group: None
user::rwx
group::r-x
other::r-x
default:user::rwx
default:group::r-x
default:other::r-x
$ mkdir sub1
$ cd sub1
$ ../sun.exe
fstat mode = 140666
stat mode = 140666
$ ll .socket
srw-rw-rw- 1 kbrown None 0 2022-07-02 10:04 .socket=
Note that stat and fstat disagreed at first but then agreed after I put a
standard ACL on the cygwin directory.
Having said all that, I still want to look into why stat and fstat disagree.
Ken
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple