jupyter_server icon indicating copy to clipboard operation
jupyter_server copied to clipboard

Some systems can grant access to a file without granting access to the surrounding directory.

Open holzschu opened this issue 3 years ago • 1 comments

Problem

On some operating systems (mainly iOS, but probably Android and other OS too), you can have read-write access to a file without having access to the surrounding directory. When that happens, jupyter_server will encounter issues at three points:

  • for atomic_writing (in services/contents/fileio.py) where, to save a file, it creates a new file next to it then copies it over.
  • for file checkpoints (in services/contents/filecheckpoints.py), where it creates a checkpoint file in the local directory.
  • when starting the kernel (in services/kernels/kernelmanager.py), where it tries to change the working directory to the directory surrounding the notebook.

These are all minor issues, and they are easy to workaround (for atomic_writing, the workaround is simple_writing, which is already present in fileio.py).

Proposed Solution

Check that there is write and execution permission on a directory before attempting an operation on that directory, and have a backup directory or backup operation if permission is denied. I can submit a PR, but I'm not sure if you would be interested, given that it's an issue that only affects few OS.

Additional context

holzschu avatar Mar 25 '22 14:03 holzschu

I wonder if this would also solve some issues seen when using other non-posix filesystems, such as FUSE-based mounts? In this case it'd need to be a configurable option since the directory will still be writeable.

manics avatar Mar 25 '22 15:03 manics