Open Cobertos opened 5 years ago
This is a good idea! Unfortunately, I don't know anything about windows and don't have easy access to a system I can test on. I'll definitely need help on this one.
What about blasting away self.uid
and self.gid
? On Linux, this will make the notes appear owned by root:root
but it makes no difference in usability because FUSE still allows reading and writing.
You might get those same permission denied errors from before, however. This would only help if winfsp sets it to defaults that work.
You mean like not even passing them to the dir_stat
and node_stat
dicts at all? Originally I tried setting both to -1
to get the service to run on Windows and mount a folder but I didn't try removing them completely. I'll have to try that the next time I give this a shot, it'd be nice to have this working on Windows even without proper permissions.
IIRC I also read about a flag in winfsp for setting default permissions uid
and gid
, perhaps I should figure out if it's possible to query/use those. I'll look into this as well.
@Cobertos did you get a chance to test removing self.uid
and self.gid
?
Nope, not yet. I've been buried in other projects but I should have some more time tonight.
On Fri, Feb 22, 2019, 12:45 AM Tanner Collin notifications@github.com wrote:
@Cobertos https://github.com/Cobertos did you get a chance to test removing self.uid and self.gid?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tannercollin/standardnotes-fs/issues/15#issuecomment-466281536, or mute the thread https://github.com/notifications/unsubscribe-auth/AGcjCFn078JWvQzbsI2r9p-t2QcG4rlKks5vP4QRgaJpZM4bALPM .
Tried blowing away the passing of st_gid
and st_uid
into the dict and I get the same error. The default parameters I was looking into are also only for the CLI invocation of winfsp and I don't think they're supported through fusepy.
So after looking at this more, I think the route needs to be either to add all the windows functions from win32api or just ConvertStringSidToSid
to winsfpy
.
I figured out how to use cffi
and compiled my own module with ConvertStringSidToSid
but apparently you're not allowed to mix types from two instances of ffi, so I'll probably have to locally clone [winsfpy
] and make a PR to get this to work. I'll probably be back once I have time to do that.
Sounds good, thanks for looking at this!
I would also be really interested in Windows support. @Cobertos do you have any thoughts on where you left off with this?
@AlJohri
IIRC, using winsfpy
and win32api
separately get you 95% of the way there. You can get the current user SID with win32api
code above, but there's no way to convert it to winsfpy
s internal SID object to store an SID to UID/GID mapping. Unfortunately wasn't able to get any insight from winsfpy
s developers https://github.com/Scille/winfspy/issues/1
Cloning winsfpy
and adding a binding to convert from a string SID to it's internal SID object should be the final step of this problem (or perhaps there's a lower level solution by working with CFFI internals but I'm unaware). I think there's already bindings for certain win32 API calls in winsfpy
so it should be as simple as adding another for ConvertStringSidToSid
. Then, using the code in the OP, that should add the functionality to this library, where on Windows, it'll do the SID conversion to get the UID/GID to set the files with when passing it to fusepy
.
I've since transitioned to using a different note app though, so I haven't put any more work into this.
@Cobertos which note app? I'm always interested in alternatives.
Edit: I see you're using Notion.so. What made you switch? Do you pay for it?
Notion.so, not selfhosted or e2e encrypted, but it does a lot of stuff right and the API has been a dream. The nested note structure just really works for my brain and the data model backing it is super easy to work with.
On Wed, Apr 22, 2020, 11:10 PM Tanner Collin notifications@github.com wrote:
@Cobertos https://github.com/Cobertos which note app? I'm always interested in alternatives.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tannercollin/standardnotes-fs/issues/15#issuecomment-618150844, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTSGCAI7JP7Z6XUAZ6AMMLRN6WSZANCNFSM4GYAWPGA .
Your upstream
fusepy
supports Windows usingwinfsp
.I was able to get
standardnotes-fs
to run on Windows but wasn't able to get it to actually work. Because I was originally using dummy gid and uid values, I would get permission denied errors (similar to this user doing a similar migration)It seems the only change that needs to be made is to have Windows call it's equivalent of
getuid()
andgetgid()
and then register the conversion from Windows sid to uid/gid with winfsp. I tried my best but got stuck when trying to convert between thepywin32
sid object and thewinfspy
cffi
binding sid object. They're not the same size and the latter doesn't expose anything do me to use and I'm not familiar enough with the intricacies of these frameworks to get further.Here's what I ended up with, replaced a few lines in
sn_fuse.py