volta icon indicating copy to clipboard operation
volta copied to clipboard

[Windows] Investigate creating a lightweight symlink replacement

Open charlespierce opened this issue 6 years ago • 8 comments

Symlinks in Windows come with a bunch of restrictions and edge-cases that make it hard for Volta to correctly determine the name of the tool that was called. A few of these include:

  • Requiring Developer Mode - Creating symlinks requires elevated permissions if Developer Mode isn't enabled, which is a bad idea in general)
  • Git Bash Oddities - Git Bash on Windows will fully resolve symlinks before calling the executable, so shims don't work because the information about what tool was actually called is lost.

We could possibly solve these problems by creating a small executable that we could actually copy with a new name when creating a shim. This executable would be responsible for determining the command (possible because it's actually an on-disk executable) and then passing control to the full Volta shim while passing information about the tool (possibly using an Environment Variable).

charlespierce avatar Oct 19 '19 02:10 charlespierce

Alternatively, possibly look into creating the shims with hard links instead of symlinks, which in some quick testing appears to work. This will also probably require setting the Permission setting "WriteAttributes" on the installed shim.exe in the WiX configuration.

charlespierce avatar Oct 19 '19 03:10 charlespierce

I think I might be seeing this issue when using https://github.com/nushell/nushell on anything going through volta-shim.exe as well, FWIW.

gerred avatar Jul 29 '20 19:07 gerred

For reference, Chocolatey have a shim generator called shimgen, https://github.com/chocolatey/shimgen. It works well for me under any scenario: Git Bash, Powershell, cmd, UNCs.

felipecrs avatar Mar 30 '21 00:03 felipecrs

For reference, Chocolatey have a shim generator called shimgen, https://github.com/chocolatey/shimgen. It works well for me under any scenario: Git Bash, Powershell, cmd, UNCs.

that shimgen is pretty slow and so many choco users complain about it, moreover, it's a closed source software.

chawyehsu avatar Mar 30 '21 02:03 chawyehsu

There is also Scoop's Shim, https://github.com/ScoopInstaller/Shim. Very simple to use.

felipecrs avatar Mar 30 '21 02:03 felipecrs

that shimgen is pretty slow and so many choco users complain about it, moreover, it's a closed source software.

Still about shimgen, there is https://github.com/turboBasic/shimPsy.

felipecrs avatar Mar 30 '21 02:03 felipecrs

There is also Scoop's Shim, https://github.com/ScoopInstaller/Shim. Very simple to use.

Well, I'm one of the maintainers of Scoop and I know that. the initial version of Scoop's shim isn't robust. FYI, there are variants available, such as https://github.com/71/scoop-better-shimexe and https://github.com/kiennq/scoop-better-shimexe.

And I always want to see a modern, independent, well-designed implementation of Windows shimming tool.

chawyehsu avatar Mar 30 '21 03:03 chawyehsu

There is also a Rust version (from Scoop) https://github.com/zoritle/rshim, which Rust Volta might like better :)

eugenesvk avatar May 21 '22 12:05 eugenesvk