Skip to content
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

Don't trash files on different device to home dir on Linux #3304

merged 1 commit into from Feb 13, 2018


Copy link

@takluyver takluyver commented Feb 5, 2018

This is a bit of a crude check, but I imagine that most users will be working either in their home directory, or on the same device, so it's not worth trying to do a more complex check. I'm going to ask for better exceptions from send2trash so we can distinguish these cases from others.

Closes gh-3249

Copy link
Member Author

@takluyver takluyver commented Feb 5, 2018

I've asked on send2trash about having a more specific exception type that we could catch: arsenetar/send2trash#20


Copy link

@blink1073 blink1073 left a comment



# files on the same partition as the home directory.
file_dev = os.stat(os_path).st_dev
home_dev = os.stat(os.path.expanduser('~')).st_dev
return file_dev == home_dev

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this test doesn't do what you'd hope on GPFS (under Linux). If the directories are part of different filesets, you'll still get an EXDEV if you try to rename a file/dir from one to the other.


stefanor added a commit to stefanor/notebook that referenced this issue Dec 1, 2020
_check_trash() was added (in jupyter#3304) because TrashPermissionError didn't
exist, yet.

Now that it does, we can use it, and stop guessing what will cause a
permission problem.

Closes: jupyter#3374
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants