From: Petr Lautrbach <lautrbach@redhat.com>
To: selinux@vger.kernel.org
Subject: Re: [PATCH v2] sepolgen-ifgen: allow M4 escaped filenames
Date: Tue, 17 Dec 2024 13:13:09 +0100 [thread overview]
Message-ID: <871py6zewa.fsf@redhat.com> (raw)
In-Reply-To: <20240827113150.1843304-1-lautrbach@redhat.com>
Petr Lautrbach <lautrbach@redhat.com> writes:
> When a file name in type transition rule used in an interface is same as
> a keyword, it needs to be M4 escaped so that the keyword is not expanded
> by M4, e.g.
>
> - filetrans_pattern($1, virt_var_run_t, virtinterfaced_var_run_t, dir, "interface")
> + filetrans_pattern($1, virt_var_run_t, virtinterfaced_var_run_t, dir, ``"interface"'')
>
> But sepolgen-ifgen could not parse such string:
>
> # sepolgen-ifgen
> Illegal character '`'
>
> This change allows M4 escaping inside quoted strings and fixed described
> problem.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=2254206
>
> Signed-off-by: Petr Lautrbach <lautrbach@redhat.com>
If there's no objection I would like to merge before tomorrows rc3.
Petr
> ---
>
> change to v1:
>
> - use ``"..."'' instead of "``..''" - sugested in https://github.com/SELinuxProject/selint/pull/291 by
> @cgzones
>
> - controls right number of openning and closing quotes
>
> python/sepolgen/src/sepolgen/refparser.py | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/python/sepolgen/src/sepolgen/refparser.py b/python/sepolgen/src/sepolgen/refparser.py
> index e261d3f78f87..c8a3eb54d679 100644
> --- a/python/sepolgen/src/sepolgen/refparser.py
> +++ b/python/sepolgen/src/sepolgen/refparser.py
> @@ -486,7 +486,7 @@ def p_interface_call_param(p):
> | nested_id_set
> | TRUE
> | FALSE
> - | FILENAME
> + | quoted_filename
> '''
> # Intentionally let single identifiers pass through
> # List means set, non-list identifier
> @@ -1027,6 +1027,11 @@ def p_optional_semi(p):
> | empty'''
> pass
>
> +def p_quoted_filename(p):
> + '''quoted_filename : TICK quoted_filename SQUOTE
> + | FILENAME
> + '''
> + p[0] = p[1]
>
> #
> # Interface to the parser
> --
> 2.46.0
next prev parent reply other threads:[~2024-12-17 12:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 18:21 [PATCH] sepolgen-ifgen: allow M4 escaped filenames Petr Lautrbach
2024-08-27 11:28 ` [PATCH v2] " Petr Lautrbach
2024-12-17 12:13 ` Petr Lautrbach [this message]
2024-12-17 19:34 ` James Carter
2024-12-17 20:25 ` James Carter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871py6zewa.fsf@redhat.com \
--to=lautrbach@redhat.com \
--cc=selinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.