From: Ken Brown <kbrown@cornell.edu>
To: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" <lavr@ncbi.nlm.nih.gov>,
"cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: Re: Weird issue with file permissions
Date: Sat, 2 Jul 2022 10:43:17 -0400 [thread overview]
Message-ID: <55a916bd-92ad-e3ba-1e5b-9be00debc80e@cornell.edu> (raw)
In-Reply-To: <DM8PR09MB70951D58CC3208CB938D56B4A5BC9@DM8PR09MB7095.namprd09.prod.outlook.com>
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
next prev parent reply other threads:[~2022-07-02 14:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-02 3:23 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-07-02 14:43 ` Ken Brown [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-07-03 1:51 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-07-02 16:16 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-07-02 18:41 ` Ken Brown
2022-07-01 22:11 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-07-01 23:16 ` Ken Brown
2022-07-01 18:00 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-07-01 19:01 ` Ken Brown
2022-07-01 20:59 ` Ken Brown
2022-07-01 5:46 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-07-01 17:03 ` Ken Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55a916bd-92ad-e3ba-1e5b-9be00debc80e@cornell.edu \
--to=kbrown@cornell.edu \
--cc=cygwin@cygwin.com \
--cc=lavr@ncbi.nlm.nih.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).