From 86205b1facd6f357cfd0f1776657af9f0674ec28 Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Sat, 3 Jan 2015 04:00:15 -0500 Subject: [PATCH] Merge pull request #2311 from dstufft/fix-windows-more Remove some other places we called os.geteuid() (cherry picked from commit 40ef6da47a75fb4cc2b34de05ac680c38b27537f) --- CHANGES.txt | 2 ++ pip/basecommand.py | 2 +- pip/download.py | 2 +- pip/utils/filesystem.py | 2 +- pip/utils/outdated.py | 3 +-- tests/unit/test_unit_outdated.py | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index f122e0967..a3ec48c0e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,7 @@ **6.0.6 (2015-01-03)** +* Continue the regression fix from 6.0.5 which was not a complete fix. + **6.0.5 (2015-01-03)** diff --git a/pip/basecommand.py b/pip/basecommand.py index 1612909f8..28e22b673 100644 --- a/pip/basecommand.py +++ b/pip/basecommand.py @@ -119,7 +119,7 @@ class Command(object): # Ensure that the path for our debug log is owned by the current user # and if it is not, disable the debug log. - write_debug_log = check_path_owner(debug_log_path, os.geteuid()) + write_debug_log = check_path_owner(debug_log_path) logging_dictConfig({ "version": 1, diff --git a/pip/download.py b/pip/download.py index 5ba175926..935f301ab 100644 --- a/pip/download.py +++ b/pip/download.py @@ -234,7 +234,7 @@ class SafeFileCache(FileCache): # we will check the parent directory until we find one that does exist. # If it is not owned by the user executing pip then we will disable # the cache and log a warning. - if not check_path_owner(self.directory, os.geteuid()): + if not check_path_owner(self.directory): logger.warning( "The directory '%s' or its parent directory is not owned by " "the current user and the cache has been disabled. Please " diff --git a/pip/utils/filesystem.py b/pip/utils/filesystem.py index 445baa320..fc8284fa8 100644 --- a/pip/utils/filesystem.py +++ b/pip/utils/filesystem.py @@ -4,7 +4,7 @@ import os.path from pip.compat import get_path_uid -def check_path_owner(path, uid): +def check_path_owner(path): # If we don't have a way to check the effective uid of this process, then # we'll just assume that we own the directory. if not hasattr(os, "geteuid"): diff --git a/pip/utils/outdated.py b/pip/utils/outdated.py index 54baa2930..6f37bc691 100644 --- a/pip/utils/outdated.py +++ b/pip/utils/outdated.py @@ -60,8 +60,7 @@ class GlobalSelfCheckState(object): def save(self, pypi_version, current_time): # Check to make sure that we own the directory - if not check_path_owner( - os.path.dirname(self.statefile_path), os.geteuid()): + if not check_path_owner(os.path.dirname(self.statefile_path)): return # Now that we've ensured the directory is owned by this user, we'll go diff --git a/tests/unit/test_unit_outdated.py b/tests/unit/test_unit_outdated.py index b66085cba..67023a165 100644 --- a/tests/unit/test_unit_outdated.py +++ b/tests/unit/test_unit_outdated.py @@ -128,7 +128,7 @@ def test_global_state(monkeypatch): def fake_lock(filename): yield - monkeypatch.setattr(outdated, "check_path_owner", lambda p, u: True) + monkeypatch.setattr(outdated, "check_path_owner", lambda p: True) monkeypatch.setattr(lockfile, 'LockFile', fake_lock)