--- /dev/null
+This patch fixes the apparmor parser tst Makefile to not use popd/pushd
+bashisms which were in place to get around PWD not getting set
+correctly. Instead, fix the simple.pl script to call pwd directly.
+Based on feedback from PLD/Arkadiusz Miskiewicz <arekm@maven.pl>.
+---
+ parser/tst/Makefile | 2 +-
+ parser/tst/simple.pl | 8 +++++---
+ 2 files changed, 6 insertions(+), 4 deletions(-)
+
+Index: trunk-forge/parser/tst/Makefile
+===================================================================
+--- trunk-forge.orig/parser/tst/Makefile
++++ trunk-forge/parser/tst/Makefile
+@@ -12,7 +12,7 @@ all: tests
+
+ .PHONY: tests
+ tests: ../apparmor_parser
+- $(Q)pushd . && ${PROVE} ${PROVE_ARG} ${TESTS} && popd
++ $(Q)${PROVE} ${PROVE_ARG} ${TESTS}
+
+ ../apparmor_parser:
+ make -C .. apparmor_parser
+Index: trunk-forge/parser/tst/simple.pl
+===================================================================
+--- trunk-forge.orig/parser/tst/simple.pl
++++ trunk-forge/parser/tst/simple.pl
+@@ -13,6 +13,8 @@ $config{'parser'} = "/sbin/subdomain_par
+ $config{'profiledir'} = "./simple_tests/";
+
+ my $help;
++my $pwd = `pwd`;
++chomp($pwd);
+
+ GetOptions(
+ "help|h" => \$help,
+@@ -32,13 +34,13 @@ read_config();
+ # Override config file profile location when passed on command line
+ if (@ARGV >= 1) {
+ $config{'profiledir'} = shift;
+-}
++}
+
+ if ($config{'profiledir'} =~ /^\//) {
+ $config{'includedir'} = $config{'profiledir'};
+ } else {
+- $config{'includedir'} = "$ENV{'PWD'}/$config{'profiledir'}";
+-}
++ $config{'includedir'} = "$pwd/$config{'profiledir'}";
++}
+
+ sub read_config {
+ my $which;
--- /dev/null
+This patch adds a variable AA_PARSER_ARGS to subdomain.conf, and passes
+those arguments to relevant invocations of apparmor_parser.
+---
+ parser/rc.apparmor.functions | 9 +++++----
+ parser/subdomain.conf | 6 ++++++
+ 2 files changed, 11 insertions(+), 4 deletions(-)
+
+Index: trunk-forge/parser/rc.apparmor.functions
+===================================================================
+--- trunk-forge.orig/parser/rc.apparmor.functions
++++ trunk-forge/parser/rc.apparmor.functions
+@@ -50,6 +50,7 @@ fi
+ SUBDOMAIN_MODULE_PANIC="warn"
+ SUBDOMAIN_ENABLE_OWLSM="no"
+ APPARMOR_ENABLE_AAEVENTD="no"
++AA_PARSER_ARGS=
+
+ if [ -f "${APPARMOR_CONF}" ] ; then
+ #parse the conf file to see what we should do
+@@ -106,11 +107,11 @@ parse_profiles() {
+ # get parser arg
+ case "$1" in
+ load)
+- PARSER_ARGS="--add"
++ PARSER_ACTION="--add"
+ PARSER_MSG="Loading AppArmor profiles "
+ ;;
+ reload)
+- PARSER_ARGS="--replace"
++ PARSER_ACTION="--replace"
+ PARSER_MSG="Reloading AppArmor profiles "
+ ;;
+ *)
+@@ -143,7 +144,7 @@ parse_profiles() {
+ logger -t "AppArmor(init)" -p daemon.warn "Skipping profile $profile"
+ STATUS=2
+ elif [ -f "${profile}" ] ; then
+- $PARSER $ABSTRACTIONS $PARSER_ARGS "$profile" > /dev/null
++ $PARSER $ABSTRACTIONS $PARSER_ACTION ${AA_PARSER_ARGS} "$profile" > /dev/null
+ if [ $? -ne 0 ]; then
+ echo " Profile $profile failed to load"
+ STATUS=1
+@@ -180,7 +181,7 @@ profiles_names_list() {
+ then
+ echo "nop" >/dev/null
+ elif [ -f "${profile}" ] ; then
+- LIST_ADD=$($PARSER $ABSTRACTIONS -N "$profile" | grep -v '\^')
++ LIST_ADD=$($PARSER $ABSTRACTIONS ${AA_PARSER_ARGS} -N "$profile" | grep -v '\^')
+ if [ $? -eq 0 ]; then
+ echo "$LIST_ADD" >>$TMPFILE
+ fi
+Index: trunk-forge/parser/subdomain.conf
+===================================================================
+--- trunk-forge.orig/parser/subdomain.conf
++++ trunk-forge/parser/subdomain.conf
+@@ -25,6 +25,12 @@ SUBDOMAIN_ENABLE_OWLSM="no"
+ # Enable the AppArmor event daemon for reporting?
+ APPARMOR_ENABLE_AAEVENTD="no"
+
++## Path: System/AppArmor
++## Description: Add arguments to the apparmor_parser binary
++## Type: String
++#
++AA_PARSER_ARGS=""
++
+ #SUBDOMAIN_MODULE_PANIC=XXX
+ #This option controls how subdomain behaves when the init script attempts
+ #to load the SubDomain module and fails. There are 4 options