RE: Weird issue with file permissions

2022-07-02 Thread Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin
> That's not what I'm seeing when I run your test program on Linux: > > $ ./sun > fstat mode = 140666 > stat mode = 140777 True, but it creates the socket file with exactly how umask(0) told it to, and stat() shows that. So yeah, I should retract that it works on Linux with fchmod() -- on Linux

Re: [EXTERNAL] Re: Weird issue with file permissions

2022-07-02 Thread Andrey Repin
Greetings, Lavrentiev, Anton (NIH/NLM/NCBI) [C]! >> what your test program was actually doing. But you seem to be assuming that >> calling fchmod on a socket descriptor should affect the permissions on the >> socket file (assuming the socket is bound). Is that documented anywhere? >> POSIX >>

Re: [EXTERNAL] Re: Weird issue with file permissions

2022-07-02 Thread Ken Brown
On 7/2/2022 3:37 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote: what your test program was actually doing. But you seem to be assuming that calling fchmod on a socket descriptor should affect the permissions on the socket file (assuming the socket is bound). Is that documented anywhere? POSIX

RE: [EXTERNAL] Re: Weird issue with file permissions

2022-07-02 Thread Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin
> what your test program was actually doing. But you seem to be assuming that > calling fchmod on a socket descriptor should affect the permissions on the > socket file (assuming the socket is bound). Is that documented anywhere? > POSIX > says that the behavior of fchmod on a socket descriptor

Re: Weird issue with file permissions

2022-07-02 Thread Ken Brown
On 7/2/2022 12:16 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote: I forgot to mention that my "umask" is the standard 022... The man page says that for directories with the ACLs, it is ignored. So in my code bind() wouldn't have created the socket with 0777, and that's fine! Which is why I cal

RE: Weird issue with file permissions

2022-07-02 Thread Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin
I forgot to mention that my "umask" is the standard 022... The man page says that for directories with the ACLs, it is ignored. So in my code bind() wouldn't have created the socket with 0777, and that's fine! Which is why I call fchmod() to fix the permissions up, and THAT does not work. BTW,

Re: Weird issue with file permissions

2022-07-02 Thread Ken Brown
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 create

RE: Weird issue with file permissions

2022-07-01 Thread Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin
> 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

Re: Weird issue with file permissions

2022-07-01 Thread Ken Brown
On 7/1/2022 6:11 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote: Cygwin does not do this on a standard installation. Is it something you've done I did use the standard Setup and nothing else... My $HOME looks fine, too: $ cd $ pwd /home/ANTON $ getfacl . # file: . # owner: ANTON # group: Non

RE: Weird issue with file permissions

2022-07-01 Thread Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin
> Cygwin does not do this on a standard installation. Is it something you've > done I did use the standard Setup and nothing else... My $HOME looks fine, too: $ cd $ pwd /home/ANTON $ getfacl . # file: . # owner: ANTON # group: None user::rwx group::--- other::--- default:user::rwx default:gro

Re: Weird issue with file permissions

2022-07-01 Thread Ken Brown
On 7/1/2022 2:00 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote: Lastly, I forgot to list all the involved directories as they look from under Cygwin with their permissions, if that's of any help: $ ls -ld ~ ~/.socket ~/subdir ~/subdir/.socket drwx--+ 1 ANTON None 0 Jul 1 13:36 /home/ANTON

Re: Weird issue with file permissions

2022-07-01 Thread Ken Brown
On 7/1/2022 2:00 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote: getfacl does not work even for the .socket "file" in my home directory for which ~/sun works perfectly fine with permissions (and all subdirectories crated with mkdir under it). Also like I said, ~/sun also works perfectly fine in

RE: Weird issue with file permissions

2022-07-01 Thread Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin
getfacl does not work even for the .socket "file" in my home directory for which ~/sun works perfectly fine with permissions (and all subdirectories crated with mkdir under it). Also like I said, ~/sun also works perfectly fine in /cygdrive/g/cygwin/ but not if I created a subdirectory with the

Re: Weird issue with file permissions

2022-07-01 Thread Ken Brown
On 7/1/2022 1:46 AM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin wrote: Now, if I run this code in my Cygwin home directory (and any directory that I create using "mkdir..." under it), I am getting the expected results: $ ~/sun fstat mode = 140666 stat mode = 140666 $ ls -l .socket srw-rw-

Weird issue with file permissions

2022-06-30 Thread Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin
Hi all, I am having an issue with socket file permissions... So here's a mockup of code that shows the problem: $ cat sun.c #include #include #include #include #include #include #include #define SOCKET "./.socket" int main() { struct sockaddr_un addr; struct stat st; mode_t