On 1/30/2021 11:34 AM, Ken Brown via Cygwin-patches wrote:
This patch attempts to fix the problem reported here:

   https://cygwin.com/pipermail/cygwin/2020-September/246362.html

See also the followup here:

   https://cygwin.com/pipermail/cygwin/2021-January/247666.html

The problem, briefly, is that on certain recent versions of Windows
10, including 2004 but not 1909, native Windows AF_UNIX sockets are
represented by reparse points that Cygwin doesn't recognize.  As a
result, tools like 'ls' and 'rm' don't work.

I will get access to a machine running 2004 so I can test my patch,
but I'm posting it now in case someone else wants to test it before I
can.  To test it, compile and run the program native_unix_socket.c
appended below, and then try to remove the file foo.sock that it
creates.  This should fail on W10 2004 without my patch, but it should
succeed like this with the patch:

I've just tested on W10 20H2.  In Cygwin 3.1.7 I see the problem:

$ ./native_unix_socket.exe
getsockname works
fam = 1, len = 11
offsetof clen = 9
strlen = 8
name = foo.sock

$ ls -l foo.sock
-rw-r----- 1 Unknown+User Unknown+Group 0 2021-01-30 15:51 foo.sock

$ rm foo.sock
rm: remove write-protected regular empty file 'foo.sock'? y
rm: cannot remove 'foo.sock': Permission denied

After I apply the patch, all is well:

$ ./native_unix_socket.exe
getsockname works
fam = 1, len = 11
offsetof clen = 9
strlen = 8
name = foo.sock

$ ls -l foo.sock
-rwxr-xr-x 1 kbrown None 0 2021-01-30 15:52 foo.sock*

$ rm foo.sock

$ ls -l foo.sock
ls: cannot access 'foo.sock': No such file or directory

Ken

Reply via email to