2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-30 22:05:27 +00:00

Let read_inactive_profiles() do nothing when calling it the second time

autodep() calls read_inactive_profiles() each time it's called (= for
each binary). The result is a "Conflicting profile" error (showing the
same filename twice) if autodep() runs more than once. This can easily
happen when using "aa-autodep /usr/bin/*".

This patch adds an attribute to read_inactive_profiles() that lets the
function return without doing anything if was called before.
This commit is contained in:
Christian Boltz
2017-11-28 21:46:36 +01:00
parent 42bd81df01
commit b307e535fa

View File

@@ -2024,6 +2024,13 @@ def read_profiles():
read_profile(profile_dir + '/' + file, True)
def read_inactive_profiles():
if hasattr(read_inactive_profiles, 'already_read'):
# each autodep() run calls read_inactive_profiles, but that's a) superfluous and b) triggers a conflict because the inactive profiles are already loaded
# therefore don't do anything if the inactive profiles were already loaded
return
read_inactive_profiles.already_read = True
if not os.path.exists(extra_profile_dir):
return None
try: