You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Symlink creation on Windows is a realtively obscure feature and was limited to privileged processes (Run As Administrator) until a few years ago. Creating unpriviliged symlinks is supported since Windows 10 (1703, v10.0.14972), but only if the user also has Developer Mode enabled.
When the user runs go test -v without the required privileges the following error is displayed:
PS C:\work\open\mob> go test -run TestGitRootDirWithSymbolicLink -v
=== RUN TestGitRootDirWithSymbolicLink
mob_test.go:1621: Creating testbed in temporary directory C:\Users\BALINT~1.FAR\AppData\Local\Temp\TestGitRootDirWithSymbolicLink2285704395\001
mob_test.go:1621: git --bare init
mob_test.go:1621: git symbolic-ref HEAD refs/heads/master
mob_test.go:1621: git config receive.advertisePushOptions true
mob_test.go:1621: git clone --origin origin file://C:\Users\BALINT~1.FAR\AppData\Local\Temp\TestGitRootDirWithSymbolicLink2285704395\001/remote .
mob_test.go:1621: git config --local user.name local
mob_test.go:1621: git config --local user.email local@example.com
mob_test.go:1621: git checkout -b master
mob_test.go:1621: git add .
mob_test.go:1621: git commit -m "initial import"
mob_test.go:1621: git push --set-upstream--all origin
mob_test.go:1621: git clone --origin origin file://C:\Users\BALINT~1.FAR\AppData\Local\Temp\TestGitRootDirWithSymbolicLink2285704395\001/remote .
mob_test.go:1621: git config --local user.name localother
mob_test.go:1621: git config --local user.email localother@example.com
mob_test.go:1621: git clone --origin origin file://C:\Users\BALINT~1.FAR\AppData\Local\Temp\TestGitRootDirWithSymbolicLink2285704395\001/remote .
mob_test.go:1621: git config --local user.name alice
mob_test.go:1621: git config --local user.email alice@example.com
mob_test.go:1621: git clone --origin origin file://C:\Users\BALINT~1.FAR\AppData\Local\Temp\TestGitRootDirWithSymbolicLink2285704395\001/remote .
mob_test.go:1621: git config --local user.name bob
mob_test.go:1621: git config --local user.email bob@example.com
mob_test.go:1621: git clone --origin origin file://C:\Users\BALINT~1.FAR\AppData\Local\Temp\TestGitRootDirWithSymbolicLink2285704395\001/remote .
mob_test.go:1621: git config --local user.name local-symlink
mob_test.go:1621: git config --local user.email local-symlink@example.com
mob_test.go:1621: ERROR Could not create smylink from C:\Users\BALINT~1.FAR\AppData\Local\Temp\TestGitRootDirWithSymbolicLink2285704395\001/local-symlink.git to C:\Users\BALINT~1.FAR\AppData\Local\Temp\TestGitRootDirWithSymbolicLink2285704395\001/local-symlink/.git
mob_test.go:1621: ERROR symlink C:\Users\BALINT~1.FAR\AppData\Local\Temp\TestGitRootDirWithSymbolicLink2285704395\001\local-symlink.git C:\Users\BALINT~1.FAR\AppData\Local\Temp\TestGitRootDirWithSymbolicLink2285704395\001\local-symlink\.git: A required privilege is not held by the client.
mob_test.go:1621:
===== cd C:\Users\BALINT~1.FAR\AppData\Local\Temp\TestGitRootDirWithSymbolicLink2285704395\001/local
mob_test.go:1621:
===== cd C:\Users\BALINT~1.FAR\AppData\Local\Temp\TestGitRootDirWithSymbolicLink2285704395\001/local-symlink
mob_test.go:1621: ERROR expecting the current working directory to be a git repository.
exit status 1
FAIL github.com/remotemobprogramming/mob/v4 4.586s
To fix this I propose the following steps:
Add a note in the README.md and/or CONTRIBUTING.md for Windows 10 users to enable Developer Mode
Detect the symlink creation failure and display a more helpful error message about turning on Developer Mode or running tests from an elevated console
Add a detection mechanism for symlink creation, and skip tests that require symlinks (currently only TestGitRootDirWithSymbolicLink if I'm correct). This would make the second step unnecessary.
The go internal/testenv package already has a method for detecting symlink creation on Windows https://pkg.go.dev/internal/testenv#MustHaveSymlink, we should create something similar for an elegant way of handling this.
The text was updated successfully, but these errors were encountered:
Symlink creation on Windows is a realtively obscure feature and was limited to privileged processes (Run As Administrator) until a few years ago. Creating unpriviliged symlinks is supported since Windows 10 (1703, v10.0.14972), but only if the user also has Developer Mode enabled.
When the user runs
go test -v
without the required privileges the following error is displayed:To fix this I propose the following steps:
The go internal/testenv package already has a method for detecting symlink creation on Windows https://pkg.go.dev/internal/testenv#MustHaveSymlink, we should create something similar for an elegant way of handling this.
The text was updated successfully, but these errors were encountered: