From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-eopbgr770123.outbound.protection.outlook.com [40.107.77.123]) by sourceware.org (Postfix) with ESMTPS id 0F4913851C3E for ; Tue, 24 Nov 2020 20:07:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0F4913851C3E ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=glqyInYXqVMJJfbjOgyUa2+6S2qJ1EIEk5fW17hv0HjLhlzUm1HGVX+hirw9L+GYR6aBkldXZ6v/kV5LaIVZV1nlj6TWyaVquylslpXiq0XkiW8sS341YYfzZ4nbBxPCE/HSl47WFa1X9+B6o1rItzMl61V8Tfjp3PZyoMOZ5x30DqaFms2323LnXeNKAQbyFuyfvCYVV7RqqT9JzvW/nQH0jc09aM3B2WXQac1ulalEtE72gZ/LXT3cm0NJF6aw9MYzvjX660Y74la7z0tqgoO4EFNwsJ3O0Q7O73b5Cahet/6MRqJUz1Dj62FL8HW0fC9gnzFaQ13qabbqVuE6UA== 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=/xzn/l0Ou1FsRAtTydrBVWviVh5mcXjHwa9j+e6onoo=; b=ckGU/phUanoXkjqb+EYiNYAvqvtkSnu0T+w0VMrmgFbB3HBkdRlNtpk9F5bNpcjKZ0OCrbcnw29/kAHX3kik9rTDw7fJ2RlQMIIOffv4eDLuGfvM1ac/4H/PgqZwMkRzNBYCpVcbiSr64tr4omd6ROhxetU1aBAwa8YqNgsws1Nq1LsM0xsnJSh71krtXTdEdmQ4cyZngwZ6gPhScRu5jvwoOGS0QDKEQHVrYMBE7KnoGcxdd4wEFNTngaXPILPCqR7Ck7igE9RK8ueed1b9GzkXqxONOGp5Jo11Wv/FTPiJMe3uaThcCPQyFHYS8mMOWNOeTCpCfeaKFDCthYpMoA== 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 Received: from MN2PR04MB6176.namprd04.prod.outlook.com (2603:10b6:208:e3::13) by MN2PR04MB5917.namprd04.prod.outlook.com (2603:10b6:208:3c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.21; Tue, 24 Nov 2020 20:06:58 +0000 Received: from MN2PR04MB6176.namprd04.prod.outlook.com ([fe80::113e:c874:1207:eca8]) by MN2PR04MB6176.namprd04.prod.outlook.com ([fe80::113e:c874:1207:eca8%6]) with mapi id 15.20.3589.030; Tue, 24 Nov 2020 20:06:58 +0000 Subject: Re: Sv: Sv: Sv: Sv: Sv: g++ and c++17 filesystem To: sten.kristian.ivarsson@gmail.com, moss@cs.umass.edu, 'Jonathan Yong' <10walls@gmail.com>, 'The Cygwin Mailing List' References: <000a01d6be5b$3808cad0$a81a6070$@gmail.com> <87a2c99c-045c-e815-4c03-bab7a89a025b@cs.umass.edu> <000201d6bf17$7cc4beb0$764e3c10$@gmail.com> <9e881c01-e883-ecd5-883a-e1ac55c740c7@gmail.com> <000601d6c173$aa55d540$ff017fc0$@gmail.com> <000a01d6c244$b64bbd70$22e33850$@gmail.com> <237eacd5-a1bf-da6a-2ee6-f2df945f125b@cs.umass.edu> <000501d6c26e$73e1d760$5ba58620$@gmail.com> From: Ken Brown Message-ID: <11a20f55-46db-c9b4-1f30-d2181a3aeb9e@cornell.edu> Date: Tue, 24 Nov 2020 15:06:57 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 In-Reply-To: <000501d6c26e$73e1d760$5ba58620$@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [68.175.129.7] X-ClientProxiedBy: BL1PR13CA0094.namprd13.prod.outlook.com (2603:10b6:208:2b9::9) To MN2PR04MB6176.namprd04.prod.outlook.com (2603:10b6:208:e3::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.0.17] (68.175.129.7) by BL1PR13CA0094.namprd13.prod.outlook.com (2603:10b6:208:2b9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.15 via Frontend Transport; Tue, 24 Nov 2020 20:06:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 85c9b60b-1c2a-4a06-b055-08d890b47fd1 X-MS-TrafficTypeDiagnostic: MN2PR04MB5917: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: if/d8lTuoYFSArj7ImvaKFyougMuUhTD7yTYZJXpY/BuhOWnbM7PWaKYMYzydH2ZGbx15F7XvlQN36j/t8aPN2DraqfDaGR3R4kDuHjYJpNaUM5glHveD06rAIhrxUGSb/PxsDHXDcasATbTpQt/HuMDH0fr3HgmraskZr/DnlAkZX1GIOB02DT/VZtUteXishOgkbn0n2FK4+J5Kfh0lYyUHEyvPajFCONqdeFK2Uh1geEjJfdDxdZ/4rVBZUfqADPfTipiHb+sIM5bCxKpsVWcMoLx3j6KFi2sLRvMOQGCbIsyDrQEO1HrnJNXunLsnb5N9RzP7dQSo66gvwUwHaJ/25nghuCY0cK9/ay2KE+EJdZn05xCMEVucd0YCiMeq7/No9wQUNr7VRhAnbNQxRGMErTJyU52bXYxKz3tVFBERO4XlUguXCCezDbmA187ke1I+obNX8/bLuNtfbfdVg== 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)(39860400002)(376002)(396003)(136003)(366004)(346002)(6486002)(8936002)(83380400001)(2906002)(8676002)(31686004)(5660300002)(66476007)(66556008)(75432002)(52116002)(966005)(31696002)(186003)(26005)(16526019)(66946007)(86362001)(110136005)(956004)(316002)(2616005)(786003)(36756003)(478600001)(16576012)(53546011)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 8KrGz4ktzMDiAZJ824BhnOEGSumXttmSpcp6Hr3LpZz9oLUgPLFs+ql63TRBSsP0PmBa1WaFxqGSkUX9OXk/dUUoVcCafeGAUTU6QPRgj52TRiVdBcfTQXMTGIi9nqdME0a55j/T517HGgeAazxmmqcswSk9YfGapqYn5yumBQ2rZO+4QVHwHXniewoWS0TJGVxmvphgoTElTXSL8IaBV5lgHFRywjMOMNJ7kSxDCY8soThaANJhBLczoNTT9pu8JBO2z4v9ZqZ0yNLRCalo87UOVxKB0kJfkso7P1GT/5kSUK1NlUXH20sFUhVD9lReajPb5JeEkjbKQFqbMN0RLsn5IscseLB+59j1Bf/dX2Ax8EAFYWYuAQRuGtNvYp5bA8j0eHlUATLEQrszcMUPR6Op/iTAJQuEdieU2pteVzw+sCCuR917YnTc701xfj1di1wj5g5FX1NYI3WdoTtYMDnFaWPcYRsvfjI0pyeWUs11XErjsVEniY9DVIhXLXa2T3SuXz80hwHok9EPsM8JraOVr0NGUGR2PdiCaGE0oE6lJxiJC+peKA23N1XEciWOS9HJnKgpE8NM1x+kUWeVjYyygYGQNbAb3oGPnRE8khaLwrVg1urFuybhzpln0gxP+PpzvnqpilYArNFulcF0ruiAQ/6JNlbr+flutNCMp4I/zpXVTBTuybZY73f1OCxyQ2AQ0B+bYCxiyu+H81i+TpQkIrZR2SznE9O7KciACAVx/cLtuN6cSbHWxu6TRWykg7a36LSl4QPI/O04Dg1prsMyrbuvcD1qOg5IUFDCkhQmhwVKl85E7Wk88FTtzJLEW5KW/543rLK18ariji03n0is5elLESWPtSmYxsIr6DsgDzqtSXPkH6sdcli+kKcIc2W/G9FLVnxofqKDlj5qyQ== X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 85c9b60b-1c2a-4a06-b055-08d890b47fd1 X-MS-Exchange-CrossTenant-AuthSource: MN2PR04MB6176.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2020 20:06:58.7675 (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: znNE61oTmQntWB0OazsveraBxSEewu4tG+ZAxS9BMmFz/vVZfiXcQANkp8byUN21Pn6yT3+iqRtbt7mI3tWdNw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB5917 X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, 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@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: Tue, 24 Nov 2020 20:07:02 -0000 On 11/24/2020 9:31 AM, Kristian Ivarsson via Cygwin wrote: >> On 11/24/2020 4:32 AM, Kristian Ivarsson via Cygwin wrote: >> >>> all the std::filesystem implementations I've seen for Windows >> >> The implementation on top of Cygwin is not "for Windows", it's "for >> Cygwin", i.e., "for Posix". And for Cygwin that's the right thing to do. >> And that's where we keep talking at cross purposes. > > > Maybe it is the right thing to do, but what is your take of why it must be so (all the way) ? > > I also do understand that it have several advantages in the implementation of std::filesystem but it also imply an extra layer of abstraction to the underlaying platform, but to just remove the _CYGWIN_ macro when building it would make std::filesystem to not understand /cygdrive at all (and I guess that would confuse other users;-) so I guess it would require some more sophisticated implementation (or extend the number of exceptions already existing in the underlaying Cygwin-Posix-implementation) I'd like to try to make this discussion more concrete by looking at what's actually going on in the test program main.cpp that you posted at the beginning of that thread. (I ran it under strace and gdb to see this for myself.) First, your program calls std::filesystem::exists, which ultimately calls stat(2) in the Cygwin DLL. The work for this is done in the path_conv::check function and various functions that it calls. These functions have code that recognizes Win32 paths like C:\Temp, and std::filesystem::exists therefore reports "true". This is consistent with the statement at https://cygwin.com/cygwin-ug-net/using.html#pathnames-win32 about how the Cygwin DLL treats Win32 paths. Next, your program calls std::filesystem::canonical. This calls std::filesystem::absolute, which reports that C:\Temp is not an absolute path. It therefore tries to treat it as a relative path and fails with "No such file or directory" because /C:\Temp does not exist. Note that the Cygwin DLL never sees the original path C:\Temp in this case. Again, this is consistent with the statement in the documentation that Cygwin applications do not necessarily recognize Win32 paths. You say this is a bug, because first you're told that C:\Temp exists and then you're told it doesn't. But I think it just illustrates the hazards of using Win32 paths in Cygwin, which tries hard to emulate Posix. Sometimes you can get away with using Win32 paths and sometimes you can't, depending on how and when the Cygwin DLL is involved. I don't see a good way to avoid this inconsistency. We could change Cygwin so that it rigidly recognizes only Posix paths. Cygwin would then be consistent, but we would be removing a feature that many users have become accustomed to. And it wouldn't help you. Or we could ask all Cygwin package maintainers to try to patch their packages so that they recognize Win32 paths, but that's simply not feasible, nor would many package maintainers be willing to invest the required time. I tried it once with emacs, which I maintain, in response to a user request. I failed miserably. Every change I made broke something else, and I finally gave up. I don't think g++ will be any easier than emacs, and I don't think you can expect the g++ maintainer to work on this. Ken