[apparmor] [patch] Drop unused matchregexp(), commonsuffix() and commonprefix() from aa.py
Christian Boltz
apparmor at cboltz.de
Sat Oct 1 23:18:15 UTC 2016
Hello,
$subject.
matchregexp() was the last user of convert_regexp() in aa.py, so we
don't need to import it anymore.
[ 02-drop-matchregexp-commonprefix-commonsuffix-from-aa.py.diff ]
--- utils/apparmor/aa.py 2016-10-01 21:01:03.863002592 +0200
+++ utils/apparmor/aa.py 2016-10-02 00:18:38.298646321 +0200
@@ -34,7 +34,7 @@
from apparmor.aare import AARE
from apparmor.common import (AppArmorException, AppArmorBug, open_file_read, valid_path, hasher,
- open_file_write, convert_regexp, DebugLogger)
+ open_file_write, DebugLogger)
import apparmor.ui as aaui
@@ -3687,42 +3687,6 @@
else:
return '%s^%s' % (name1, name2)
-def commonprefix(new, old):
- match = re.search(r'^([^\0]*)[^\0]*(\0\1[^\0]*)*$', '\0'.join([new, old]))
- if match:
- return match.groups()[0]
- return match
-
-def commonsuffix(new, old):
- match = commonprefix(new[-1::-1], old[-1::-1])
- if match:
- return match[-1::-1]
-
-def matchregexp(new, old):
- if re.search('\{.*(\,.*)*\}', old):
- return None
-
-# if re.search('\[.+\]', old) or re.search('\*', old) or re.search('\?', old):
-#
-# new_reg = convert_regexp(new)
-# old_reg = convert_regexp(old)
-#
-# pref = commonprefix(new, old)
-# if pref:
-# if convert_regexp('(*,**)$') in pref:
-# pref = pref.replace(convert_regexp('(*,**)$'), '')
-# new = new.replace(pref, '', 1)
-# old = old.replace(pref, '', 1)
-#
-# suff = commonsuffix(new, old)
-# if suffix:
-# pass
- new_reg = convert_regexp(new)
- if re.search(new_reg, old):
- return True
-
- return None
-
def logger_path():
logger = conf.find_first_file(cfg['settings']['logger']) or '/bin/logger'
if not os.path.isfile(logger) or not os.access(logger, os.EX_OK):
Regards,
Christian Boltz
--
Du versuchst, einen Braunkohlebagger im Fahrradständer abzustellen.
[Ratti in suse-linux zur Frage, wie man Mails mit >=100 MB senden kann]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20161002/fd15dc30/attachment.pgp>
More information about the AppArmor
mailing list