[selinux-policy: 1510/3172] Fix build system to not move type declarations out of optionals.

Daniel J Walsh dwalsh at fedoraproject.org
Thu Oct 7 21:15:49 UTC 2010


commit 4f447b097d7d856638aebee6b408d5fedf466482
Author: Chris PeBenito <cpebenito at tresys.com>
Date:   Mon Jun 12 16:59:21 2006 +0000

    Fix build system to not move type declarations out of optionals.

 refpolicy/Changelog                          |    1 +
 refpolicy/policy/support/loadable_module.spt |   16 +++-------------
 refpolicy/support/comment_move_decl.sed      |    3 ++-
 refpolicy/support/get_type_attr_decl.sed     |    3 ++-
 4 files changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/refpolicy/Changelog b/refpolicy/Changelog
index d7fd351..f10b4ec 100644
--- a/refpolicy/Changelog
+++ b/refpolicy/Changelog
@@ -1,3 +1,4 @@
+- Fix build system to not move type declarations out of optionals.
 - Add gcc-config domain to portage.
 - Add packet object class and support in corenetwork.
 - Add a copy of genhomedircon for monolithic policy building, so that a
diff --git a/refpolicy/policy/support/loadable_module.spt b/refpolicy/policy/support/loadable_module.spt
index b9550f1..63488ea 100644
--- a/refpolicy/policy/support/loadable_module.spt
+++ b/refpolicy/policy/support/loadable_module.spt
@@ -94,25 +94,15 @@ define(`policy_call_depth',0)
 define(`optional_policy',`
 	ifelse(regexp(`$1',`\W'),`-1',`
 		errprint(__file__:__line__`: deprecated use of module name ($1) as first parameter of optional_policy() block.' __endline__)
-		optional {
-			pushdef(`__in_optional_policy') dnl
-			$2
-			popdef(`__in_optional_policy') dnl
-		ifelse(`$3',`',`',`
-		} else {
-			$3
-		')
-		}
+		optional_policy(shift($*))
 	',`
-		optional {
-			pushdef(`__in_optional_policy') dnl
+		optional {`'pushdef(`__in_optional_policy')
 			$1
-			popdef(`__in_optional_policy') dnl
 		ifelse(`$2',`',`',`
 		} else {
 			$2
 		')
-		}
+		}`'popdef(`__in_optional_policy')`'ifndef(`__in_optional_policy',` # end optional')
 	')
 ')
 
diff --git a/refpolicy/support/comment_move_decl.sed b/refpolicy/support/comment_move_decl.sed
index 6ea2cea..1d098d5 100644
--- a/refpolicy/support/comment_move_decl.sed
+++ b/refpolicy/support/comment_move_decl.sed
@@ -1,8 +1,9 @@
 # comment out lines that are moved by the build
 # process, so line numbers provided by m4 are preserved.
 
-# lines in require blocks are not moved
+# lines in require and optional blocks are not moved
 /require \{/,/} # end require/b nextline
+/optional \{/,/} # end optional/b nextline
 
 /^[[:blank:]]*(attribute|type(alias)?) /	s/^/# this line was moved by the build process: &/
 /^[[:blank:]]*(port|node|netif|genfs)con /s/^/# this line was moved by the build process: &/
diff --git a/refpolicy/support/get_type_attr_decl.sed b/refpolicy/support/get_type_attr_decl.sed
index 6bb5ff3..52a11ab 100644
--- a/refpolicy/support/get_type_attr_decl.sed
+++ b/refpolicy/support/get_type_attr_decl.sed
@@ -1,8 +1,9 @@
 #n
 # print out type and attribute declarations that
-# are not inside require blocks.
+# are not inside require and optional blocks.
 
 /require \{/,/} # end require/b nextline
+/optional \{/,/} # end optional/b nextline
 
 /^[[:blank:]]*(attribute|type(alias)?) /{
 	s/^[[:blank:]]+//


More information about the scm-commits mailing list