bkt icon indicating copy to clipboard operation
bkt copied to clipboard

Symlinks on Windows require privilege escalation

Open dimo414 opened this issue 4 years ago • 4 comments

On Windows bkt fails with this error:

> /bkt.exe -- ipconfig
bkt: Cache write failed: A required privilege is not held by the client. (os error 1314)

This comes from the call to std::os::windows::fs::symlink_file which actually doesn't work in most cases. Specifically, Windows treats symlink creation as a privileged action and there aren't a lot of good ways around it.

Rather than making users jump through these hoops, it might be easiest to just manually reimplement "symlinks" as vanilla text files, so the key file would simply contain the path to the data file and lookup() would read that file to find where the data is stored.

dimo414 avatar Nov 19 '21 18:11 dimo414

Rather than making users jump through these hoops, it might be easiest to just manually reimplement "symlinks" as vanilla text files, so the key file would simply contain the path to the data file and lookup() would read that file to find where the data is stored.

I like this solution.

Is there an existing workaround on the software side? I hit this issue on a pipeline runner, and don't necessarily want to make changes on the os-level.

W1M0R avatar Aug 06 '25 12:08 W1M0R

Any workaround would involve fixing the permissions on the OS unfortunately, if you're interested in submitting a PR it should be an easy change. Otherwise I will try to prioritize this in the next couple of weeks.

dimo414 avatar Aug 08 '25 08:08 dimo414

Thanks @dimo414. I would like to attempt a solution, but I'm honestly a bit swamped right now.

W1M0R avatar Aug 08 '25 11:08 W1M0R

If it is of any help, it looks like Scoop uses junctions by default and only reverts to copies if the no_junction config value is set:

https://github.com/ScoopInstaller/Scoop/blob/859d1db51bcc840903d5280567846ae2f7207ca2/lib/install.ps1#L804-L824

W1M0R avatar Aug 08 '25 22:08 W1M0R