delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/09/23/07:26:50

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 88BC5393C842
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1600860363;
bh=pEB66Cx6hl9xVIeQEAhpNvTvCO5FEhmI7vfRUGxKOrs=;
h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=VM1cjnOW7jK9XBDANNugX4izC66wIMkuAOvTPah0j6McYlxECz1TD/cRK0n4kVRiO
kKexO6PTiP5d4DjfgOzaAAH50LZ0SvXlNUd8ybbATTZRDNlsCVuxFDQXzcYyk0QujN
1tMvX1BGqdWbX25bMUz5UZEEWJFXGJ6uy0WFPxqQ=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 37C813857036
To: cygwin AT cygwin DOT 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
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 AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Michael McMahon via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Michael McMahon <michael DOT x DOT mcmahon AT oracle DOT com>
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

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
KmFyZ3ZbXSkKewogICAgV1NBREFUQSB3c2FkYXRhOwogICAgc3RydWN0IHNvY2thZGRyX3Vu
IGFkZHI7CiAgICBzb2NrbGVuX3QgbGVuOwogICAgaW50IHogPSBBRl9VTklYOwogICAgU09D
S0VUIHMsIHMwOwoKICAgIGlmIChXU0FTdGFydHVwKE1BS0VXT1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9mZnNldG9mIGNsZW4g
PSAlZFxuIiwgY2xlbik7CiAgICAgICAgcHJpbnRmKCJzdHJsZW4gPSAlemRcbiIsIHN0cmxl
bihhZGRyLnN1bl9wYXRoKSk7CiAgICAgICAgcHJpbnRmKCJuYW1lID0gJXNcbiIsIGFkZHIu
c3VuX3BhdGgpOwogICAgfQp9Cgo=
--------------85211EC9B374E51F51A86E54
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

--------------85211EC9B374E51F51A86E54--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019