Skip to content

Commit

Permalink
Check uid on OpenBSD, NetBSD, FreeBSD before warning about root
Browse files Browse the repository at this point in the history
  • Loading branch information
n1000 committed Oct 10, 2021
1 parent 9f18a40 commit 8e7b395
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/10565.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Only warn about running pip as root on BSD systems if it is actually being run as root
4 changes: 3 additions & 1 deletion src/pip/_internal/cli/req_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ def warn_if_run_as_root() -> None:
# checks: https://mypy.readthedocs.io/en/stable/common_issues.html
if sys.platform == "win32" or sys.platform == "cygwin":
return
if sys.platform == "darwin" or sys.platform == "linux":
if (sys.platform == "darwin" or sys.platform == "linux" or
sys.platform.startswith("openbsd") or sys.platform.startswith("freebsd") or
sys.platform.startswith("netbsd")):
if os.getuid() != 0:
return
logger.warning(
Expand Down

0 comments on commit 8e7b395

Please sign in to comment.