From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1334151-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id A4BC0158087
	for <garchives@archives.gentoo.org>; Thu, 28 Oct 2021 04:07:43 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id DF616E0882;
	Thu, 28 Oct 2021 04:07:42 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 7A544E0882
	for <gentoo-commits@lists.gentoo.org>; Thu, 28 Oct 2021 04:07:42 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 11FC43439F4
	for <gentoo-commits@lists.gentoo.org>; Thu, 28 Oct 2021 04:07:41 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 84E1917D
	for <gentoo-commits@lists.gentoo.org>; Thu, 28 Oct 2021 04:07:39 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1635394053.0e9e12aadb889766d61c0561b9723e71542d43e6.sam@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/
X-VCS-Repository: proj/portage
X-VCS-Files: lib/_emerge/actions.py
X-VCS-Directories: lib/_emerge/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 0e9e12aadb889766d61c0561b9723e71542d43e6
X-VCS-Branch: master
Date: Thu, 28 Oct 2021 04:07:39 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 12ac38a5-2fde-40d3-a887-6643a1393d86
X-Archives-Hash: b9837ee937c9104a19f8dfb7bf5f79fe

commit:     0e9e12aadb889766d61c0561b9723e71542d43e6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  7 03:15:09 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct 28 04:07:33 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0e9e12aa

lib/_emerge/actions.py: warn on missing /run

Newer versions of build-docbook-catalog use
/run/lock. This exposed that we weren't
asking users to mount /run in the handbook.

Check if it exists and warn if it doesn't.

This should primarily (exclusively?) be a
problem in chroots given an init system
should be creating this.

Bug: https://bugs.gentoo.org/816303
Closes: https://github.com/gentoo/portage/pull/762
Reviewed-by: Alec Warner <antarus <AT> gentoo.org>
Reviewed-by: Mike Gilbert <floppym <AT> gentoo.org>
Thanks-to: Duncan
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/_emerge/actions.py | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py
index 05a115250..515b22b66 100644
--- a/lib/_emerge/actions.py
+++ b/lib/_emerge/actions.py
@@ -2986,17 +2986,25 @@ def validate_ebuild_environment(trees):
     check_locale()
 
 
-def check_procfs():
-    procfs_path = "/proc"
-    if platform.system() not in ("Linux",) or os.path.ismount(procfs_path):
-        return os.EX_OK
-    msg = "It seems that %s is not mounted. You have been warned." % procfs_path
-    writemsg_level(
-        "".join("!!! %s\n" % l for l in textwrap.wrap(msg, 70)),
-        level=logging.ERROR,
-        noiselevel=-1,
-    )
-    return 1
+def check_mounted_fs():
+    """We need /proc for finding CPU counts and finding other system information.
+    We need /run for e.g. lock files in ebuilds."""
+    paths = {"/proc": False, "/run": False}
+
+    for path in paths.keys():
+        if platform.system() not in ("Linux",) or os.path.ismount(path):
+            paths[path] = True
+            continue
+
+        msg = "It seems %s is not mounted. Process management may malfunction." % path
+        writemsg_level(
+            "".join("!!! %s\n" % l for l in textwrap.wrap(msg, 70)),
+            level=logging.ERROR,
+            noiselevel=-1,
+        )
+
+    # Were all of the mounts we were looking for available?
+    return all(paths.values())
 
 
 def config_protect_check(trees):
@@ -3474,7 +3482,8 @@ def run_action(emerge_config):
         repo_name_check(emerge_config.trees)
         repo_name_duplicate_check(emerge_config.trees)
         config_protect_check(emerge_config.trees)
-    check_procfs()
+
+    check_mounted_fs()
 
     for mytrees in emerge_config.trees.values():
         mydb = mytrees["porttree"].dbapi