delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 96FAD3944413 |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1601040009; | |
bh=BcuaqCtdo6G7rQqxYQmBr6y0T1IwN+XUt7EfNmTnS2w=; | |
h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: | |
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: | |
From; | |
b=yKS9zV2y9fHRFwBEGvqjLcQVpexX8/lYAVzD+ArigP/uVzH6+s3HjN1ZQDeMnM9b8 | |
Dmn/joprH9EihJj/4WiG1VHEagYkoqBUroP27urSSlL+ZpxKpQbBhs7D8u2lO2CwzU | |
46MfNMNBIoE+FtPFHvhsSpd1VXB3BlQWPXTGiJiM= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DMARC-Filter: | OpenDMARC Filter v1.3.2 sourceware.org 8D095398B164 |
ARC-Seal: | i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; |
b=aHzfFYNppLdEr930rSr+djLVwtZKt/Svt4onAwaxRDnCbyhlhZfp/W1zF13/wzhAUF01pDYsnADILi2wrqlbEdeTjh6oIPmyAdT1mpRvHNmDcVGguAmERc9pqOaGZtE9hfdONuruMAcq6xrEvdKqyYF7nYrZH4eBCdi1wuF/ycfkYQt3LwUF0P4bZmq4iAAboml3jPCRUNOCt7Pikg1Gt3Yqs4ljyGAVTJ51Rfve4lwwq1p/nee0pVRTJewJjv/qKX7K3evU0vRMaOV+SG/NjiE8eTDMdmsiRjZSgBQsIJ7YZ9CzcDGhCswuonLhWGxZvcndR8aSkxycbCcoiCaLYw== | |
ARC-Message-Signature: | i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; |
s=arcselector9901; | |
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; | |
bh=fXXJyg+BhWo1HeEl4YQNtsil1ZFJUPbGnY5jJehXF/Q=; | |
b=dmhEI3ZxRNfnweuHRy7Vwo8gU6lxzfwL8Q6Why55l5U8ng5XKPV4z5o5qL+w5gtPfogMOKH/FzI01GA9mZxdH5yDfpIYugQShhEEJZK4vGtb2BCmbxjGvYbW6s+aHiPcPzyIxoA0ErmeGY3Pz7obpQzSiyFVUEAdxuAhnsT331Abk4rCH1qw5QDpO6XhoI0+emlxroerUUsrn4oWknC6adSlXT71/OWXR0oFlzYF76yM21PvOUq2KHiT5KOsQWlM247vOCGX2rs6EhWdAgbiKmpjRbS/GtXtd3GWmAqtdPZKsg2CVaP5M5dYO0yAmoLOYg+LVNYcitgmTWVROae6dA== | |
ARC-Authentication-Results: | i=1; mx.microsoft.com 1; spf=pass |
smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; | |
dkim=pass header.d=cornell.edu; arc=none | |
Subject: | Re: Problems with native Unix domain sockets on Win 10/2019 |
To: | Michael McMahon <michael DOT x DOT mcmahon AT oracle DOT com>, cygwin AT cygwin DOT com |
References: | <2b0aeab4-983d-e1d7-301f-edfeeb38cc85 AT oracle DOT com> |
<db0f2634-328c-baaa-1cdb-5bd3c145c9e0 AT cornell DOT edu> | |
<bb34a767-0cb5-1d48-7f9b-ad914762f9f7 AT oracle DOT com> | |
Message-ID: | <97d2b3af-224a-6873-fb4a-55a0ae9cd379@cornell.edu> |
Date: | Fri, 25 Sep 2020 09:19:57 -0400 |
User-Agent: | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 |
Thunderbird/68.12.0 | |
In-Reply-To: | <bb34a767-0cb5-1d48-7f9b-ad914762f9f7@oracle.com> |
X-Originating-IP: | [68.175.129.7] |
X-ClientProxiedBy: | CH2PR20CA0019.namprd20.prod.outlook.com |
(2603:10b6:610:58::29) To MN2PR04MB6176.namprd04.prod.outlook.com | |
(2603:10b6:208:e3::13) | |
MIME-Version: | 1.0 |
X-MS-Exchange-MessageSentRepresentingType: | 1 |
X-MS-PublicTrafficType: | |
X-MS-Office365-Filtering-Correlation-Id: | 4e98fde9-0b32-4df7-dc23-08d86155b45d |
X-MS-TrafficTypeDiagnostic: | MN2PR04MB5838: |
X-Microsoft-Antispam-PRVS: | <MN2PR04MB5838D8A79827ECAD011C8DAFD8360 AT MN2PR04MB5838 DOT namprd04 DOT prod DOT outlook DOT com> |
X-MS-Oob-TLC-OOBClassifiers: | OLM:9508; |
X-MS-Exchange-SenderADCheck: | 1 |
X-Microsoft-Antispam: | BCL:0; |
X-Microsoft-Antispam-Message-Info: | xRuLs7JvMZxmdfmwxb3EMiJrISiFBw/YJ2okXLDmlfxx0MGebqE6PgxwaMUob2zXBiJCD8SRa+vadEp4xlVEtrmLhif2EJWUTNBCeG16r9ar0zFnPTjUW48oNOoUQv9R+ygCypoAu8kCqA2pvSImEymRUjxRyDMGBD5HnLdePb+BwWBRHfLdxKm3YFKk0DamWYhbW8UQmA52YeJ6mR44CyU+TUC+meiidolDJ8pkT6ANM6zAfFO+fBK4yJSwM173pBTMPUIXRK7NnDzC45m6z9xD+hIukBfdz5omDZTNvXjdvIHkD4rtANPxiTPg09qSm/H/UtgEEh2GHbkZMn53WbHpCMbpk3SuXdM3V0TUd2oK9AhitEqrjY6W/NMkUx8VglYvS5ZB8PnDbDZtX8lDZUDtWlXJKGhzGYxmDl3oV8Yzmo5PL/GgXBsQQoUOyIT3VzOphjXzhMV8Mhkw4emwlL1nOPWUKPa6nc0P2VLC/G0= |
X-Forefront-Antispam-Report: | CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; |
IPV:NLI; SFV:NSPM; H:MN2PR04MB6176.namprd04.prod.outlook.com; PTR:; CAT:NONE; | |
SFS:(4636009)(396003)(346002)(376002)(136003)(39860400002)(366004)(66476007)(26005)(83380400001)(956004)(235185007)(66556008)(5660300002)(186003)(86362001)(786003)(16576012)(8676002)(31686004)(66946007)(75432002)(31696002)(66616009)(2616005)(316002)(52116002)(33964004)(53546011)(478600001)(36756003)(66574015)(6486002)(2906002)(16526019)(8936002)(966005)(43740500002)(460985005); | |
DIR:OUT; SFP:1102; | |
X-MS-Exchange-AntiSpam-MessageData: | e/x0TUmR8IPDT+F3LABYerHVmzO+VtB1WJ4/x8hDPA4Vth2aQ5J31Kr+mU2yoIsy/Kaj/Ubv4O8VLc7GIvP8qqQP0Px5iVRox/a/mhIn/c5z8mVKNttRNjDpvO9NaMMEqaUMqp/aKNYDWCuzEghivD6DhNVcxKa/0LkLNWIKaDE+p/ZwHvpGndua2MJ6d3LYtL40EZb88BwaxJ/kAGhSsf0QyrLwx3aUpygs+EwpN7EWcQK5bzbHtMF03rgcyBOXp6OgWamt4XfmLkufVeP+DuFrt8r5RDxA/O6tsL6LhI/ee2MfIZLDCIW80xlYIVFyZMix5jD7zIEoxIJ1jBdlcx/kBdxYPBWRkXUWm8gkgTOjF1REpLJPvHPQPczAJOJIww4CvGk78K0O3hNmJ9STTYTNSqda0wlZW5dadJzPMeI+sBrEHN4LeBqP5sGbHL2N53C2jwgeQDHmziKJlNztdSoZqXGsoBSy6Z3/WJG+xK+26gM0WPt7BKw2VvRHDVsi6HR0/lM8voZUQmLD+uBMFRjn7t2tEYq5pR4gMQU6/IOCNx0uLDXLKA7IwTMR6VXNWo1QYpj9oqh+OJ+hCWOv3ZDtMNTk70mL+8BjH216iaIrhVXYMx0wLyT2nnhRxYdcANtom1nKapGKri4sov9fCA== |
X-OriginatorOrg: | cornell.edu |
X-MS-Exchange-CrossTenant-Network-Message-Id: | 4e98fde9-0b32-4df7-dc23-08d86155b45d |
X-MS-Exchange-CrossTenant-AuthSource: | MN2PR04MB6176.namprd04.prod.outlook.com |
X-MS-Exchange-CrossTenant-AuthAs: | Internal |
X-MS-Exchange-CrossTenant-OriginalArrivalTime: | 25 Sep 2020 13:20:00.1358 (UTC) |
X-MS-Exchange-CrossTenant-FromEntityHeader: | Hosted |
X-MS-Exchange-CrossTenant-Id: | 5d7e4366-1b9b-45cf-8e79-b14b27df46e1 |
X-MS-Exchange-CrossTenant-MailboxType: | HOSTED |
X-MS-Exchange-CrossTenant-UserPrincipalName: | 3JGXJduL2mMksSLHefr/7U7ILUH5fLe5oZFJa38aSoV6zuTMPBGnNMTrQvV1JW3QduErVUB/UY96atI7fRBXhg== |
X-MS-Exchange-Transport-CrossTenantHeadersStamped: | MN2PR04MB5838 |
X-Spam-Status: | No, score=-5.5 required=5.0 tests=BAYES_00, BODY_8BITS, |
DKIM_INVALID, DKIM_SIGNED, GIT_PATCH_0, KAM_DMARC_STATUS, | |
MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, | |
SPF_HELO_PASS, SPF_PASS, TXREP 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-Unsubscribe: | <https://cygwin.com/mailman/options/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe> | |
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: | Ken Brown via Cygwin <cygwin AT cygwin DOT com> |
Reply-To: | Ken Brown <kbrown AT cornell DOT edu> |
Errors-To: | cygwin-bounces AT cygwin DOT com |
Sender: | "Cygwin" <cygwin-bounces AT cygwin DOT com> |
--------------6FB35293F6054A5EB30F35C9 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable On 9/24/2020 8:01 AM, Michael McMahon wrote: >=20 >=20 > 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 simila= r >>> looking issue on another platform built on Windows. >>> >>> The problem is that cygwin commands don't seem to recognise native Un= ix >>> 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--=A0 1 mimcmah=A0=A0=A0=A0=A0 None=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 1259=A0=A0 Sep 23 10:22 test.c >>> -rwxr-xr-x=A0 1 mimcmah=A0=A0=A0=A0=A0 None=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 3680=A0=A0 Sep 23 10:22 test.obj >>> -rwxr-xr-x=A0 1 mimcmah=A0=A0=A0=A0=A0 None=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 121344 Sep 23 10:22 test.exe >>> -rw-r-----=A0 1 Unknown+User Unknown+Group=A0=A0=A0=A0=A0=A0=A0=A0 0 = Sep 23 10:23 foo.sock >>> -rw-r--r--=A0 1 mimcmah=A0=A0=A0=A0=A0 None=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 144356 Sep 23 10:27 check.ot >>> >>> A bigger problem is that foo.sock can't be deleted with the cygwin "r= m" >>> 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 yo= u've=20 >> discovered.=A0 See >> >> https://urldefense.com/v3/__https://cygwin.com/pipermail/cygwin/2020-J= une/245088.html__;!!GqivPVa7Brio!P7lIFI4rYAtWh8_DtCbRCxT-M_E4vwQ0qwzQ0p65= 6T73BpJ0jbUkLI_bXdA6mmSL9lJcSQ$=20 >> >> for the current state of AF_UNIX sockets on Cygwin, including the poss= ibility=20 >> 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=20 >> rm, chmod, etc., I don't think it would be hard to add that capability= .=A0 But I=20 >> doubt if that's all you want. >> >> Further discussion of this will have to wait until Corinna is availabl= e. >> >=20 > 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. I think this has a simple fix (attached), but I can't easily test it beca= use=20 your test program doesn't compile for me. First, I got $ gcc -o native_unix_socket native_unix_socket.c native_unix_socket.c:5:10: fatal error: WS2tcpip.h: No such file or direc= tory 5 | #include <WS2tcpip.h> | ^~~~~~~~~~~~ compilation terminated. I fixed this by making the include file name lower case. (My system is c= ase=20 sensitive, so it matters.) Next: $ gcc -o native_unix_socket native_unix_socket.c native_unix_socket.c:8:10: fatal error: afunix.h: No such file or directo= ry 8 | #include <afunix.h> | ^~~~~~~~~~ compilation terminated. There's no file afunix.h in the Cygwin distribution, but I located it onl= ine and=20 pasted in the contents. The program now compiles but fails to link: $ gcc -o native_unix_socket native_unix_socket.c /usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld:=20 /tmp/cc74urPr.o:native_unix_socket.c:(.text+0x3b): undefined reference to= =20 `__imp_WSAStartup' /tmp/cc74urPr.o:native_unix_socket.c:(.text+0x3b): relocation truncated t= o fit:=20 R_X86_64_PC32 against undefined symbol `__imp_WSAStartup' /usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld:=20 /tmp/cc74urPr.o:native_unix_socket.c:(.text+0xf2): undefined reference to= =20 `__imp_WSAGetLastError' /tmp/cc74urPr.o:native_unix_socket.c:(.text+0xf2): relocation truncated t= o fit:=20 R_X86_64_PC32 against undefined symbol `__imp_WSAGetLastError' /usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld:=20 /tmp/cc74urPr.o:native_unix_socket.c:(.text+0x13d): undefined reference t= o=20 `__imp_WSAGetLastError' /tmp/cc74urPr.o:native_unix_socket.c:(.text+0x13d): relocation truncated = to fit:=20 R_X86_64_PC32 against undefined symbol `__imp_WSAGetLastError' collect2: error: ld returned 1 exit status This is probably easy to fix too, but I don't feel like tracking it down.= =20 Please send compilation instructions (that use Cygwin tools). Ken --------------6FB35293F6054A5EB30F35C9 Content-Type: text/plain; charset=UTF-8; name="0001-Cygwin-recognize-native-Windows-AF_UNIX-sockets.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Cygwin-recognize-native-Windows-AF_UNIX-sockets.patch" From 5549952dba88d506b8b28425f8dcb8348446905d Mon Sep 17 00:00:00 2001 From: Ken Brown <kbrown AT cornell DOT edu> Date: Fri, 25 Sep 2020 08:30:26 -0400 Subject: [PATCH] Cygwin: recognize native Windows AF_UNIX sockets These are represented by reparse points with reparse tag IO_REPARSE_TAG_AF_UNIX. check_reparse_point_target now returns PATH_REP on files of this type, so that they are treated as known reparse points (but not as sockets). This allows tools like 'rm', 'ls', etc. to operate on these files. Also fix the comment preceding check_reparse_point_target to more accurately describe the return value. Addresses: https://cygwin.com/pipermail/cygwin/2020-September/246362.html --- winsup/cygwin/path.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 1d0c38a20..dd33e2847 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -2475,8 +2475,8 @@ check_reparse_point_string (PUNICODE_STRING subst) /* Return values: <0: Negative errno. - 0: No symlink. - 1: Symlink. + 0: Not a recognized reparse point. + >0: path_flags for known reparse point. */ int check_reparse_point_target (HANDLE h, bool remote, PREPARSE_DATA_BUFFER rp, @@ -2617,6 +2617,9 @@ check_reparse_point_target (HANDLE h, bool remote, PREPARSE_DATA_BUFFER rp, } return -EIO; } + else if (rp->ReparseTag == IO_REPARSE_TAG_AF_UNIX) + /* Native Windows AF_UNIX socket; treat as ordinary file. */ + return PATH_REP; #ifdef __WITH_AF_UNIX else if (rp->ReparseTag == IO_REPARSE_TAG_CYGUNIX) { -- 2.28.0 --------------6FB35293F6054A5EB30F35C9 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 --------------6FB35293F6054A5EB30F35C9--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |