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




#include <filesystem>
#include <iostream>
#include <stdexcept>

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


int main()
{

   try
   {
      const std::filesystem::path path{"C:\\Temp"};
      std::cout << std::boolalpha << std::filesystem::exists(path) << 
std::noboolalpha << std::endl;
      std::cout << path.generic_u8string() << std::endl;
      std::cout << std::filesystem::canonical(path).generic_u8string() << 
std::endl;
   }
   catch(const std::exception& e)
   {
      std::cerr << e.what() << std::endl;
   }


   return 0;
}

--
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

Reply via email to