delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/11/24/15:07:57

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9ED8F3950C48
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1606248423;
bh=j7seO/xEoK1AIi9787I50xX3ztoZmEJOLeP6040ddUo=;
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=lOjqJx115chy2/6auTJLgwAYZg9icJAsKjdjwUEGW/I0aLbRwe8DshuAKj/6hnOWf
qTZEPCvKATcM4igBzQSEeG8huQ23epSob0B4Oj8R/H9RKBKcz9BwvzZhBj78DjJZPz
KjilQc9FrgT/U/ggs8ASR3wrike/Hz57VsgUbNMM=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
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
Subject: Re: Sv: Sv: Sv: Sv: Sv: g++ and c++17 filesystem
To: sten DOT kristian DOT ivarsson AT gmail DOT com, moss AT cs DOT umass DOT edu,
"'Jonathan Yong'" <10walls AT gmail DOT com>,
"'The Cygwin Mailing List'" <cygwin AT cygwin DOT com>
References: <c2d6280c-26e3-f9e7-89bd-693385a768b2 AT gmail DOT com>
<D3704C33-A283-40F0-990D-CB9806F0B09D AT gmail DOT com>
<000a01d6be5b$3808cad0$a81a6070$@gmail.com>
<87a2c99c-045c-e815-4c03-bab7a89a025b AT cs DOT umass DOT edu>
<000201d6bf17$7cc4beb0$764e3c10$@gmail.com>
<9e881c01-e883-ecd5-883a-e1ac55c740c7 AT gmail DOT com>
<000601d6c173$aa55d540$ff017fc0$@gmail.com>
<d8a72610-a79b-0387-e52b-25f0b50c46ef AT gmail DOT com>
<000a01d6c244$b64bbd70$22e33850$@gmail.com>
<237eacd5-a1bf-da6a-2ee6-f2df945f125b AT cs DOT umass DOT edu>
<000501d6c26e$73e1d760$5ba58620$@gmail.com>
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>
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
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: 85c9b60b-1c2a-4a06-b055-08d890b47fd1
X-MS-TrafficTypeDiagnostic: MN2PR04MB5917:
X-Microsoft-Antispam-PRVS: <MN2PR04MB591758F951BD579A137144B4D8FB0 AT MN2PR04MB5917 DOT namprd04 DOT prod DOT outlook DOT com>
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 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>

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 <current directory>/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
--
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

- Raw text -


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