File profile_filename_cornercase.diff of Package apparmor.9915

commit 182c3e47fb3b424118a9240ab1665045c3ca4107
Author: Christian Boltz <apparmor@cboltz.de>
Date:   Wed Jan 2 20:30:54 2019 +0100

    drop failing corner-case check in logparser.py
    
    aa-logprof errors out if it hits a log event for a non-existing profile
    while a profile file with the default filename for that non-existing
    profile exists. This can for example happen after adding a profile name
    to a profile if audit.log still contains events for the attachment-based
    profile name.
    
    Since we ignore log events for non-existing profiles in general, drop
    the code for the special case "but a file matching the default filename
    for that non-existing profile exists" and also silently ignore events
    for this very special non-existing profile.
    
    References: https://bugzilla.opensuse.org/show_bug.cgi?id=1120472
    
    (cherry picked from commit 03ea5b82b783cd459978bb4c5a6076286c2ce4fa)

diff --git a/utils/apparmor/logparser.py b/utils/apparmor/logparser.py
index d531358b..f77022ea 100644
--- a/utils/apparmor/logparser.py
+++ b/utils/apparmor/logparser.py
@@ -12,7 +12,6 @@
 #    GNU General Public License for more details.
 #
 # ----------------------------------------------------------------------
-import os
 import re
 import sys
 import time
@@ -448,14 +447,7 @@ class ReadLog:
         # Check cache of profiles
         if self.active_profiles.filename_from_profile_name(program):
             return True
-        # Check the disk for profile
-        prof_path = self.get_profile_filename(program)
-        #print(prof_path)
-        if os.path.isfile(prof_path):
-            # Add to cache of profile
-            raise AppArmorBug('This should never happen, please open a bugreport!')
-            # self.active_profiles[program] = prof_path
-            # return True
+
         return False
 
     def get_profile_filename(self, profile):
openSUSE Build Service is sponsored by