Commit a239dfea authored by Hanno Schlichting's avatar Hanno Schlichting

Fixed a SandboxViolation for mkdir that could occur in certain cases. This...

Fixed a SandboxViolation for mkdir that could occur in certain cases. This closes http://bitbucket.org/tarek/distribute/issue/13. This is a backport of a patch made by PJE on setuptools trunk.

--HG--
branch : distribute
extra : rebase_source : dcce2f853c21d323a80375c19bcf94c96826aa4e
parent ad967f1d
...@@ -29,6 +29,9 @@ setuptools ...@@ -29,6 +29,9 @@ setuptools
pkg_resources pkg_resources
------------- -------------
* Fixed a SandboxViolation for mkdir that could occur in certain cases.
This closes http://bitbucket.org/tarek/distribute/issue/13.
* Allow to find_on_path on systems with tight permissions to fail gracefully. * Allow to find_on_path on systems with tight permissions to fail gracefully.
This closes http://bitbucket.org/tarek/distribute/issue/9. This closes http://bitbucket.org/tarek/distribute/issue/9.
......
...@@ -20,17 +20,17 @@ try: ...@@ -20,17 +20,17 @@ try:
except NameError: except NameError:
from sets import ImmutableSet as frozenset from sets import ImmutableSet as frozenset
from os import utime, rename, unlink # capture these to bypass sandboxing # capture these to bypass sandboxing
from os import utime, rename, unlink, mkdir
from os import open as os_open from os import open as os_open
from os.path import isdir, split
def _bypass_ensure_directory(name, mode=0777):
# Sandbox-bypassing version of ensure_directory()
dirname, filename = split(name)
if dirname and filename and not isdir(dirname):
_bypass_ensure_directory(dirname)
mkdir(dirname, mode)
...@@ -907,7 +907,7 @@ variable to point to an accessible directory. ...@@ -907,7 +907,7 @@ variable to point to an accessible directory.
extract_path = self.extraction_path or get_default_cache() extract_path = self.extraction_path or get_default_cache()
target_path = os.path.join(extract_path, archive_name+'-tmp', *names) target_path = os.path.join(extract_path, archive_name+'-tmp', *names)
try: try:
ensure_directory(target_path) _bypass_ensure_directory(target_path)
except: except:
self.extraction_error() self.extraction_error()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment