From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 CBB2B13835A for ; Thu, 29 Oct 2020 16:04:50 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A1DB3E095D; Thu, 29 Oct 2020 16:04:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7ED69E095D for ; Thu, 29 Oct 2020 16:04:49 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9B46A340E7C for ; Thu, 29 Oct 2020 16:04:48 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B6FB33CF for ; Thu, 29 Oct 2020 16:04:46 +0000 (UTC) From: "Matt Turner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Matt Turner" Message-ID: <1603987421.19c3c2302fdf02cbc6bf51076e4be1724ed0ab50.mattst88@gentoo> Subject: [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/base/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py X-VCS-Directories: catalyst/base/ X-VCS-Committer: mattst88 X-VCS-Committer-Name: Matt Turner X-VCS-Revision: 19c3c2302fdf02cbc6bf51076e4be1724ed0ab50 X-VCS-Branch: pending/mattst88 Date: Thu, 29 Oct 2020 16:04:46 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: ae96cc74-5541-4434-8091-0754284bedc2 X-Archives-Hash: c773ed7552c1e007aa78e4d9627c6d01 commit: 19c3c2302fdf02cbc6bf51076e4be1724ed0ab50 Author: Matt Turner gentoo org> AuthorDate: Thu Oct 29 14:39:35 2020 +0000 Commit: Matt Turner gentoo org> CommitDate: Thu Oct 29 16:03:41 2020 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=19c3c230 catalyst: Remove mount_safety_check() mount_safety_check() exists to prevent bad things from happening if a previous catalyst invocation left bind mounts active in the chroot. E.g., a previous catalyst invocation is interrupted without unmounting the bind mounts. A new catalyst invocation runs and cleans the old chroot, which inadvertently deletes files outside of the chroot via the bind mounts. With all the mounts now inside a namespace, it is no longer possible to have mounts accessible outside the build sequence. In fact, I think this code has been unnecessary since commit e5a53e42 ("catalyst: create namespaces for building"). Signed-off-by: Matt Turner gentoo.org> catalyst/base/stagebase.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 4e959f3f..1f84965a 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -638,39 +638,7 @@ class StageBase(TargetBase, ClearBase, GenBase): assert self.settings[verify] == "blake2" self.settings.setdefault("gk_mainargs", []).append("--b2sum") - def mount_safety_check(self): - """ - Check and verify that none of our paths in mypath are mounted. We don't - want to clean up with things still mounted, and this allows us to check. - Returns 1 on ok, 0 on "something is still mounted" case. - """ - - if not os.path.exists(self.settings["chroot_path"]): - return - - log.debug('self.mount = %s', self.mount) - for x in [x for x in self.mount if self.mount[x]['enable']]: - target = normpath(self.settings['chroot_path'] + - self.mount[x]['target']) - log.debug('mount_safety_check() x = %s %s', x, target) - if not os.path.exists(target): - continue - - if ismount(target): - # Something is still mounted - try: - log.warning( - '%s is still mounted; performing auto-bind-umount...', target) - # Try to umount stuff ourselves - self.unbind() - if ismount(target): - raise CatalystError("Auto-unbind failed for " + target) - log.notice('Auto-unbind successful...') - except CatalystError: - raise CatalystError("Unable to auto-unbind " + target) - def unpack(self): - clst_unpack_hash = self.resume.get("unpack") # Set up all unpack info settings @@ -755,8 +723,6 @@ class StageBase(TargetBase, ClearBase, GenBase): % self.settings["source_path"]) if _unpack: - self.mount_safety_check() - if invalid_chroot: if "autoresume" in self.settings["options"]: log.notice( @@ -1363,9 +1329,6 @@ class StageBase(TargetBase, ClearBase, GenBase): def run(self): self.chroot_lock.write_lock() - # Check for mounts right away and abort if we cannot unmount them - self.mount_safety_check() - if "clear-autoresume" in self.settings["options"]: self.clear_autoresume()