diff options
| author | Hanno Schlichting <hanno@hannosch.eu> | 2009-07-17 17:09:37 +0200 |
|---|---|---|
| committer | Hanno Schlichting <hanno@hannosch.eu> | 2009-07-17 17:09:37 +0200 |
| commit | a239dfea9549314e200d91f65ab50c0009359a56 (patch) | |
| tree | 0b9e7f4e8fdbb59e49df72e130dc6d22668e2bf6 /pkg_resources.py | |
| parent | ad967f1d38e608560807ff1cfc579bcabd315f4b (diff) | |
| download | python-setuptools-git-a239dfea9549314e200d91f65ab50c0009359a56.tar.gz | |
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
Diffstat (limited to 'pkg_resources.py')
| -rw-r--r-- | pkg_resources.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/pkg_resources.py b/pkg_resources.py index b22aee74..fe257754 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -20,17 +20,17 @@ try: except NameError: 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.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. extract_path = self.extraction_path or get_default_cache() target_path = os.path.join(extract_path, archive_name+'-tmp', *names) try: - ensure_directory(target_path) + _bypass_ensure_directory(target_path) except: self.extraction_error() |
