Gentoo Archives: gentoo-commits

From: "Markos Chandras (hwoarang)" <hwoarang@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-firewall/ufw-frontends/files: ufw-frontends-0.3.2-no-log-crash.patch
Date: Sat, 29 Mar 2014 14:09:08
Message-Id: 20140329140901.4678120057@flycatcher.gentoo.org
1 hwoarang 14/03/29 14:09:01
2
3 Added: ufw-frontends-0.3.2-no-log-crash.patch
4 Log:
5 Revbump with upstream patch to fix crash when no log file is found. Thanks to Sławomir Nizio <slawomir.nizio@×××××××.org>
6
7 (Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key 09BF4F54C2BA7F3C!)
8
9 Revision Changes Path
10 1.1 net-firewall/ufw-frontends/files/ufw-frontends-0.3.2-no-log-crash.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-firewall/ufw-frontends/files/ufw-frontends-0.3.2-no-log-crash.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-firewall/ufw-frontends/files/ufw-frontends-0.3.2-no-log-crash.patch?rev=1.1&content-type=text/plain
14
15 Index: ufw-frontends-0.3.2-no-log-crash.patch
16 ===================================================================
17 From e7bcf87788588c3a38ce18c9a8d69bbe156860e9 Mon Sep 17 00:00:00 2001
18 From: =?UTF-8?q?S=C5=82awomir=20Nizio?= <slawomir.nizio@×××××××.org>
19 Date: Mon, 3 Mar 2014 08:31:47 +0100
20 Subject: [PATCH] Fix crash when no log in supported location can be found
21
22 This can happen for example on systems that use Journal
23 from systemd.
24
25 In this case, ufw-gtk exits with a traceback containing:
26 IOError: [Errno 2] No such file or directory: '/var/log/messages.log'
27 (this is the last log file tried).
28
29 The patch works around the issue by handling the error
30 and disabling the widget in the "Events" tab.
31 ---
32 gfw/frontend_gtk.py | 18 +++++++++++++-----
33 1 file changed, 13 insertions(+), 5 deletions(-)
34
35 diff --git a/gfw/frontend_gtk.py b/gfw/frontend_gtk.py
36 index 75ebb33..75dfde0 100644
37 --- a/gfw/frontend_gtk.py
38 +++ b/gfw/frontend_gtk.py
39 @@ -33,14 +33,21 @@ from gfw.frontend import Frontend
40
41 class Notifier(gfw.event.Notifier):
42
43 - def __init__(self, callback):
44 - gfw.event.Notifier.__init__(self, callback)
45 + def __init__(self, callback, inactive_handler):
46 + self._active = False
47 + try:
48 + gfw.event.Notifier.__init__(self, callback)
49 + except IOError:
50 + inactive_handler()
51 + return
52 + self._active = True
53 self._w = gobject.io_add_watch(self._fd, gobject.IO_IN | gobject.IO_PRI,
54 self._trigger)
55
56 def __del__(self):
57 - gfw.event.Notifier.__del__(self)
58 - gobject.source_remove(self._w)
59 + if self._active:
60 + gfw.event.Notifier.__del__(self)
61 + gobject.source_remove(self._w)
62
63
64 class Builder(gtk.Builder):
65 @@ -90,7 +97,8 @@ class GtkFrontend(Frontend):
66 data = (timestamp, event, conn['IN'], conn['OUT'], conn['PROTO'],
67 conn['SRC'], spt, conn['DST'], dpt)
68 self.ui.events_model.append(data)
69 - self._notifier = Notifier(callback)
70 + self._notifier = Notifier(callback,
71 + lambda: self.ui.events_view.set_sensitive(False))
72 self.ui.main_window.show_all()
73 ## FIXME: for the 0.3.0 release, hide the tab for the connections view
74 page = self.ui.view.get_nth_page(2)
75 --
76 1.9.0