Skip to content

Commit 8e7b395

Browse files
committed
Check uid on OpenBSD, NetBSD, FreeBSD before warning about root
1 parent 9f18a40 commit 8e7b395

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

news/10565.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Only warn about running pip as root on BSD systems if it is actually being run as root

src/pip/_internal/cli/req_command.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ def warn_if_run_as_root() -> None:
173173
# checks: https://mypy.readthedocs.io/en/stable/common_issues.html
174174
if sys.platform == "win32" or sys.platform == "cygwin":
175175
return
176-
if sys.platform == "darwin" or sys.platform == "linux":
176+
if (sys.platform == "darwin" or sys.platform == "linux" or
177+
sys.platform.startswith("openbsd") or sys.platform.startswith("freebsd") or
178+
sys.platform.startswith("netbsd")):
177179
if os.getuid() != 0:
178180
return
179181
logger.warning(

0 commit comments

Comments
 (0)