[apparmor] [PATCH] utils: Print aa-easyprof error to stderr upon manifest parsing error

Tyler Hicks tyhicks at canonical.com
Mon Nov 30 23:48:11 UTC 2015


A common usage of aa-easyprof is to pipe its stdout to a file
representing an AppArmor profile. Errors must go to stderr.

https://launchpad.net/bugs/1521400

Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
---
 utils/aa-easyprof | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/utils/aa-easyprof b/utils/aa-easyprof
index 93861ae..8e9db71 100755
--- a/utils/aa-easyprof
+++ b/utils/aa-easyprof
@@ -53,7 +53,10 @@ if __name__ == "__main__":
             error("Could not read '%s': %s (%d)\n" % (opt.manifest,
                                                       os.strerror(e.errno),
                                                       e.errno))
-        profiles = apparmor.easyprof.parse_manifest(manifest, opt)
+        try:
+            profiles = apparmor.easyprof.parse_manifest(manifest, opt)
+        except AppArmorException as e:
+            error(e.value)
     else: # fake up a tuple list when processing command line args
         profiles.append( (binary, opt) )
 
-- 
2.5.0




More information about the AppArmor mailing list