diff mbox series

python/sepolgen: accept square brackets in FILENAME token

Message ID 20220214170855.10603-1-cgzones@googlemail.com (mailing list archive)
State Accepted
Commit b8159f32f07f
Headers show
Series python/sepolgen: accept square brackets in FILENAME token | expand

Commit Message

Christian Göttsche Feb. 14, 2022, 5:08 p.m. UTC
When parsing Reference Policy style files accept square brackets in file
names.  The FILENAME token is used in the TYPE_TRANSITION grammar rule
for the optional name based argument.  This name can contain square
brackets, e.g. for anonymous inodes like "[io_uring]".

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
added missing signed-off
---
 python/sepolgen/src/sepolgen/refparser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Carter Feb. 28, 2022, 8:09 p.m. UTC | #1
On Mon, Feb 14, 2022 at 4:19 PM Christian Göttsche
<cgzones@googlemail.com> wrote:
>
> When parsing Reference Policy style files accept square brackets in file
> names.  The FILENAME token is used in the TYPE_TRANSITION grammar rule
> for the optional name based argument.  This name can contain square
> brackets, e.g. for anonymous inodes like "[io_uring]".
>
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>

Acked-by: James Carter <jwcart2@gmail.com>

> ---
> added missing signed-off
> ---
>  python/sepolgen/src/sepolgen/refparser.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/python/sepolgen/src/sepolgen/refparser.py b/python/sepolgen/src/sepolgen/refparser.py
> index e611637f..1bb90564 100644
> --- a/python/sepolgen/src/sepolgen/refparser.py
> +++ b/python/sepolgen/src/sepolgen/refparser.py
> @@ -261,7 +261,7 @@ def t_IDENTIFIER(t):
>      return t
>
>  def t_FILENAME(t):
> -    r'\"[a-zA-Z0-9_\-\+\.\$\*~ :]+\"'
> +    r'\"[a-zA-Z0-9_\-\+\.\$\*~ :\[\]]+\"'
>      # Handle any keywords
>      t.type = reserved.get(t.value,'FILENAME')
>      return t
> --
> 2.34.1
>
James Carter March 3, 2022, 6:16 p.m. UTC | #2
On Mon, Feb 28, 2022 at 3:09 PM James Carter <jwcart2@gmail.com> wrote:
>
> On Mon, Feb 14, 2022 at 4:19 PM Christian Göttsche
> <cgzones@googlemail.com> wrote:
> >
> > When parsing Reference Policy style files accept square brackets in file
> > names.  The FILENAME token is used in the TYPE_TRANSITION grammar rule
> > for the optional name based argument.  This name can contain square
> > brackets, e.g. for anonymous inodes like "[io_uring]".
> >
> > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> Acked-by: James Carter <jwcart2@gmail.com>
>

Merged.
Thanks,
Jim

> > ---
> > added missing signed-off
> > ---
> >  python/sepolgen/src/sepolgen/refparser.py | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/python/sepolgen/src/sepolgen/refparser.py b/python/sepolgen/src/sepolgen/refparser.py
> > index e611637f..1bb90564 100644
> > --- a/python/sepolgen/src/sepolgen/refparser.py
> > +++ b/python/sepolgen/src/sepolgen/refparser.py
> > @@ -261,7 +261,7 @@ def t_IDENTIFIER(t):
> >      return t
> >
> >  def t_FILENAME(t):
> > -    r'\"[a-zA-Z0-9_\-\+\.\$\*~ :]+\"'
> > +    r'\"[a-zA-Z0-9_\-\+\.\$\*~ :\[\]]+\"'
> >      # Handle any keywords
> >      t.type = reserved.get(t.value,'FILENAME')
> >      return t
> > --
> > 2.34.1
> >
diff mbox series

Patch

diff --git a/python/sepolgen/src/sepolgen/refparser.py b/python/sepolgen/src/sepolgen/refparser.py
index e611637f..1bb90564 100644
--- a/python/sepolgen/src/sepolgen/refparser.py
+++ b/python/sepolgen/src/sepolgen/refparser.py
@@ -261,7 +261,7 @@  def t_IDENTIFIER(t):
     return t
 
 def t_FILENAME(t):
-    r'\"[a-zA-Z0-9_\-\+\.\$\*~ :]+\"'
+    r'\"[a-zA-Z0-9_\-\+\.\$\*~ :\[\]]+\"'
     # Handle any keywords
     t.type = reserved.get(t.value,'FILENAME')
     return t