[apparmor] [patch] Better error message on unknown profile lines

Christian Boltz apparmor at cboltz.de
Sat Dec 26 20:27:46 UTC 2015


Hello,

when hitting an unknown line while parsing a profile, it's a good idea
to include that line in the error message ;-)

I propose this patch for trunk and 2.10
(2.9 would print a literal \n because it doesn't have apparmor.fail, so
if we want that patch in 2.9, I'll have to s/\n   //')


[ 49-parse-unknown-line-better-error-msg.diff ]

--- utils/apparmor/aa.py        2015-12-26 17:35:16.273569178 +0100
+++ utils/apparmor/aa.py        2015-12-26 21:19:36.910261844 +0100
@@ -3056,7 +3056,7 @@
             else:
                 lastline = line
         else:
-            raise AppArmorException(_('Syntax Error: Unknown line found in file: %(file)s line: %(line)s') % { 'file': file, 'line': lineno + 1 })
+            raise AppArmorException(_('Syntax Error: Unknown line found in file %(file)s line %(lineno)s:\n    %(line)s') % { 'file': file, 'lineno': lineno + 1, 'line': line })
 
     # Below is not required I'd say
     if not do_include:



Regards,

Christian Boltz
-- 
Lesson learned: Web service APIs can drive you crazy especially
if you mix it with asynchronous network connections
[David Williams in opensuse-project]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20151226/c9d8ed69/attachment.pgp>


More information about the AppArmor mailing list