tannercollin / standardnotes-fs

Mount your Standard Notes as a filesystem.
GNU General Public License v3.0
148 stars 12 forks source link

Under ubuntu, cd mounted folder shows `Operation not permitted` #12

Closed paperwise closed 5 years ago

paperwise commented 5 years ago

Thanks for the great tool.

mount successfully as mnt , Can open file open mnt/test.md, however can not cd mnt. System shows error Operation not permitted..

tannercollin commented 5 years ago

Did you mount it as your user, or with sudo?

Where is the mnt directory located?

paperwise commented 5 years ago

I mount as user, ~/Document/mnt . I just tried to mount using sudo.

sudo snfs $MY_STDN_PATH  --ext '.md'
$ ls
ls: cannot access 'std': Permission denied
tannercollin commented 5 years ago

Yeah mounting as user should work fine. Can you try without the --ext flag? That's new so there might be a bug.

Why does it say ls: cannot access 'std': Permission denied if you mounted to mnt?

What's $MY_STDN_PATH set to? Thanks.

paperwise commented 5 years ago

Tried without --ext, get txt files as expected, but still can not get into directory.

Sorry, it is mounted to MY_STDN_PATH=~/Documents/mnt/std. By the way, I also use snfs on a Mac, works great.

I tried to change this values, and python setup.py install instead of pip3 install. but does not seems to help.

DIR_PERMISSIONS = 0x755
FILE_PERMISSIONS = 0x755
tannercollin commented 5 years ago

I'm stumped. Can you run snfs with -vv and then try lsing again in a different terminal?

Then upload the output to termbin / pastebin? Feel free to anonymize any file names, etc.

Thanks!

dundalek commented 5 years ago

I can also confirm this. When trying to cd into the directory the shell calls chdir which gets the non permitted code:

chdir("notes_dir")                             = -1 EPERM (Operation not permitted)
write(2, "bash: cd: notes_dir: Operation not perm"..., 38) = 38

From the snfs -vv log it seems that it triggers the access call which is not permitted:

DEBUG   : -> access / (1,)
DEBUG   : <- access '[Errno 1] Operation not permitted'
DEBUG   : FUSE operation access raised a <class 'fuse.FuseOSError'>, returning errno 1.
Traceback (most recent call last):
  File "/home/me/.local/lib/python3.6/site-packages/fuse.py", line 734, in _wrapper
    return func(*args, **kwargs) or 0
  File "/home/me/.local/lib/python3.6/site-packages/fuse.py", line 995, in access
    return self.operations('access', path.decode(self.encoding), amode)
  File "/home/me/.local/lib/python3.6/site-packages/fuse.py", line 1251, in __call__
    ret = getattr(self, op)(path, *args)
  File "/home/me/.local/lib/python3.6/site-packages/standardnotes_fs/sn_fuse.py", line 131, in access
    raise FuseOSError(errno.EPERM)
fuse.FuseOSError: [Errno 1] Operation not permitted

If I understand it correctly the solution might be to allow executable permission for the root directory. And adding it for tag directories might be also a good idea. Hope it helps.

tannercollin commented 5 years ago

Ahh okay, this is a bug from my access() hack in 64e5b83c0d27e7ec5fc72442bf3baaace3c1e7de.

For some reason Vim's netrw checks to see if all files are executables using access(), which originally always returned 0 (allowed), which makes Vim display them ugly in netrw. I didn't test the changes enough when I wrote the hack.

Should be fixed in 046dfde348fa2221f9f1df5930c08ecf7158b337. Can you both please pip3 install --upgrade git+https://github.com/tannercollin/standardnotes-fs and test? Thanks for your help!

paperwise commented 5 years ago

@tannercollin works great from my side! Thanks. Will wait for @dundalek to comment and close.

As a side note: I notice when the computer goes to sleep and wake up. We will need to re-mount. Is it expected behavior, or snfs could potentially work after sleep/wake.

dundalek commented 5 years ago

Work great for me too, thanks.

tannercollin commented 5 years ago

Thanks for the help, guys.

I'll investigate the sleep / wake issue in https://github.com/tannercollin/standardnotes-fs/issues/13.