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: A required privilege is not held by the client #556

Closed
watzon opened this issue Jul 9, 2022 · 3 comments · Fixed by #565
Closed

Windows: A required privilege is not held by the client #556

watzon opened this issue Jul 9, 2022 · 3 comments · Fixed by #565

Comments

@watzon
Copy link

watzon commented Jul 9, 2022

Stumbled on this today while trying to install shards for a project. Fresh git clone. Seems like Windows requires some funky permissions for symlinking and it's not possible to do without some admin rights. The full error is as follows:

...
Fetching https://github.com/sija/backtracer.cr.git
Fetching https://github.com/ysbaddaden/pool.git
Installing db (0.10.1)
Unhandled exception: Error creating symlink: '..' -> 'C:\\Users\\cawat\\Projects\\personal\\tourmaline\\lib\\db\\lib': A required privilege is not held by the client. (File::AccessDeniedError)
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +122870 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +122766 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +122730 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +8771 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +604316 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +578409 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +1847241 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +1871668 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +1870894 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +1869488 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +1867803 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +104443 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +1638098 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +1625797 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +5762 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +2280857 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +2280634 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +75065 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +75347 in '??'
  from C:\Users\cawat\scoop\apps\crystal\current\shards.exe +2816924 in '??'
  from C:\WINDOWS\System32\KERNEL32.DLL +74829 in 'BaseThreadInitThunk'
  from C:\WINDOWS\SYSTEM32\ntdll.dll +384904 in 'RtlUserThreadStart'
@watzon
Copy link
Author

watzon commented Jul 9, 2022

Installing sudo with scoop and then doing sudo shards install works, but obviously it would be good to avoid giving admin rights to a program that can execute arbitrary code.

@luislavena
Copy link
Contributor

@watzon Looking at Crystal's code (here) seems that it uses the expected unprivileged flag (from Windows docs)

if not mistaken, that might be due Developer Mode needs to be turned on at least once for symlinks to work: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development

Are you able to test enabling developer mode without having to do sudo or an Administrator prompt?

@straight-shoota
Copy link
Member

I think this issue needs some attention in order to improve the user experience on Windows.

Enabling developer mode allows creating symlinks.

So the very least we can do is catch the symlink error and display a helpful message that recommends enabling developer mode (or admin rights alternatively).
We can even check if developer mode is enabled (Go implementation).

It would be ideal if it worked out of the box without developer mode. But I don't think there is a viable path for that. git also requires developer mode to checkout symlinks on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants