diff --git a/emit-a-warning-when-running-with-root-privileges.patch b/emit-a-warning-when-running-with-root-privileges.patch new file mode 100644 index 0000000..ecc2df5 --- /dev/null +++ b/emit-a-warning-when-running-with-root-privileges.patch @@ -0,0 +1,30 @@ +From 5023ea0feceb5a9cc4931f6be9404d4582cb8502 Mon Sep 17 00:00:00 2001 +From: Tomas Orsava +Date: Tue, 14 Feb 2017 17:10:09 +0100 +Subject: [PATCH] Emit a warning when running with root privileges + +--- + pip/commands/install.py | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/pip/commands/install.py b/pip/commands/install.py +index b7e662bd..c1bcf3b5 100644 +--- a/pip/commands/install.py ++++ b/pip/commands/install.py +@@ -192,6 +192,13 @@ class InstallCommand(RequirementCommand): + cmdoptions.resolve_wheel_no_use_binary(options) + cmdoptions.check_install_build_global(options) + ++ # Check whether we have root privileges ++ if os.getuid() == 0: ++ logger.warning( ++ "WARNING: Running pip install with root privileges is " ++ "generally not advised. Try `pip install --user` instead." ++ ) ++ + if options.as_egg: + warnings.warn( + "--egg has been deprecated and will be removed in the future. " +-- +2.11.0 + diff --git a/python-pip.spec b/python-pip.spec index 51e162b..e58c6f3 100644 --- a/python-pip.spec +++ b/python-pip.spec @@ -17,7 +17,7 @@ Name: python-%{srcname} Version: 9.0.1 -Release: 5%{?dist} +Release: 6%{?dist} Summary: A tool for installing and managing Python packages Group: Development/Libraries @@ -38,6 +38,11 @@ Source1: pip-9.0.1-tests.tar.gz # https://github.com/pypa/pip/issues/1351 Patch0: allow-stripping-given-prefix-from-wheel-RECORD-files.patch +# Downstream only patch +# Emit a warning to the user if pip install is run with root privileges +# Issue upstream: https://github.com/pypa/pip/issues/4288 +Patch1: emit-a-warning-when-running-with-root-privileges.patch + %description Pip is a replacement for `easy_install `_. It uses mostly the @@ -114,6 +119,7 @@ tar -xf %{SOURCE1} %endif %patch0 -p1 +%patch1 -p1 sed -i '1d' pip/__init__.py @@ -238,6 +244,9 @@ py.test-%{python3_version} -m 'not network' %endif # with_python3 %changelog +* Tue Feb 14 2017 Tomas Orsava - 9.0.1-6 +- Added patch 1: Emit a warning when running with root privileges + * Sat Feb 11 2017 Fedora Release Engineering - 9.0.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild