public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH 0/1] Recognizing native Windows AF_UNIX sockets
Date: Sat, 30 Jan 2021 15:58:30 -0500	[thread overview]
Message-ID: <3adcb542-8f3a-1dc4-20d0-43551f52f67c@cornell.edu> (raw)
In-Reply-To: <20210130163436.21257-1-kbrown@cornell.edu>

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

  parent reply	other threads:[~2021-01-30 20:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-30 16:34 Ken Brown
2021-01-30 16:34 ` [PATCH 1/1] Cygwin: recognize native Windows AF_UNIX sockets as reparse points Ken Brown
2021-01-30 20:58 ` Ken Brown [this message]
2021-02-01  9:54 ` [PATCH 0/1] Recognizing native Windows AF_UNIX sockets Corinna Vinschen

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=3adcb542-8f3a-1dc4-20d0-43551f52f67c@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=cygwin-patches@cygwin.com \
    /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).