[Ocfs2-tools-devel] [PATCH]ocfs2console: Restore previous warning filter aftre importing gtk in ocfs2console

Hu.Ziming hzmangel at gmail.com
Sat Feb 7 06:46:14 PST 2009


Setting the filter of warnings module will change the segmental fault of
program ocfs2console to a exception when the DISPLAY is set incorrectly. But
some unwanted warning message will be printed due to this solution. Reseting
the warning filter after importing gtk module will solve this problem, but
some filter in the default runtime environment will also be purged, which will
leads to some other problems.

The warning filter is saved as a list in the runtime environment. The new
patch will just pop the new added 'error' filter out of the list instead of
reset the list.

Signed-off-by: Hu Ziming <huzim at cn.ibm.com>
---
 ocfs2console/ocfs2console |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ocfs2console/ocfs2console b/ocfs2console/ocfs2console
index 26974bc..5130d52 100755
--- a/ocfs2console/ocfs2console
+++ b/ocfs2console/ocfs2console
@@ -24,7 +24,7 @@ system: %s\n''' % e
        print >>sys.stderr, '''ERROR: ocfs2console needs an X11 display.
 Make sure a proper setup for your display environment exists.\n'''
    sys.exit(1)
-warnings.resetwarnings()
+warnings.filters.pop(0)

 if nodeconf:
    from ocfs2interface.nodeconfig import node_config



More information about the Ocfs2-tools-devel mailing list