delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/11/17/10:16:03

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 47A463858021
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1605626121;
bh=MkVXNIwKMqeMzlTcbZICD3Vuya0vz7E0YP6leXzx52E=;
h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=nVb3qwaHC/QbUSDzhtvjUFXMBL3vKF3hA4Rdqx8xVkA2sGId1M5vg33LUAJNQuk3X
wu0M4EWDRcPP0BcKJGqqSM1S4nzVS3OcjNrVWnDDHyFbWSvenPgwkQARZPGV4ZfYKX
ICUb4UEPrlOBVQYADUqZcr3vEmlQCgXjshacJuoc=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 248C63858021
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:from:to:subject:date:message-id:mime-version
:thread-index:content-language;
bh=0AfN+uLk/CKU5I3gVas0R83Dm/vz3l/qF8Yf8T64dw0=;
b=lraMWhXG8wHj0Xkdoy8ot4zvBfeeLcjW7BwOsjBhHLnlvbRKgzHooRBk40gLQ9gKWW
trCILZveC3/dsrUnw09fHCJa3IOAGNBbtXNcZxjmg+qjTmB35XbxQkiegQ56rKaRnhjU
UFsxY6mVz4qb/vlcg/MdfEHRMFCl58zLmcCAY5ZxEs9ph71gvuoIoiftbP95cT1qZEjw
phgaEZiuedUNz4qEydVlfTpjrtIu/jli5cDgd1RINPcxzVXuZ5XvJDI5hTZmddX50IxK
zgirbYU0fRPpHcWjTp5I1DdbPdjcVKDs2zYqy9JyWe5K0QKnuMM0/DP1AXMi0ckZzwr9
PlDw==
X-Gm-Message-State: AOAM530vesVTafogBnGNewRW6eHA5UHZUsZza6oT4pCub6LrnYboA8cA
u506oyw6q99yYglhUpD1YJ65acS9b+4=
X-Google-Smtp-Source: ABdhPJx1Upp54hdysneeHRI/aFa03KIWzCAJrrqdV5bcCnNuhdKbIe30Hs9bcLMB3eyBOV4svIV/bA==
X-Received: by 2002:a05:651c:1195:: with SMTP id
w21mr1931391ljo.427.1605626115489;
Tue, 17 Nov 2020 07:15:15 -0800 (PST)
To: <cygwin AT cygwin DOT com>
Subject: g++ and c++17 filesystem
Date: Tue, 17 Nov 2020 16:15:14 +0100
Message-ID: <000001d6bcf4$736e0300$5a4a0900$@gmail.com>
MIME-Version: 1.0
X-Mailer: Microsoft Outlook 16.0
Thread-Index: Ada89GzV2DDZmSbxQTSSuQxYzeyQWg==
X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,
SPF_HELO_NONE, 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-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: Kristian Ivarsson via Cygwin <cygwin AT cygwin DOT com>
Reply-To: sten DOT kristian DOT ivarsson AT gmail DOT com
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

This is a multipart message in MIME format.

------=_NextPart_000_0001_01D6BCFC.D53418B0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi folks

The filesystem-library as a part of C++17 seems to have some defects and
flaws in the cygwin-package and pretty much every lexical- and canonical
operation works in mysterious ways (or not at all)


Following output with g++cygwin

 $ uname -a
 CYGWIN_NT-10.0 JOKK 3.1.7(0.340/5/3) 2020-08-22 17:48 x86_64 Cygwin

 $ g++ --version
 g++ (GCC) 10.2.0
 Copyright (C) 2020 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 $ g++ -std=c++17 main.cpp

 $ ./a.exe
 true
 C:/Temp
 filesystem error: cannot make canonical path: No such file or directory
[C:/Temp]


Following output with mingw (that also is a bit strange (note the last
"generic" (i.e. posix) output))

 $ .\g++.exe --version
 g++.exe (MinGW.org GCC Build-2) 9.2.0
 Copyright (C) 2019 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 $ .\g++.exe -std=c++17 main.cpp 

 $ .\a.exe
 true
 C:/Temp
 C:\Temp


Following output with cl (that seems to be the most standard-conformant)

 C:\>cl /std:c++17 main.cpp
 Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29112 for x86
 Copyright (C) Microsoft Corporation.  All rights reserved.

 main.cpp

 /out:main.exe
 main.obj

 C:\>main.exe
 true
 C:/Temp
 C:/Temp



I have failed to find out exactly where the defect are though and I also do
have a hard time to see where/how/if there's a gcc/g++/mingw- or
libstdc++-fork for the cygwin package where this breaks


Does anyone have any ideas about this and know of any patches or (hot)fixes
to this ? 

I haven't tried out all the mingw generic/lexical/canonical functions yet,
but maybe they're flawed as well


Thanx in advance



Best regards,
Kristian





------=_NextPart_000_0001_01D6BCFC.D53418B0
Content-Type: text/plain;
	name="main.cpp"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="main.cpp"

#include <filesystem>=0A=
#include <iostream>=0A=
#include <stdexcept>=0A=
=0A=
// g++ -std=3Dc++17 main.cpp=0A=
=0A=
=0A=
int main()=0A=
{=0A=
=0A=
   try=0A=
   {=0A=
      const std::filesystem::path path{"C:\\Temp"};=0A=
      std::cout << std::boolalpha << std::filesystem::exists(path) << =
std::noboolalpha << std::endl;=0A=
      std::cout << path.generic_u8string() << std::endl;=0A=
      std::cout << std::filesystem::canonical(path).generic_u8string() =
<< std::endl;=0A=
   }=0A=
   catch(const std::exception& e)=0A=
   {=0A=
      std::cerr << e.what() << std::endl;=0A=
   }=0A=
=0A=
=0A=
   return 0;=0A=
}=0A=
=0A=

------=_NextPart_000_0001_01D6BCFC.D53418B0
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

------=_NextPart_000_0001_01D6BCFC.D53418B0--

- Raw text -


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