Re: [PATCH] Fix killall -USR2 anaconda writing out a traceback file.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/24/2009 04:57 PM, Chris Lumens wrote:
This hasn't worked since the switch to python-meh, though it's looked like
it has worked.  Before, dumpState would cause an exception because it hadn't
been adapted to python-meh.  This exception would then get written out as
/tmp/anaconda-tb-*, which made dumpState look like it worked.
---
  anaconda     |   22 +++++++++++++---------
  exception.py |    2 ++
  2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/anaconda b/anaconda
index 785fa7e..80ef849 100755
--- a/anaconda
+++ b/anaconda
@@ -32,6 +32,7 @@

  import sys, os, re, time, subprocess
  from optparse import OptionParser
+from tempfile import mkstemp

  # keep up with process ID of miniwm if we start it

@@ -473,13 +474,18 @@ class Anaconda:
          self.xdriver = None

      def dumpState(self):
-        from exception import AnacondaExceptionDump
+        from meh.dump import ReverseExceptionDump
          from inspect import stack as _stack
+
          # Skip the frames for dumpState and the signal handler.
          stack = _stack()[2:]
          stack.reverse()
-        exn = AnacondaExceptionDump(None, None, stack)
-        exn.write(anaconda)
+        exn = ReverseExceptionDump((None, None, stack), self.mehConfig)
+
+        (fd, filename) = mkstemp("", "anaconda-tb-", "/tmp")
+        fo = os.fdopen(fd, "w")
+
+        exn.write(self, fo)

      def writeXdriver(self, instPath="/"):
          # this should go away at some point, but until it does, we
@@ -630,9 +636,6 @@ if __name__ == "__main__":
      signal.signal(signal.SIGINT, signal.SIG_DFL)
      signal.signal(signal.SIGSEGV, isys.handleSegv)

-    # add our own additional signal handlers
-    signal.signal(signal.SIGUSR2, lambda signum, frame: anaconda.dumpState())
-
      setupEnvironment()

      pidfile = open("/var/run/anaconda.pid", "w")
@@ -965,7 +968,10 @@ if __name__ == "__main__":

      # comment out the next line to make exceptions non-fatal
      from exception import initExceptionHandling
-    initExceptionHandling(anaconda)
+    anaconda.mehConfig = initExceptionHandling(anaconda)
+
+    # add our own additional signal handlers
+    signal.signal(signal.SIGUSR2, lambda signum, frame: anaconda.dumpState())

      anaconda.setDispatch()

@@ -981,8 +987,6 @@ if __name__ == "__main__":
                 fr = None

             if fr:
-               from tempfile import mkstemp
-
                 (fw, testcase) = mkstemp(prefix='testcase.py.', dir='/tmp')
                 os.write(fw, fr.read())
                 fr.close()
diff --git a/exception.py b/exception.py
index 7decf22..b6356ad 100644
--- a/exception.py
+++ b/exception.py
@@ -125,3 +125,5 @@ def initExceptionHandling(anaconda):
                               "/proc/cmdline"])
      handler = AnacondaExceptionHandler(conf, anaconda.intf, ReverseExceptionDump)
      handler.install(anaconda)
+
+    return conf

Looks good.

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux