diff options
author | Matt Turner <mattst88@gentoo.org> | 2020-10-29 10:39:35 -0400 |
---|---|---|
committer | Matt Turner <mattst88@gentoo.org> | 2020-10-30 18:40:52 -0400 |
commit | 595ab9922f4ed8f88148ca7fbc9fe533db63fb4c (patch) | |
tree | 685c61896aaf95b7bd5c7cbd91e78c212cce659d /catalyst | |
parent | catalyst: Remove kill_support_pids() (diff) | |
download | catalyst-595ab9922f4ed8f88148ca7fbc9fe533db63fb4c.tar.gz catalyst-595ab9922f4ed8f88148ca7fbc9fe533db63fb4c.tar.bz2 catalyst-595ab9922f4ed8f88148ca7fbc9fe533db63fb4c.zip |
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 <mattst88@gentoo.org>
Diffstat (limited to 'catalyst')
-rw-r--r-- | catalyst/base/stagebase.py | 37 |
1 files changed, 0 insertions, 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() |