os: TestOneDrive fails on Windows if OneDrive PATH needs expansion #57576
Labels
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
OS-Windows
Testing
An issue that has been verified to require only test changes, not just a test failure.
Milestone
I'm setting up a new development environment on a Windows machine. After initial setup I ran
all.bat
and the compilation succeeded, but the tests failed with:For the sake of time saving, the same test can be run with
go tool dist test
:I traced the problem to the
findOneDriveDir
helper function:go/src/os/os_windows_test.go
Lines 877 to 881 in 9955a7e
In line 877 we get the value of the registry key and return it in 881, but if the registry value is of type EXPAND_SZ it needs further expansion as documented in https://pkg.go.dev/golang.org/x/sys/windows/registry#ExpandString. In my case,
%UserProfile%
needs expansion.The fix is simply calling registry.ExpandString on the resulting path. I'm preparing a PR for submission later today.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, considering this is a test bug and I'm running the latest version of the tests.
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
What did you see instead?
(other text omitted for brevity)
The text was updated successfully, but these errors were encountered: