Hello, I had already submitted that to the bug tracker and I though it was approved, but I think it didn't get applied:
http://fedorahosted.org/mock/ticket/4 I've got it updated to work with the current master and to solve an issue with tmpfs as well. I'm attaching it as well. this should address Paul Howarth patch 2/5 as well; it seems pointless to me to reverse a structure and then reverse it again after using it, it's better to have a copy of it reversed "on the fly" when using it. BTW, Paul, how many times is _umountall() called in your code? I thought it ought to be called just once! -- Alan Franzoni contact me at pub...@[mysurname].eu
diff --git a/py/mock/backend.py b/py/mock/backend.py index eb97219..1a8c0bb 100644 --- a/py/mock/backend.py +++ b/py/mock/backend.py @@ -632,12 +632,26 @@ class Root(object): decorate(traceLog()) def _umountall(self): """umount all mounted chroot fs.""" - # Unwind mounts by umounting in the opposite order of the mounts - umountCmds = self.umountCmds - umountCmds.reverse() - for cmd in umountCmds: + # first try removing all expected mountpoints. + for cmd in self.umountCmds: self.root_log.debug(cmd) - mock.util.do(cmd, raiseExc=0, shell=True) + try: + mock.util.do(cmd, raiseExc=1, shell=True) + except mock.exception.Error, e: + # the exception already contains info about the error. + self.root_log.warning(e) + # then remove anything that might be left around. + mountpoints = open("/proc/mounts").read().strip().split("\n") + # umount in reverse mount order to prevent nested mount issues that + # may prevent clean unmount. + for mountline in reversed(mountpoints): + mountpoint = mountline.split()[1] + if os.path.realpath(mountpoint).startswith(os.path.realpath( + self.makeChrootPath() + "/")): + cmd = "umount -n %s" % mountpoint + self.root_log.warning("Forcibly unmounting '%s' from chroot." % + mountpoint) + mock.util.do(cmd, raiseExc=0, shell=True) decorate(traceLog()) def _yum(self, cmd, returnOutput=0):
-- buildsys mailing list buildsys@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/buildsys