mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-17 07:11:52 +08:00
cmSystemTools: Revert GetRealPath implementation on Windows
The use of `uv_fs_realpath` introduced by commit v3.11.0-rc1~445^2~1 (cmSystemTools: Implement GetRealPath on Windows, 2017-10-02) causes `subst` drives to be expanded on Windows, breaking existing use cases. Revert its use until an alternative implementation can be chosen. Preserve the behavior introduced by commit v3.11.0-rc1~445^2 (cmTimestamp: For symlinks switch to timestamp of resolved path, 2017-10-02) by retaining use of `uv_fs_realpath` in a function of a different name. Fixes: #18033 Issue: #17206
This commit is contained in:
@@ -298,3 +298,10 @@ Changes made since CMake 3.11.0 include the following.
|
|||||||
:prop_sf:`SKIP_AUTOUIC` on their generated files. These files never
|
:prop_sf:`SKIP_AUTOUIC` on their generated files. These files never
|
||||||
need to be processed by moc or uic, and we must say so explicitly to
|
need to be processed by moc or uic, and we must say so explicitly to
|
||||||
account for policy :policy:`CMP0071`.
|
account for policy :policy:`CMP0071`.
|
||||||
|
|
||||||
|
3.11.3
|
||||||
|
------
|
||||||
|
|
||||||
|
* CMake 3.11.0 introduced support for resolving symbolic links on
|
||||||
|
Windows in code paths that typically do so on UNIX. This has been
|
||||||
|
reverted due to breakage on ``subst`` drives.
|
||||||
|
@@ -949,10 +949,12 @@ cmSystemTools::WindowsFileRetry cmSystemTools::GetWindowsFileRetry()
|
|||||||
}
|
}
|
||||||
return retry;
|
return retry;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string cmSystemTools::GetRealPath(const std::string& path,
|
std::string cmSystemTools::GetRealPathResolvingWindowsSubst(
|
||||||
std::string* errorMessage)
|
const std::string& path, std::string* errorMessage)
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
// uv_fs_realpath uses Windows Vista API so fallback to kwsys if not found
|
// uv_fs_realpath uses Windows Vista API so fallback to kwsys if not found
|
||||||
std::string resolved_path;
|
std::string resolved_path;
|
||||||
uv_fs_t req;
|
uv_fs_t req;
|
||||||
@@ -981,8 +983,10 @@ std::string cmSystemTools::GetRealPath(const std::string& path,
|
|||||||
resolved_path = path;
|
resolved_path = path;
|
||||||
}
|
}
|
||||||
return resolved_path;
|
return resolved_path;
|
||||||
}
|
#else
|
||||||
|
return cmsys::SystemTools::GetRealPath(path, errorMessage);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void cmSystemTools::InitializeLibUV()
|
void cmSystemTools::InitializeLibUV()
|
||||||
{
|
{
|
||||||
|
@@ -500,12 +500,14 @@ public:
|
|||||||
unsigned int Delay;
|
unsigned int Delay;
|
||||||
};
|
};
|
||||||
static WindowsFileRetry GetWindowsFileRetry();
|
static WindowsFileRetry GetWindowsFileRetry();
|
||||||
|
|
||||||
/** Get the real path for a given path, removing all symlinks. */
|
|
||||||
static std::string GetRealPath(const std::string& path,
|
|
||||||
std::string* errorMessage = 0);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** Get the real path for a given path, removing all symlinks.
|
||||||
|
This variant of GetRealPath also works on Windows but will
|
||||||
|
resolve subst drives too. */
|
||||||
|
static std::string GetRealPathResolvingWindowsSubst(
|
||||||
|
const std::string& path, std::string* errorMessage = nullptr);
|
||||||
|
|
||||||
/** Perform one-time initialization of libuv. */
|
/** Perform one-time initialization of libuv. */
|
||||||
static void InitializeLibUV();
|
static void InitializeLibUV();
|
||||||
|
|
||||||
|
@@ -33,7 +33,8 @@ std::string cmTimestamp::FileModificationTime(const char* path,
|
|||||||
const std::string& formatString,
|
const std::string& formatString,
|
||||||
bool utcFlag)
|
bool utcFlag)
|
||||||
{
|
{
|
||||||
std::string real_path = cmSystemTools::GetRealPath(path);
|
std::string real_path =
|
||||||
|
cmSystemTools::GetRealPathResolvingWindowsSubst(path);
|
||||||
|
|
||||||
if (!cmsys::SystemTools::FileExists(real_path)) {
|
if (!cmsys::SystemTools::FileExists(real_path)) {
|
||||||
return std::string();
|
return std::string();
|
||||||
|
Reference in New Issue
Block a user