Skip to content
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

Windows FilePath::IsAbsolutePath does not recognize UNC paths #3025

Closed
ventrebd opened this issue Sep 25, 2020 · 0 comments
Closed

Windows FilePath::IsAbsolutePath does not recognize UNC paths #3025

ventrebd opened this issue Sep 25, 2020 · 0 comments
Assignees

Comments

@ventrebd
Copy link

FilePath::IsAbsolutePath does not recognize Windows UNC-style paths as valid absolute paths (e.g., \\domain\dfs\path\... is incorrectly recognized as a relative path). This manifests as a fatal error when trying to write XML/JSON output when the current directory is a UNC path. Tests run, but I get an error during global test environment tear-down that the system is unable to open the XML file.

Using a PowerShell window with the current directory set to a UNC path, the output looks something like the following (using googletest as shipped with Visual Studio 2019):

PS Microsoft.PowerShell.Core\FileSystem::\\domain\dfs_path\tmp> &.\gTest.exe "--gtest_output=xml:"
Running main() from e:\a\_work\2100\s\thirdparty\googletest\googletest\src\gtest_main.cc
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
... # output elided

[----------] Global test environment tear-down

[ FATAL ] e:\a\_work\2100\s\thirdparty\googletest\googletest\src\gtest.cc(207):: Unable to open file "\domain\dfs_path\tmp\gTest.xml"
PS Microsoft.PowerShell.Core\FileSystem::\\domain\dfs_path\tmp>

Note the reduction of \\ to \ in the output file path error message. Things work fine if you use a mapped drive letter instead (which is unfortunately not feasible in many of our use cases with network file shares).

If you try working around this by passing a complete UNC path for the XML output, it tries to build a "full" path as if the given path was relative. Similar things happen when trying to use Windows long paths such as \\?\UNC\domain\dfs_path\.... I also tried many different options for relative/absolute/long paths for the XML output but had no luck.

gaspardpetit pushed a commit to eidosmontreal/googletest that referenced this issue Feb 24, 2023
…h::IsRootDirectory() in GoogleTest

Fixes: google#3025
PiperOrigin-RevId: 481932601
Change-Id: I90fcb5b3d189aea79a0fd18735bad038b3511270
kunitoki pushed a commit to kunitoki/googletest that referenced this issue Nov 4, 2023
…h::IsRootDirectory() in GoogleTest

Fixes: google#3025
PiperOrigin-RevId: 481932601
Change-Id: I90fcb5b3d189aea79a0fd18735bad038b3511270
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants