All of lore.kernel.org
 help / color / mirror / Atom feed
* [refpolicy] [PATCH 8/8] Fix regexp for templated boolean generation
@ 2017-11-28 17:06 Sven Vermeulen
  2017-11-28 17:16 ` Sven Vermeulen
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Vermeulen @ 2017-11-28 17:06 UTC (permalink / raw)
  To: refpolicy

In the previous patch set, logic was added to ignore XML comments in a
template when generating the template or interface documentation, and
when that XML comment is not attributable to the template or interface
itself. This was accomplished by matching for a templated boolean or
tunable generation statement.

Sadly, the regular expression for it did not include the necessary
backtick and (forward) tick detection which is part of such statements:

  gen_tunable(`$1_something', false)
versus
  gen_tunable(domain_something, false)

In this patch, the regular expression is updated to support this
situation.

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
---
 support/segenxml.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/segenxml.py b/support/segenxml.py
index 46a4a720..2ed4068a 100644
--- a/support/segenxml.py
+++ b/support/segenxml.py
@@ -44,7 +44,7 @@ INTERFACE = re.compile(r"^\s*(interface|template)\(`(\w*)'")
 #	"gen_tunable(allow_kerberos, false)"
 #	 -> ("tunable", "allow_kerberos", "false")
 BOOLEAN = re.compile(r"^\s*gen_(tunable|bool)\(\s*(\w*)\s*,\s*(true|false)\s*\)")
-TEMPLATE_BOOLEAN = re.compile(r"^\s*gen_(tunable|bool)\(\s*([\w\$]*)\s*,\s*(true|false)\s*\)")
+TEMPLATE_BOOLEAN = re.compile(r"^\s*gen_(tunable|bool)\(\s*\`?\s*([\w\$]*)\s*\'?\s*,\s*(true|false)\s*\)")
 
 # Matches a XML comment in the policy, which is defined as any line starting
 #  with two # and at least one character of white space. Will give the single
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [refpolicy] [PATCH 8/8] Fix regexp for templated boolean generation
  2017-11-28 17:06 [refpolicy] [PATCH 8/8] Fix regexp for templated boolean generation Sven Vermeulen
@ 2017-11-28 17:16 ` Sven Vermeulen
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Vermeulen @ 2017-11-28 17:16 UTC (permalink / raw)
  To: refpolicy

Wait with applying this one, I get other issues :-(

First dinner, then continue.

On Tue, Nov 28, 2017 at 6:06 PM, Sven Vermeulen
<sven.vermeulen@siphos.be> wrote:
> In the previous patch set, logic was added to ignore XML comments in a
> template when generating the template or interface documentation, and
> when that XML comment is not attributable to the template or interface
> itself. This was accomplished by matching for a templated boolean or
> tunable generation statement.
>
> Sadly, the regular expression for it did not include the necessary
> backtick and (forward) tick detection which is part of such statements:
>
>   gen_tunable(`$1_something', false)
> versus
>   gen_tunable(domain_something, false)
>
> In this patch, the regular expression is updated to support this
> situation.
>
> Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
> ---
>  support/segenxml.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/support/segenxml.py b/support/segenxml.py
> index 46a4a720..2ed4068a 100644
> --- a/support/segenxml.py
> +++ b/support/segenxml.py
> @@ -44,7 +44,7 @@ INTERFACE = re.compile(r"^\s*(interface|template)\(`(\w*)'")
>  #      "gen_tunable(allow_kerberos, false)"
>  #       -> ("tunable", "allow_kerberos", "false")
>  BOOLEAN = re.compile(r"^\s*gen_(tunable|bool)\(\s*(\w*)\s*,\s*(true|false)\s*\)")
> -TEMPLATE_BOOLEAN = re.compile(r"^\s*gen_(tunable|bool)\(\s*([\w\$]*)\s*,\s*(true|false)\s*\)")
> +TEMPLATE_BOOLEAN = re.compile(r"^\s*gen_(tunable|bool)\(\s*\`?\s*([\w\$]*)\s*\'?\s*,\s*(true|false)\s*\)")
>
>  # Matches a XML comment in the policy, which is defined as any line starting
>  #  with two # and at least one character of white space. Will give the single
> --
> 2.13.6
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-28 17:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28 17:06 [refpolicy] [PATCH 8/8] Fix regexp for templated boolean generation Sven Vermeulen
2017-11-28 17:16 ` Sven Vermeulen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.