-
Notifications
You must be signed in to change notification settings - Fork 3k
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
/tmp/pip-build fixes #780
/tmp/pip-build fixes #780
Conversation
… error message if the fd could not be opened (denied). Signed-off-by: David <db@d1b.org>
…s.exit()'ing and also document that on windows user temp directories are already isolated. Signed-off-by: David <db@d1b.org>
… directory is in fact owned by another user - add the os.O_NOFOLLOW flag to not follow symbolic links. Signed-off-by: David <db@d1b.org>
… use of the_get_build_prefix method to create a user specific build_prefix directory. Signed-off-by: David <db@d1b.org>
Signed-off-by: David <db@d1b.org>
def _get_build_prefix(): | ||
""" Returns a safe build_prefix """ | ||
path = os.path.join(tempfile.gettempdir(), 'pip-build-%s' % \ | ||
getpass.getuser()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getpass.getuser() returns the value in the LOGNAME environment variable, so this doesn't work under sudo:
$ sudo LOGNAME=foo python
Python 2.6.6 (r266:84292, Oct 12 2012, 14:23:48)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import getpass
getpass.getuser()
'foo'
This should be based off of os.geteuid()
$ sudo LOGNAME=foo python
Python 2.6.6 (r266:84292, Oct 12 2012, 14:23:48)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import os
import pwd
pwd.getpwuid(os.geteuid()).pw_name
'root'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue for this: #982
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect LOGNAME to be 'root' under sudo.
I see that on ubuntu and centos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timjr yes it should have been based off os.geteuid(), but getpass.getuser() is supported on windows and linux and so I used that.
fixes and doc/changelog updates on top of commits from pull #734