jupyter / jupyter/notebook

Could not delete files, permission denied

Open
#4,579 1 comment 5 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
13.3k
Forks
5.8k
Avg merge
6d 11h
Merged PRs (30d)
7

Description

I get this error inside docker/singularity containers whenever I delete items

```
[E 12:21:57.824] 500 DELETE /api/contents/my_awesome_project/Untitled.ipynb?1555935712772 (::1) 26.18ms referer=http://localhost:8888/lab?
[W 12:22:03.131] delete /my_awesome_project/Untitled.ipynb
[E 12:22:03.132] Uncaught exception DELETE /api/contents/my_awesome_project/Untitled.ipynb?1555935718106 (::1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='DELETE', uri='/api/contents/my_awesome_project/Untitled.ipynb?1555935718106', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/send2trash/plat_gio.py", line 13, in send2trash
f.trash(cancellable=None)
GLib.GError: g-io-error-quark: Unable to trash file: Invalid cross-device link (15)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 1592, in _execute
result = yield result
File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 326, in wrapper
yielded = next(result)
File "/usr/local/lib/python3.5/dist-packages/notebook/services/contents/handlers.py", line 235, in delete
yield gen.maybe_future(cm.delete(path))
File "/usr/local/lib/python3.5/dist-packages/notebook/services/contents/manager.py", line 279, in delete
self.delete_file(path)
File "/usr/local/lib/python3.5/dist-packages/notebook/services/contents/filemanager.py", line 540, in delete_file
send2trash(os_path)
File "/usr/local/lib/python3.5/dist-packages/send2trash/plat_gio.py", line 18, in send2trash
raise TrashPermissionError('')
send2trash.exceptions.TrashPermissionError: [Errno 13] Permission denied: ''
```
I believe the error happens because this is running inside a container and `send2trash` is trying to move my file into where it does not have permissions to move.

My setup:
```
ubuntu 16.04
python 3.5.2
jupyter 1.0.0
jupyter-client 5.2.4
jupyter-console 6.0.0
jupyter-contrib-core 0.3.3
jupyter-contrib-nbextensions 0.5.1
jupyter-core 4.4.0
jupyter-highlight-selected-word 0.2.0
jupyter-http-over-ws 0.0.3
jupyter-latex-envs 1.4.6
jupyter-nbextensions-configurator 0.4.1
jupyterlab 0.35.4
jupyterlab-server 0.2.0
```

Contributor guide

Open the contributing guide

Research direction

Start in notebook/services/contents/filemanager.py at delete_file, then trace the DELETE path through the contents handlers and manager shown in the traceback. Reproduce deletion inside a Docker container and determine how the send2trash failure should be handled. Done means deleting an item no longer produces the reported permission error in that environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, jupyter-notebook, python
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.