From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by sourceware.org (Postfix) with ESMTPS id 37C813857036 for ; Wed, 23 Sep 2020 11:26:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 37C813857036 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08NBPEKS125050 for ; Wed, 23 Sep 2020 11:25:55 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 33q5rgg7pd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 23 Sep 2020 11:25:54 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08NBKQWu169629 for ; Wed, 23 Sep 2020 11:25:54 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 33nurugmgc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 23 Sep 2020 11:25:54 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 08NBPrJm018068 for ; Wed, 23 Sep 2020 11:25:53 GMT Received: from dhcp-10-175-42-101.vpn.oracle.com (/10.175.42.101) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 23 Sep 2020 04:25:53 -0700 From: Michael McMahon To: cygwin@cygwin.com Subject: Problems with native Unix domain sockets on Win 10/2019 Message-ID: <2b0aeab4-983d-e1d7-301f-edfeeb38cc85@oracle.com> Date: Wed, 23 Sep 2020 12:25:51 +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 Content-Type: multipart/mixed; boundary="------------85211EC9B374E51F51A86E54" Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9752 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 suspectscore=5 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009230091 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9752 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 impostorscore=0 clxscore=1011 suspectscore=5 phishscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 adultscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009230092 X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_MSPIKE_H2, 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: Wed, 23 Sep 2020 11:26:01 -0000 This is a multi-part message in MIME format. --------------85211EC9B374E51F51A86E54 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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. All the best, Michael McMahon --------------85211EC9B374E51F51A86E54 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="test.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="test.c" I2RlZmluZSBXSU4zMl9MRUFOX0FORF9NRUFOCgojaW5jbHVkZSA8d2luZG93cy5oPgojaW5j bHVkZSA8d2luc29jazIuaD4KI2luY2x1ZGUgPFdTMnRjcGlwLmg+CiNpbmNsdWRlIDxzdGRk ZWYuaD4KI2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxhZnVuaXguaD4KCiNkZWZpbmUg V0lOMzJfTEVBTl9BTkRfTUVBTgoKCmludCBfX2NkZWNsIG1haW4oaW50IGFyZ2MsIGNoYXIg KmFyZ3ZbXSkKewogICAgV1NBREFUQSB3c2FkYXRhOwogICAgc3RydWN0IHNvY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lbik7CiAgICAgICAgaW50IGNsZW4gPSBsZW4gLSBvZmZzZXRvZihzdHJ1Y3Qg c29ja2FkZHJfdW4sIHN1bl9wYXRoKTsKICAgICAgICBwcmludGYoIm9mZnNldG9mIGNsZW4g PSAlZFxuIiwgY2xlbik7CiAgICAgICAgcHJpbnRmKCJzdHJsZW4gPSAlemRcbiIsIHN0cmxl bihhZGRyLnN1bl9wYXRoKSk7CiAgICAgICAgcHJpbnRmKCJuYW1lID0gJXNcbiIsIGFkZHIu c3VuX3BhdGgpOwogICAgfQp9Cgo= --------------85211EC9B374E51F51A86E54--