From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by sourceware.org (Postfix) with ESMTPS id 0EBA83857C65 for ; Thu, 24 Sep 2020 12:03:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0EBA83857C65 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08OC3XaR164037; Thu, 24 Sep 2020 12:03:33 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 33qcpu4nhf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 24 Sep 2020 12:03:33 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08OBtURX124897; Thu, 24 Sep 2020 12:01:29 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 33nux2nhvd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Sep 2020 12:01:28 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 08OC1RaM015712; Thu, 24 Sep 2020 12:01:27 GMT Received: from dhcp-10-175-14-240.vpn.oracle.com (/10.175.14.240) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 24 Sep 2020 05:01:27 -0700 Subject: Re: Problems with native Unix domain sockets on Win 10/2019 To: Ken Brown , cygwin@cygwin.com References: <2b0aeab4-983d-e1d7-301f-edfeeb38cc85@oracle.com> From: Michael McMahon Message-ID: Date: Thu, 24 Sep 2020 13:01:25 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9753 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009240094 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9753 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 phishscore=0 spamscore=0 malwarescore=0 clxscore=1011 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009240095 X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Sep 2020 12:03:38 -0000 On 24/09/2020 12:26, Ken Brown wrote: > On 9/23/2020 7:25 AM, Michael McMahon via Cygwin wrote: >> Hi, >> >> I searched for related issues but haven't found anything. >> >> I am having some trouble with Windows native Unix domain sockets >> (a recent feature in Windows 10 and 2019 server) and Cygwin. >> I think I possibly know the cause since I had to investigate a similar >> looking issue on another platform built on Windows. >> >> The problem is that cygwin commands don't seem to recognise native Unix >> domain sockets correctly. For example, the socket "foo.sock" should >> have the same ownership and similar permissions to other files >> in the example below: >> >> $ ls -lrt >> total 2181303 >> >> -rw-r--r--  1 mimcmah      None             1259   Sep 23 10:22 test.c >> -rwxr-xr-x  1 mimcmah      None             3680   Sep 23 10:22 test.obj >> -rwxr-xr-x  1 mimcmah      None             121344 Sep 23 10:22 test.exe >> -rw-r-----  1 Unknown+User Unknown+Group         0 Sep 23 10:23 foo.sock >> -rw-r--r--  1 mimcmah      None             144356 Sep 23 10:27 check.ot >> >> A bigger problem is that foo.sock can't be deleted with the cygwin "rm" >> command. >> >> $ rm -f foo.sock >> rm: cannot remove 'foo.sock': Permission denied >> >> $ chmod 777 foo.sock >> chmod: changing permissions of 'foo.sock': Permission denied >> >> $ cmd /c del foo.sock >> >> But, native Windows commands are okay, as the third example shows. >> >> I think the problem may relate to the way native Unix domain sockets are >> implemented in Windows and the resulting special handling required. >> They are implemented as NTFS reparse points and when opening them >> with CreateFile, you need to specify the FILE_FLAG_OPEN_REPARSE_POINT >> flag. Otherwise, you get an ERROR_CANT_ACCESS_FILE. There are other >> complications unfortunately, which I'd be happy to discuss further. >> >> But, to reproduce it, you can compile the attached code snippet >> which creates foo.sock in the current directory. Obviously, this >> only works on recent versions of Windows 10 and 2019 server. > > Cygwin doesn't currently support native Windows AF_UNIX sockets, as > you've discovered.  See > > > https://urldefense.com/v3/__https://cygwin.com/pipermail/cygwin/2020-June/245088.html__;!!GqivPVa7Brio!P7lIFI4rYAtWh8_DtCbRCxT-M_E4vwQ0qwzQ0p656T73BpJ0jbUkLI_bXdA6mmSL9lJcSQ$ > > for the current state of AF_UNIX sockets on Cygwin, including the > possibility of using native Windows AF_UNIX sockets on systems that > support them. > > If all you want is for Cygwin to recognize such sockets and allow you to > apply rm, chmod, etc., I don't think it would be hard to add that > capability.  But I doubt if that's all you want. > > Further discussion of this will have to wait until Corinna is available. > Thanks for the info. It's mainly about recognition of sockets for regular commands. Since these objects can exist on Windows filesystems now, potentially created by any kind of Windows application, it would be great if Cygwin could handle them, irrespective of whether the Cygwin development environment does. Though that sounds like a good idea too. - Michael