在 2022/8/10 04:45, Ryan Starrett 写道:
The initial bug reports for these problems were started in 2018!https://sourceforge.net/p/mingw-w64/bugs/699/ https://sourceforge.net/p/mingw-w64/bugs/852/ (2020) It's been nearly five years. Can we expect a fix to this issue soon?
If you have had searched libstdc++ source for `std::errc::file_exists`, there are a couple of matches, which are all issued if the source and destination fines share the same device ID and inode number, so you get this error if the two paths refer to the same (hard-linked or not) file, such as this [1]:
```
if (to_st->st_dev == from_st->st_dev
&& to_st->st_ino == from_st->st_ino)
{
ec = std::make_error_code(std::errc::file_exists);
return false;
}
```
The `_ino_t` type is 16-bit, but the actual file identifier is a 64-bit value, as returned by
`GetFileInformationByHandle()`.
We don't create the `stat()` API. It is exported from MSVCRT by Microsoft. And according to their documentation, the `st_ino` member 'has no meaning in the FAT, HPFS, or NTFS file systems.' [2] It is likely that it's always filled with a constant value, which causes `copy_file()` to always fail.
So, no, there isn't anything we can do. You should file a report on <https://gcc.gnu.org/bugzilla/> and ask them to fix libstdc++ instead.
[1] https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/src/filesystem/ops-common.h#L417[2] https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions?view=msvc-170#generic-text-routine-mappings
-- Best regards, LIU Hao
OpenPGP_signature
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
