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 7F3F8138359 for ; Thu, 29 Oct 2020 16:34:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AA8DBE0949; Thu, 29 Oct 2020 16:34:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 790EBE0949 for ; Thu, 29 Oct 2020 16:34:52 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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 5E4B4340E2D for ; Thu, 29 Oct 2020 16:34:51 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C48123C1 for ; Thu, 29 Oct 2020 16:34:49 +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: <1603989280.cb06d0bbcf90865896f3129d7767ef0a7abb8331.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: cb06d0bbcf90865896f3129d7767ef0a7abb8331 X-VCS-Branch: pending/mattst88 Date: Thu, 29 Oct 2020 16:34:49 +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: 70c3d8de-269e-436e-9056-e42e853317cb X-Archives-Hash: 9e35878162050876806396e367d14a33 commit: cb06d0bbcf90865896f3129d7767ef0a7abb8331 Author: Matt Turner gentoo org> AuthorDate: Thu Oct 29 14:39:35 2020 +0000 Commit: Matt Turner gentoo org> CommitDate: Thu Oct 29 16:34:40 2020 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=cb06d0bb 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 bd5ba8d0..b9c220d0 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()