-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
g++ 9.3.0 throw after trying to overwrite with std::filesystem::copy_options::overwrite_existing #1937
Comments
MSYS2 gcc 10.1.0, bug reproduced |
Yeah, I'm getting the same bug, 10.1.0, regardless of copy_options passed. |
Similar error with copy (msys2/g++ 10.2.0):
If "barDir" does not exist yet, the copying succeeds. Otherwise, I've got this error:
|
did anyone already solve this problem? |
Hi, Same issue with msys2/g++ 10.3.0:
Can we expect a fix or do we need to work around this issue? Thanks, |
Hi
st_ino members are taken from _wstat64 function, but on windows it always returns 0 as linux file inodes has no meaning on windows. As explained here https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions?view=msvc-170 .
|
Gnu libstdc++ used in msys has bug in implementation of filesystem::file_copy on Windows platform, that causes file overwrite to throw exception. Workaround this by deleting file first. Msys issue #1937 msys2/MSYS2-packages#1937
This bug still exists in latest MSYS2 as of 3/15/2022. |
Still happened. |
This bug still exists in MSYS2 build as of 9/15/2022. |
Can you provide any sample code? Are you compiling for native Windows program? If yes you should use mingw gcc toolchain. |
problem persists on this version: |
snippet from my code: std::filesystem::path l_currentPath = std::filesystem::current_path(); std::filesystem::current_path(std::filesystem::temp_directory_path()); std::filesystem::create_directories("testcopy"); std::filesystem::path l_sourceFile = "c:\fileoriginal.txt"; std::filesystem::path l_newFile = std::filesystem::temp_directory_path() / "testcopy/filecopy.txt"; if (std::filesystem::exists(l_newFile) == false) { std::filesystem::copy(l_source, l_newFile, std::filesystem::copy_options::update_existing); } |
any update? |
The following program throws if the regular file "bar" already exist with
This does not happen under linux and also not under cygwin as I have been told. So I guess it could be an msys2 issue.
If "bar" does not exist yet, the copying succeeds. I use an up to date msys2 64bit system.
The text was updated successfully, but these errors were encountered: