PATCH 1/3 replaces the temporary code for saving the traceback with python-meh's ui invocation. It also adds sys.exit(0) call to the end of the showError method which conforms to the documentation in the pyanaconda/ui/__init__.py (see e6f4db9d93a95ad932bf733c585b336db34c1d56 for the original code)
PATCH 2/3 removes the os.kill call that killed anaconda when the pdb session was quit which left no way to report a bug with the python-meh/libreport ui. Moreover it adds an attempt to switch back to tty6 when the pdb session is quit.
I believe we have finally settled on the python-meh's main window look and I can build a new version tomorrow. The related libreport patch is going to be pushed soon and a new build of libreport will follow in the end of this week. Once these steps are done, I'd like to push these patches to start using python-meh gui in the newui images.
Vratislav Podzimek (3): Get back to python-meh UI in exception handling Just switch back to tty6 when 'c' is used in the post-mortem pdb session Display the hint how to quit the debugger
pyanaconda/exception.py | 26 +++++++++++++++----------- pyanaconda/ui/gui/__init__.py | 2 ++ 2 files changed, 17 insertions(+), 11 deletions(-)
Now that python-meh is ported to Gtk3, we can again use its UI in exception handling. --- pyanaconda/exception.py | 19 +++++++++---------- pyanaconda/ui/gui/__init__.py | 2 ++ 2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py index 5c90166..28f4225 100644 --- a/pyanaconda/exception.py +++ b/pyanaconda/exception.py @@ -37,16 +37,15 @@ log = logging.getLogger("anaconda")
class AnacondaExceptionHandler(ExceptionHandler): def handleException(self, (ty, value, tb), obj): - import traceback - - # Save the exception to the filesystem first. - self.exn = self.exnClass((ty, value, tb), self.conf) - (fd, self.exnFile) = self.openFile() - text = self.exn.write(obj, fd) - fd.close() - - traceback.print_exception(ty, value, tb) - os._exit(10) + if issubclass(ty, storage.errors.StorageError) and value.hardware_fault: + hw_error_msg = _("The installation was stopped due to what " + "seems to be a problem with your hardware. " + "The exact error message is:\n\n%s.\n\n " + "The installer will now terminate.") % str(value) + self.intf.showError(hw_error_msg) + else: + super(AnacondaExceptionHandler, self).handleException((ty, value, tb), + obj)
def postWriteHook(self, (ty, value, tb), anaconda): # See if /mnt/sysimage is present and put exception there as well diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py index 3d2fff9..4d3ea3a 100644 --- a/pyanaconda/ui/gui/__init__.py +++ b/pyanaconda/ui/gui/__init__.py @@ -116,6 +116,8 @@ class GraphicalUserInterface(UserInterface): dlg.run() dlg.destroy()
+ sys.exit(0) + def showYesNoQuestion(self, message): from gi.repository import AnacondaWidgets, Gtk
diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py index 3d2fff9..4d3ea3a 100644 --- a/pyanaconda/ui/gui/__init__.py +++ b/pyanaconda/ui/gui/__init__.py @@ -116,6 +116,8 @@ class GraphicalUserInterface(UserInterface): dlg.run() dlg.destroy()
sys.exit(0)- def showYesNoQuestion(self, message): from gi.repository import AnacondaWidgets, Gtk
We don't want to exit here. Instead, your caller of showError above should handle deciding whether to exit or not.
Aside from that one change, everything else looks fine. If you fix that and go ahead and push, I'll do another build for today (I've got to do one anyway, I might as well wait).
- Chris
Killing ananconda left no way to report a bug via python-meh/libreport once user entered the post-mortem pdb session. --- pyanaconda/exception.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py index 28f4225..6e93e42 100644 --- a/pyanaconda/exception.py +++ b/pyanaconda/exception.py @@ -98,7 +98,10 @@ class AnacondaExceptionHandler(ExceptionHandler): print("\nEntering debugger...") import pdb pdb.post_mortem (tb) - os.kill(os.getpid(), signal.SIGKILL) + try: + isys.vtActivate(6) + except SystemError: + pass
def initExceptionHandling(anaconda): fileList = [ "/tmp/anaconda.log",
People usually don't know that 'continue' command quits the debugger, so display them a little hint. --- pyanaconda/exception.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py index 6e93e42..b8529e0 100644 --- a/pyanaconda/exception.py +++ b/pyanaconda/exception.py @@ -96,6 +96,8 @@ class AnacondaExceptionHandler(ExceptionHandler): termios.tcsetattr(si, termios.TCSADRAIN, attr)
print("\nEntering debugger...") + print("Use 'continue' command to quit the debugger and get back to "\ + "the main window") import pdb pdb.post_mortem (tb) try:
anaconda-patches@lists.fedorahosted.org