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

Check directory permissions before download: pip install #6762

Closed
tfolbrecht opened this issue Jul 22, 2019 · 4 comments
Closed

Check directory permissions before download: pip install #6762

tfolbrecht opened this issue Jul 22, 2019 · 4 comments
Labels
state: needs discussion This needs some more discussion type: enhancement Improvements to functionality

Comments

@tfolbrecht
Copy link

What's the problem this feature will solve?

Taking a long time to fail due to collection and downloading a package when pip install is targeting a directory the user doesn't have permissions to write to.

Describe the solution you'd like

Before pip begins collecting a package, check if the user running pip has permission to write to the target directory.

@triage-new-issues triage-new-issues bot added the S: needs triage Issues/PRs that need to be triaged label Jul 22, 2019
@chrahunt chrahunt added state: needs discussion This needs some more discussion type: enhancement Improvements to functionality labels Jul 22, 2019
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Jul 22, 2019
@tfolbrecht
Copy link
Author

I would be happy to write this feature as my first contribution to pip. New to python and curious if there's something naive about this enhancement proposal, I'll check out the code tonight.

@xavfernandez
Copy link
Member

Hello @tfolbrecht feel free to submit a PR :)
check_path_owner helper is likely to help.

@chrahunt
Copy link
Member

Some considerations:

  1. the target directory in question will vary based on --prefix, --root, --user, or the default (virtualenv or global).
  2. for most packages it's probably only the site-packages directory that matters, so only checking that should be OK IMO
  3. it might be worthwhile to check before getting the index, since that itself can take some time depending on network conditions

@tfolbrecht
Copy link
Author

Thank you all so much for the help.
Diving through the pip internals in my freetime has been a lot of fun.
I'm steadily getting there.

McSinyx added a commit to McSinyx/pip that referenced this issue Mar 12, 2020
McSinyx added a commit to McSinyx/pip that referenced this issue Jun 6, 2020
McSinyx added a commit to McSinyx/pip that referenced this issue Jul 8, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
state: needs discussion This needs some more discussion type: enhancement Improvements to functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants