Weird issue with file permissions

Ken Brown kbrown@cornell.edu
Fri Jul 1 17:03:54 GMT 2022


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-rw-+ 1 ANTON None 0 Jul  1 01:19 .socket=
> 
> However, if I run it elsewhere (different drive "cd /cygdrive/g/cygwin" -- it's NOT where Cygwin is installed,
> just a folder that keeps files for Cygwin development, the installation is on C:\Cygwin64), I cannot predict
> the results.  What's weird is that fstat and stat report different file modes.
> 
> $ pwd
> /cygdrive/g/cygwin
> $ ~/sun
> fstat mode = 140666
> stat mode = 140666
> $ ls -l .socket
> srw-rw-rw-+ 1 ANTON None 0 Jul  1 01:24 .socket=
> 
> So all's good here, BUT:
> 
> $ mkdir subdir
> $ cd subdir
> $ pwd
> /cygdrive/g/cygwin/subdir
> $ ~/sun
> fstat mode = 140666
> stat mode = 140664
> $ ls -l .socket
> srw-rw-r--+ 1 ANTON None 0 Jul  1 01:25 .socket=
> 
> Note that fstat lied!
> 
> For some reason getfacl returns "Not supported", so I could not investigate with that

Can you give us more information about where that error is coming from?  Are you 
able to run getfacl under gdb and show us a backtrace from that point?  I often 
find it helpful to first run the program under strace in order to locate the 
source of the error, so I know where to set a breakpoint in gdb.

And what can you tell us about the drive /cygdrive/g?  The failure of getfacl 
suggests that Cygwin thinks the drive doesn't support ACLs, in which case it 
might just be faking permissions (lying).

Ken


More information about the Cygwin mailing list