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

/tmp/pip-build fixes #780

Merged
merged 11 commits into from
Jan 26, 2013
Merged

/tmp/pip-build fixes #780

merged 11 commits into from
Jan 26, 2013

Conversation

qwcode
Copy link
Contributor

@qwcode qwcode commented Jan 26, 2013

fixes and doc/changelog updates on top of commits from pull #734

d1b and others added 11 commits January 25, 2013 23:12
Signed-off-by: David <db@d1b.org>
… 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>
qwcode added a commit that referenced this pull request Jan 26, 2013
@qwcode qwcode merged commit 6961e33 into pypa:develop Jan 26, 2013
def _get_build_prefix():
""" Returns a safe build_prefix """
path = os.path.join(tempfile.gettempdir(), 'pip-build-%s' % \
getpass.getuser())
Copy link

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'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

issue for this: #982

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants