apparmor_parser -p is broken. Outputting garbage charcters after every
include statement.

eg.

##included <tunables/multiarch>
^@^@V><A8>^?^@^@<C8>^NV><A8>^?^@^@<A0>^Pu^@# -----------------------------------
-------------------------------
#

This is happening because includes are handled specially and should not
go through the usual preprocessing output dump.

Signed-off-by: John Johansen <john.johan...@canonical.com>
Acked-by: Seth Arnold <seth.arn...@canonical.com>
---
 parser/parser_lex.l |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- 2.9-test.orig/parser/parser_lex.l
+++ 2.9-test/parser/parser_lex.l
@@ -80,6 +80,12 @@
        yy_pop_state(); \
 } while (0)
 
+#define POP_NODUMP() \
+do { \
+       PDEBUG(" (pop_to(%s)): Matched: %s\n", 
state_names[yy_top_state()].c_str(), yytext); \
+       yy_pop_state(); \
+} while (0)
+
 #define PUSH(X) \
 do { \
        DUMP_AND_DEBUG(" (push(%s)): Matched: %s\n", state_names[(X)].c_str(), 
yytext); \
@@ -278,12 +284,12 @@
                char *filename = strndup(yytext, yyleng - 1);
                include_filename(filename + 1, *filename == '<');
                free(filename);
-               POP();
+               POP_NODUMP();
        }
 
        [^\<\>\" \t\n]+ {       /* filename */
                include_filename(yytext, 0);
-               POP();
+               POP_NODUMP();
        }
 }
 


-- 
AppArmor mailing list
AppArmor@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to