Weird issue with file permissions

Ken Brown kbrown@cornell.edu
Fri Jul 1 19:01:54 GMT 2022


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 /cygdrive/g/cygwin/ but not if I created a subdirectory with the shell's mkdir command.
> 
>> Can you give us more information about where that error is coming from?  Are you
> 
> These are the relevant parts from strace (I think):
> 
> for "getfacl .socket" while in my $HOME:
> 
>     62   25757 [main] getfacl 33904 symlink_info::check: 0x0 = NtCreateFile (\??\C:\cygwin64\home\ANTON\.socket)
>     95   25852 [main] getfacl 33904 symlink_info::check: not a symlink
>     31   25883 [main] getfacl 33904 symlink_info::check: 0 = symlink.check(C:\cygwin64\home\ANTON\.socket, 0xFFFFB860) (mount_flags 0x30008, path_flags 0x20)
>     26   25909 [main] getfacl 33904 path_conv::check: this->path(C:\cygwin64\home\ANTON\.socket), has_acls(1)
>     28   25937 [main] getfacl 33904 build_fh_pc: fh 0x18035FE50, dev 001E0078
>     25   25962 [main] getfacl 33904 __set_errno: virtual __acl_t* fhandler_base::acl_get(acl_type_t):565 setting errno 134
> 
> for "getfacl .socket" while in /cygdrive/g/cygwin:
> 
>    114   29018 [main] getfacl 34007 symlink_info::check: 0x0 = NtCreateFile (\??\G:\cygwin\.socket)
>    194   29212 [main] getfacl 34007 symlink_info::check: not a symlink
>     30   29242 [main] getfacl 34007 symlink_info::check: 0 = symlink.check(G:\cygwin\.socket, 0xFFFFB8F0) (mount_flags 0x4020, path_flags 0x20)
>     45   29287 [main] getfacl 34007 path_conv::check: this->path(G:\cygwin\.socket), has_acls(1)
>     58   29345 [main] getfacl 34007 build_fh_pc: fh 0x18035FE40, dev 001E0078
>     37   29382 [main] getfacl 34007 stat_worker: (\??\G:\cygwin\.socket, 0xFFFFCB60, 0x18035FE40), file_attributes 36
>    212   29594 [main] getfacl 34007 transport_layer_pipes::connect: Try to connect to named pipe: \\.\pipe\cygwin-e022582115c10879-lpc
>    202   29796 [main] getfacl 34007 transport_layer_pipes::connect: Try to connect to named pipe: \\.\pipe\cygwin-e022582115c10879-lpc
>    205   30001 [main] getfacl 34007 transport_layer_pipes::connect: Try to connect to named pipe: \\.\pipe\cygwin-e022582115c10879-lpc
>    145   30146 [main] getfacl 34007 transport_layer_pipes::connect: Try to connect to named pipe: \\.\pipe\cygwin-e022582115c10879-lpc
>    175   30321 [main] getfacl 34007 fhandler_base::fstat_helper: 0 = fstat (\??\G:\cygwin\.socket, 0xFFFFCB60) st_size=54, st_mode=0140666, st_ino=1407374883583365st_atim=62BF3147.159B86B4 st_ctim=62BF3147.16341D34 st_mtim=62BF3147.16341D34 st_birthtim=62BF3147.159B86B4
>     52   30373 [main] getfacl 34007 stat_worker: 0 = (\??\G:\cygwin\.socket,0xFFFFCB60)
>     62   30435 [main] getfacl 34007 normalize_posix_path: src .socket
>     27   30462 [main] getfacl 34007 cwdstuff::get: posix /cygdrive/g/cygwin
>     33   30495 [main] getfacl 34007 cwdstuff::get: (/cygdrive/g/cygwin) = cwdstuff::get (0x800000010, 32768, 1, 0), errno 0
>     32   30527 [main] getfacl 34007 normalize_posix_path: /cygdrive/g/cygwin/.socket = normalize_posix_path (.socket)
>     25   30552 [main] getfacl 34007 mount_info::conv_to_win32_path: conv_to_win32_path (/cygdrive/g/cygwin/.socket)
>     28   30580 [main] getfacl 34007 mount_info::cygdrive_win32_path: src '/cygdrive/g/cygwin/.socket', dst 'G:\cygwin\.socket'
>     29   30609 [main] getfacl 34007 mount_info::conv_to_win32_path: src_path /cygdrive/g/cygwin/.socket, dst G:\cygwin\.socket, flags 0x4020, rc 0
>     56   30665 [main] getfacl 34007 symlink_info::check: 0x0 = NtCreateFile (\??\G:\cygwin\.socket)
>    128   30793 [main] getfacl 34007 symlink_info::check: not a symlink
>     55   30848 [main] getfacl 34007 symlink_info::check: 0 = symlink.check(G:\cygwin\.socket, 0xFFFFB860) (mount_flags 0x4020, path_flags 0x20)
>     35   30883 [main] getfacl 34007 path_conv::check: this->path(G:\cygwin\.socket), has_acls(1)
>     43   30926 [main] getfacl 34007 build_fh_pc: fh 0x18035FE40, dev 001E0078
>     36   30962 [main] getfacl 34007 __set_errno: virtual __acl_t* fhandler_base::acl_get(acl_type_t):565 setting errno 134

Thanks.  The problem is that fhandler_base::acl_get *always* returns ENOTSUP.  I 
think we need a method fhandler_socket_local::acl_get that calls 
fhandler_disk_file::acl_get on the underlying socket file when it should. 
(There's already a similar method, fhandler_socket_local::facl.)  I'll submit a 
patch to do that, and then getfacl should work on socket files.  I'm not sure 
what further work will be needed to deal with the problems you reported, but 
that's a first step.

Ken


More information about the Cygwin mailing list