Skip to content

/tmp/pip-build can't be shared by several linux users #729

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

Closed
guettli opened this issue Nov 20, 2012 · 10 comments
Closed

/tmp/pip-build can't be shared by several linux users #729

guettli opened this issue Nov 20, 2012 · 10 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@guettli
Copy link

guettli commented Nov 20, 2012

A second bug related to the fixed temporary directory /tmp/pip-build.

This does not work if several linux-users use pip.

First user was modwork_egs_d and now the second user modwork_vums_dt tries to use pip:

modwork_vums_dt@workepdevel113:~$ pip install --user pep8
Downloading/unpacking pep8
  Downloading pep8-1.3.3.tar.gz
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/pip-1.2.1.post1-py2.6.egg/pip/basecommand.py", line 107, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.6/site-packages/pip-1.2.1.post1-py2.6.egg/pip/commands/install.py", line 263, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/local/lib/python2.6/site-packages/pip-1.2.1.post1-py2.6.egg/pip/req.py", line 1032, in prepare_files
    self.unpack_url(url, location, self.is_download)
  File "/usr/local/lib/python2.6/site-packages/pip-1.2.1.post1-py2.6.egg/pip/req.py", line 1159, in unpack_url
    retval = unpack_http_url(link, location, self.download_cache, self.download_dir)
  File "/usr/local/lib/python2.6/site-packages/pip-1.2.1.post1-py2.6.egg/pip/download.py", line 481, in unpack_http_url
    unpack_file(temp_location, location, content_type, link)
  File "/usr/local/lib/python2.6/site-packages/pip-1.2.1.post1-py2.6.egg/pip/util.py", line 558, in unpack_file
    untar_file(filename, location)
  File "/usr/local/lib/python2.6/site-packages/pip-1.2.1.post1-py2.6.egg/pip/util.py", line 472, in untar_file
    os.makedirs(location)
  File "/usr/lib64/python2.6/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/tmp/pip-build/pep8'

Storing complete log in /home/modwork_vums_dt/.config/pip/pip.log

modwork_vums_dt@workepdevel113:~$ ls -l /tmp/pip-build/
-rw-r--r-- 1 modwork_egs_d modwork_egs_d 185 20. Nov 12:27 pip-delete-this-directory.txt

modwork_vums_dt@workepdevel113:~$ pip --version
pip 1.2.1.post1 from /usr/local/lib/python2.6/site-packages/pip-1.2.1.post1-py2.6.egg (python 2.6)

Related: #725

@guettli
Copy link
Author

guettli commented Nov 20, 2012

I found a workaround:

export TMPDIR=$HOME/tmp
mkdir -p $TMPDIR
pip install --user ...

d1b added a commit to d1b/pip that referenced this issue Nov 23, 2012
Signed-off-by: David <[email protected]>
@chrismatta
Copy link

Just got bit by this as well. The workaround is fine, but the mode for /tmp/pip-build really should inherit /tmp's permissions.

@guettli
Copy link
Author

guettli commented Jan 21, 2013

I use "export TMPDIR=$HOME/tmp" in my environment now. But fixing this would be nice.

@guettli
Copy link
Author

guettli commented Jan 21, 2013

@chrismatta please explain which permissions from /tmp should be inherited. I don't think the sticky bit from /tmp should be used for the pip-build.

@chrismatta
Copy link

@guiettli I guess it has to do with one's philosophy of what /tmp is for. Traditionally on linux /tmp has been scratch space where anyone can read and write to, so I don't see why making pip-build 0777 would be an issue.

We ran into this recently after multiple users were tyring to install modules into thier pythonbrew environmetns, which doesn't seem to set $TMPDIR, so pip uses the /tmp dir.

@guettli
Copy link
Author

guettli commented Jan 23, 2013

If you can inject code from one user to the next it is a big security problem. But somehow nobody seems to care.

@d1b
Copy link
Contributor

d1b commented Jan 23, 2013

@chrismatta as @guettli has mentioned out this would introduce a security flaw. What functionality would be provided by letting other users read and write to a given user's temporary pip-build directory (other than introducing a security flaw) ?

@chrismatta
Copy link

So why use /tmp at all? Or maybe pip should use /tmp/pip-build-uid for each user. This is probably more a pythonbrew issue than a pip issue in reality.

@guettli
Copy link
Author

guettli commented Jan 24, 2013

@chrismatta that is what this pull request does: os.path.join(tempfile.gettempdir(), 'pip-build-%s' % getpass.getuser())

https://github.com/pypa/pip/pull/734/files

d1b added a commit to d1b/pip that referenced this issue Jan 25, 2013
Signed-off-by: David <[email protected]>
@qwcode
Copy link
Contributor

qwcode commented Jan 26, 2013

addressed in pull #780

@qwcode qwcode closed this as completed Jan 26, 2013
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 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

No branches or pull requests

4 participants