mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-29 13:28:19 +00:00
aa-notify: Stop aa-notify from exit after 100s of polling
When run with the -p flag, aa-notify works fine for 100 seconds and then it exits. I suspect that the issue arises from the following check on line 259 in utils/aa-notify if debug_logger.debug_level <= 10 and int(time.time()) - start_time > 100: debug_logger.debug('Debug mode detected: aborting notification emitter after 100 seconds.') sys.exit(0) together with line 301 in utils/apparmor/common.py which initializes debug_logger.debug_level to logging.DEBUG which has the numerical value 10. A simple solution might be to just remove the check as I'm not quit sure why one would want aa-notify to exit when run in debug mode in the first place. Alternatively, one could check against debug_logger.debugging (initialized to False) or change the initialization of debug_logger.debug_level to something else, but I don't know how that would affect other consumers of utils/apparmor/common.py. For now just add dbugger_logger.debugging as an additional check as the reason for timing out after 100s during debugging are unclear. Suggested-by: vicvbcun Fixes: https://gitlab.com/apparmor/apparmor/-/issues/126 MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/660 Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Otto Kekäläinen <otto@kekalainen.net> (cherry picked from commit 8ea7630b6dc6b46e00341835e92c4f6ead05e984)
This commit is contained in:
parent
eab43b5358
commit
ff72ea9a56
@ -256,7 +256,7 @@ def follow_apparmor_events(logfile, wait=0):
|
|||||||
continue
|
continue
|
||||||
yield event
|
yield event
|
||||||
|
|
||||||
if debug_logger.debug_level <= 10 and int(time.time()) - start_time > 100:
|
if debug_logger.debugging and debug_logger.debug_level <= 10 and int(time.time()) - start_time > 100:
|
||||||
debug_logger.debug('Debug mode detected: aborting notification emitter after 100 seconds.')
|
debug_logger.debug('Debug mode detected: aborting notification emitter after 100 seconds.')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
@ -407,7 +407,8 @@ def main():
|
|||||||
debug_logger.activateStderr()
|
debug_logger.activateStderr()
|
||||||
debug_logger.debug('Logging level: {}'.format(debug_logger.debug_level))
|
debug_logger.debug('Logging level: {}'.format(debug_logger.debug_level))
|
||||||
debug_logger.debug('Running as uid: {0[0]}, euid: {0[1]}, suid: {0[2]}'.format(os.getresuid()))
|
debug_logger.debug('Running as uid: {0[0]}, euid: {0[1]}, suid: {0[2]}'.format(os.getresuid()))
|
||||||
|
if args.poll:
|
||||||
|
debug_logger.debug('Running with --debug and --poll. Will exit in 100s')
|
||||||
# Sanity checks
|
# Sanity checks
|
||||||
user_ids = os.getresuid()
|
user_ids = os.getresuid()
|
||||||
groups_ids = os.getresgid()
|
groups_ids = os.getresgid()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user