public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
From: Miloslav Trmac <mitr@redhat.com>
To: Dan Gruhn <Dan.Gruhn@groupw.com>
Cc: linux-audit@redhat.com
Subject: Re: audit-viewer
Date: Thu, 19 Feb 2009 16:31:49 -0500 (EST)	[thread overview]
Message-ID: <1513422227.89131235079109889.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com> (raw)
In-Reply-To: <1162925222.89101235079087226.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 597 bytes --]

----- "Dan Gruhn" <Dan.Gruhn@groupw.com> wrote:
> I have audit-viewer-0.4 and get the following error from "make
> install"
> 
> Byte-compiling python modules...
> client.py dialog_base.py event_dialog.py event_source.py filters.py 
> format_versions.py list_properties.py list_tab.py  File 
> "/usr/local/share/audit-viewer/list_tab.py", line 558
>     store_data[column + 1] = l.pop(0) if l else ''
>                                        ^
> SyntaxError: invalid syntax
> 
> Is it just me or should I try the 0.3 version?
Please apply the attached patch against the src subdirectory.
    Mirek

[-- Attachment #2: av.patch --]
[-- Type: application/octet-stream, Size: 4114 bytes --]

diff -ur av-orig/event_source.py /usr/share/audit-viewer/event_source.py
--- av-orig/event_source.py	2008-12-05 09:51:29.000000000 +0100
+++ /usr/share/audit-viewer/event_source.py	2008-12-05 12:35:04.000000000 +0100
@@ -15,7 +15,6 @@
 # permission of Red Hat, Inc.
 #
 # Red Hat Author: Miloslav Trmac <mitr@redhat.com>
-import collections
 import datetime
 import re
 
@@ -108,7 +107,7 @@
         # This function is time critical, so it is a bit ugly.  "#o" comments
         # contain the "nice" version of some constructs
         parser = self._create_parser()
-        events = collections.defaultdict(Event)
+        events = {}
 
         parser.search_set_stop(auparse.AUSEARCH_STOP_EVENT)
         if len(filters) > 0:
@@ -135,11 +134,13 @@
         while next_event_fn():
             ts = parser_get_timestamp()
             # FIXME: ts.host seems to be valid only until the next event is read
-            e = events[(ts.serial, ts.sec, ts.milli)]
-            # The Event() constructor does not have access to ts.  Most events
-            # have only a single record, so this usually does not overwrite the
-            # ID unnecessarily.
-            e.id = ts
+            event_key = (ts.serial, ts.sec, ts.milli)
+            try:
+                e = events[event_key]
+            except KeyError:
+                e = Event()
+                e.id = ts
+                events[event_key] = e
             if parser_first_record():
                 e_fields = e.fields
                 while 1: #o while True:
diff -ur av-orig/filters.py /usr/share/audit-viewer/filters.py
--- av-orig/filters.py	2008-12-05 09:51:30.000000000 +0100
+++ /usr/share/audit-viewer/filters.py	2008-12-05 12:30:20.000000000 +0100
@@ -18,7 +18,7 @@
 import datetime
 from gettext import gettext as _, ngettext
 import time
-import xml.etree.cElementTree as cElementTree
+import cElementTree
 
 import auparse
 
diff -ur av-orig/list_tab.py /usr/share/audit-viewer/list_tab.py
--- av-orig/list_tab.py	2008-12-05 09:51:30.000000000 +0100
+++ /usr/share/audit-viewer/list_tab.py	2008-12-05 12:31:56.000000000 +0100
@@ -18,7 +18,7 @@
 import csv
 from gettext import gettext as _
 import time
-import xml.etree.cElementTree as cElementTree
+import cElementTree
 
 import gobject
 import gtk
@@ -555,7 +555,10 @@
             for (column, title) in enumerate(self.__field_columns):
                 l = event_fields_get(title, None)
                 # "if l" == "if l is not None and len(l) > 0'
-                store_data[column + 1] = l.pop(0) if l else ''
+                if l:
+                    store_data[column + 1] = l.pop(0)
+                else:
+                    store_data[column + 1] = ''
             events.append((sort_key, tuple(store_data)))
         events.sort(key = lambda event: event[0], reverse = self.sort_reverse)
         return events
diff -ur av-orig/main_window.py /usr/share/audit-viewer/main_window.py
--- av-orig/main_window.py	2008-12-05 09:51:30.000000000 +0100
+++ /usr/share/audit-viewer/main_window.py	2008-12-05 12:29:55.000000000 +0100
@@ -19,7 +19,7 @@
 from gettext import gettext as _
 
 import os
-import xml.etree.cElementTree as cElementTree
+import cElementTree
 
 import gobject
 import gtk
diff -ur av-orig/statistic.py /usr/share/audit-viewer/statistic.py
--- av-orig/statistic.py	2008-12-05 09:51:31.000000000 +0100
+++ /usr/share/audit-viewer/statistic.py	2008-12-05 12:30:32.000000000 +0100
@@ -18,7 +18,7 @@
 import datetime
 from gettext import gettext as _, ngettext
 import time
-import xml.etree.cElementTree as cElementTree
+import cElementTree
 
 from filters import FieldFilter, TimestampFilter
 import format_versions
diff -ur av-orig/tab.py /usr/share/audit-viewer/tab.py
--- av-orig/tab.py	2008-12-05 09:51:32.000000000 +0100
+++ /usr/share/audit-viewer/tab.py	2008-12-05 12:30:36.000000000 +0100
@@ -17,7 +17,7 @@
 # Red Hat Author: Miloslav Trmac <mitr@redhat.com>
 from gettext import gettext as _
 import copy
-import xml.etree.cElementTree as cElementTree
+import cElementTree
 
 from dialog_base import DialogBase
 from filters import Filter

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



       reply	other threads:[~2009-02-19 21:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1162925222.89101235079087226.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>
2009-02-19 21:31 ` Miloslav Trmac [this message]
2009-02-20 17:36   ` audit-viewer Dan Gruhn
2009-02-20 20:32     ` audit-viewer Miloslav Trmac
2009-03-02 16:38       ` audit-viewer Dan Gruhn
     [not found] <1241228806.180461236014459986.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>
2009-03-02 17:22 ` audit-viewer Miloslav Trmac
2009-03-02 20:59   ` audit-viewer Dan Gruhn
2009-03-02 21:07     ` audit-viewer Miloslav Trmac
2009-02-19 21:09 audit-viewer Dan Gruhn
2009-02-19 21:20 ` audit-viewer Steve Grubb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1513422227.89131235079109889.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com \
    --to=mitr@redhat.com \
    --cc=Dan.Gruhn@groupw.com \
    --cc=linux-audit@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox