keybase / kbfs

Keybase Filesystem (KBFS)
https://keybase.io/docs/kbfs
BSD 3-Clause "New" or "Revised" License
1.21k stars 137 forks source link

Symbolic link from outside KBFS to KBFS doesn't work with PowerShell "New-Item" cmdlet #1472

Open lediur opened 6 years ago

lediur commented 6 years ago

Operating system: Windows 10 Insider (build 17083)

I'm attempting to create a symbolic link using PowerShell using the idiomatic way recently introduced in PowerShell:

New-Item -ItemType SymbolicLink -Name myfile -Target K:\private\derrickliu\myfile

This fails with an error:

ni : Cannot find drive. A drive with the name 'K' does not exist.
At line:1 char:1
+ ni -itemtype symboliclink -name myfile -target K:\PRIVATE\derrick ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (K:String) [New-Item], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.NewItemCommand

(ni was the alias I used in practice)

Thinking it might be related to the issue at https://github.com/keybase/keybase-issues/issues/2248, I also tried the path K:\PRIVATE\derrickliu\myfile, with the same error result.

Using mklink via the classic cmd command prompt creates symbolic links just fine, so that was the workaround I used, but it would be nice to see PowerShell support.

lediur commented 6 years ago

I just discovered that the K:\ filesystem isn't visible to the shell when running as admin, since I just tried cding to it and got the same error. I can see the K:\ filesystem just fine in the non-admin shell. That's probably the cause of the issue, but I can't create symlinks using PowerShell from non-admin shells :(

strib commented 6 years ago

cc: @zanderz @taruti

taruti commented 6 years ago

@ledur, we disable access for other accounts than the one running kbfsdokan.

Creating symbolic links from cmd.exe works as you have discovered.

Pondering on what would be the best way to fix this.