commit: 5f5e11b22bbcecf05ef2f4b6d1aac6c624f6584e
Author: Oleksii Miroshko <oleksii.miroshko <AT> bmw <DOT> de>
AuthorDate: Thu Dec 15 08:05:28 2022 +0000
Commit: Kenton Groombridge <concord <AT> gentoo <DOT> org>
CommitDate: Mon Feb 13 15:19:26 2023 +0000
URL:
https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=5f5e11b2
Fix templates parsing in gentemplates.sh
Template definitions might have a whitespace after
the comma, e.g. su_restricted_domain_template
in /policy/modules/admin/su.if
template(`su_restricted_domain_template', `
...
')
gentemplates.sh silently fails to parse it. This works
unless 'set -e' is set, in which case the script fails
non-silently.
This commit adds support of whitespace after comma, which
is a valid syntax.
Signed-off-by: Oleksii Miroshko <oleksii.miroshko <AT> bmw.de>
Signed-off-by: Kenton Groombridge <concord <AT> gentoo.org>
support/gentemplates.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/support/gentemplates.sh b/support/gentemplates.sh
index 7f20505ee..f28debd3d 100755
--- a/support/gentemplates.sh
+++ b/support/gentemplates.sh
@@ -57,6 +57,6 @@ fi
for ifile in $(find ${SOURCEDIR} -type f -name '*.if'); do
for interface in $(grep -E '^template\(' ${ifile} | sed -e
's:^template(`\([^'\'']*\)'\''\s*,\s*`:\1:g'); do
# Generate the interface
- sed -n "/^template(\`${interface}',\`/,/^')/p" ${ifile} | grep -v
"^template" | grep -v "^')" > ${TARGETDIR}/${interface}.iftemplate;
+ sed -n "/^template(\`${interface}',\s*\`/,/^')/p" ${ifile} | grep -v
"^template" | grep -v "^')" > ${TARGETDIR}/${interface}.iftemplate;
done
done