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
merged 1 commit into from
Feb 13, 2018

Conversation

takluyver
Copy link
Member

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

@takluyver
Copy link
Member Author

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

Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

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

Thanks!

# 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 pull request 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting notebooks is broken
4 participants