-
Notifications
You must be signed in to change notification settings - Fork 380
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
In Windows, Server
should allow a pseudo-directory for /
which enumerates available drives
#569
Comments
This is not the issue board for the You can checkout their project’s issue board her: https://github.com/libfuse/sshfs/issues?q=is%3Aissue |
Isn't it the sftp server that answers with what the content of |
The sftp server does indeed answer what the contents of Without more details about how you’re actually using this package, we really cannot answer anything. |
I use the example from here: It seems to use the default |
Hm, that code is not using After some trouble, I’ve managed to set up a repro. My behavior is that I get a listing of Getting this working is going to be a piece of work. This definitely isn’t anything easy, because there’s no actual directory to 😩 So, I’m sorry to give sad news, but I don’t think we’ll actually be able to get this feature done. If you want to sit down and invest the work necessary to get it done, we would consider a PR for this, as it’s not an unreasonable feature… just a lot of work, which I don’t think any of volunteers have time to help with. |
/
which enumerates available drives
/
which enumerates available drivesServer
should allow a pseudo-directory for /
which enumerates available drives
I think it would make sense to put here, in Lines 177 to 180 in 22452ea
a call to a new What do you think about that approach?
How would I implement it with that interface? Do I need to implement all the Handlers Interfaces myself? That seems like a lot of work, or am I missing something? |
Again, one doesn’t just list a directory, first you Do not use the code in that stackoverflow, use https://pkg.go.dev/golang.org/x/sys/windows#GetLogicalDrives also OMG, do not use the
As for how you would implement it in the |
Hello and Happy New Year
Yes, you have to implement at least these 4 handlers/methods yourself and any other optional interface needed for your use case. This may seem like a lot of work initially, but it allows you to make the SFTP server work the way you want and have much more control than using the old |
Happy new year!
I see And for making sure that other methods don't get confused by the What do you think of that approach?
Is there some example of a standard SFTP server I could use as a basis? Like |
The example in the repo uses |
Here is a simple example to use as base (review carefully the code before using it in production)
|
I mean, we could do something like this, but we would still need to implement a second pseudo |
I might be missing something obvious, but why is that? In my understanding, all we need for the "virtual root" is to replace the "filling of We can't copy into that folder anyways etc - So I think it might be fine to let
You are right, and it is appreciated! 🙂 My goal is to figure out how much work it would be to realize this, and why. I have the hope that it is not as much work as one might first think 🤞 |
Because that would be very surprising behavior to the client. The client would Now, instead of changing each call point, we can leverage the duck typing and type inference of Golang, and have |
I see. An "permission denied" could also be suprising though, if one starts the server as an windows admin. In the end the user of sftp has to handle '/' specially on windows either way (in such cases where he previously assumed he can do fsetstat etc). Perhaps the "handle does not exist" even makes sense to a degree.. because that path really does not exist on windows? Currently we have the situation in which '/' does not contain all drives. If one would want to e.g. create a full copy of the entire system via sftp, a script that does "scp user@host:/ /path/to/backup" would currently not work as expected.
Yes, but not if we'd be ok with giving the client a "handle not found" error - I see that doing an "open" and then afterwards getting (on an subsequent operation) an "does not exist" is weird. But perhaps it would be an acceptable corner/edge case?
Ok, that sounds like a great solution! |
You are wrong in your assessment that “permission denied” is surprising. It is the normal expected error from requesting performance of an operation that cannot be performed. It says that the given operation should not be reattempted, while also being silent as to whether any other operations may still otherwise be possible. I would be equally unsurprised if attempting to “Handle does not exist” would need to means that the sftp server does not have the handle that it just created internally, which it gave out to the client for use. It is an sftp-specific term, which is separate from the term as used by the OS. In fact, for the
You are not wrong here. However, the SFTP standard we use does not define anything about how this should work in Windows. I have already acknowledged that you have made a reasonable request, because interoperability is important. However, our code is current standards compliant in this area. Note that
I will not accept a "handle not found" error in this case, as I have already explained it is misleading and confusing, and directly and unambiguously points to the problem being in a completely different area of our systems. Particularly when, as mentioned, “permission denied” exists and is the perfectly normal, “yeah, you can’t do that on this file/directory” message.
I do not know. I have not evaluated all of the operations that would need to be implemented. |
I agree that returning "no such file" is a bit misleading in this case. Interesting, there is also a difference between I have opened #571 - it implements your suggestion of replacing |
No. It is not appropriate.
The server supports this operation. It just cannot perform this operation on that specific handle.
This is not unusual at all. As stated:
The only real alternative to |
I personally think Instead of |
Yes, I still disagree. Please read more carefully in the future:
|
Why so passive aggressive? For me these seem to be different things..
I feel the latter is more matching, and that there is a clear difference. If you insist I am fine with "permission denied" too, ofc |
@powellnorma
@puellanivis |
When I use
sshfs host:/ mnt
, the current working directory gets mounted tomnt
.Is it possible to let the sshfs server behave the way a cygwin compiled openssh server does, e.g. that it lists
/c:
,/d:
, ... in the root directory?The text was updated successfully, but these errors were encountered: