[apparmor] [PATCH] parser: fix preprocessing output

John Johansen john.johansen at canonical.com
Fri Jan 17 12:36:39 UTC 2014


The preprocessing output is broken, in a couple of places

includes come out like

  #include 

  ##included <tunables/home>

which is wrong because #include by itself is broken, and since -p is
supposed to be removing includes, it should not be directly echoed

any keyword in the keyword table is double echoed

  ownerowner /{run,dev}/shm/pulse-shm* rwk


Signed-off-by: John Johansen <john.johansen at canonical.com>

=== modified file 'parser/parser_lex.l'
--- parser/parser_lex.l	2013-12-06 19:17:43 +0000
+++ parser/parser_lex.l	2014-01-17 12:24:21 +0000
@@ -488,7 +488,12 @@
 	}
 }
 
-#include/.*\r?\n	{ PUSH(INCLUDE); }
+#include/.*\r?\n	{
+	/* Don't use push here as we don't want #include echoed out. It needs
+	 * to be handled specially
+	 */ 
+	yy_push_state(INCLUDE);
+}
 
 #.*\r?\n	{ /* normal comment */
 	DUMP_AND_DEBUG("comment(%d): %s\n", current_lineno, yytext);
@@ -536,7 +541,6 @@
 {OPEN_PAREN}	{ PUSH_AND_RETURN(LIST_VAL_MODE, TOK_OPENPAREN); }
 
 {VARIABLE_NAME}	{
-	DUMP_PREPROCESS;
 	int token = get_keyword_token(yytext);
 	int state = INITIAL;
 




More information about the AppArmor mailing list