All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Lautrbach <lautrbach@redhat.com>
To: "Christian Göttsche" <cgzones@googlemail.com>,
	"James Carter" <jwcart2@gmail.com>,
	"Chris PeBenito" <pebenito@ieee.org>
Cc: selinux@vger.kernel.org, Chris PeBenito <chpebeni@linux.microsoft.com>
Subject: Re: [PATCH 1/2] Revert "libsepol/tests: rename bool indentifiers"
Date: Mon, 04 Dec 2023 19:37:24 +0100	[thread overview]
Message-ID: <8734whu84b.fsf@redhat.com> (raw)
In-Reply-To: <CAJ2a_DcL-Dyby6rGjq23sDmdm+Mk2_KNvM0-iHq=paOQO0RHAQ@mail.gmail.com>

Christian Göttsche <cgzones@googlemail.com> writes:

> On Mon, 4 Dec 2023 at 19:20, James Carter <jwcart2@gmail.com> wrote:
>>
>> On Mon, Dec 4, 2023 at 11:46 AM Petr Lautrbach <lautrbach@redhat.com> wrote:
>> >
>> > This reverts commit 893b50c6ce661f3ee339145e76a0bbfa199671c3.
>> >
>> > 61f21385004 ("libsepol: rename struct member") broke build of SETools:
>> >
>> > setools/policyrep.c: In function ‘__pyx_pf_7setools_9policyrep_23ConditionalExprIterator___next__’:
>> > setools/policyrep.c:27857:138: error: ‘cond_expr_t’ {aka ‘struct cond_expr’} has no member named ‘bool’; did you mean ‘boolean’?
>> > 27857 |     __pyx_t_3 = __pyx_f_7setools_9policyrep_13SELinuxPolicy_boolean_value_to_datum(__pyx_v_self->__pyx_base.policy, (__pyx_v_self->curr->bool - 1)); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 336, __pyx_L1_error)
>> >       |                                                                                                                                          ^~~~
>> >       |
>> >
>> > Signed-off-by: Petr Lautrbach <lautrbach@redhat.com>
>>
>> Also need to revert 513fc1570c16924080740b23fa34343ef64a90c0
>> Plus there is a couple of new uses in policy_validate.c and one in
>> checkpolicy/policy_define.c that need to be corrected.
>>
>> Thanks,
>> Jim
>
> Could you consider https://github.com/SELinuxProject/setools/pull/113
> as an alternative?

Nice, thanks!

I need to test it, but it looks good.

For me, this is better solution than reverting all the patches.

But we need to release SETools together with SELinux userspace 3.6.

Chris, is it feasible to release SETools with the proposed change on
this Wednesday or a week later?

Petr



>>
>> > ---
>> >  libsepol/tests/test-linker-cond-map.c | 24 ++++++++++++------------
>> >  1 file changed, 12 insertions(+), 12 deletions(-)
>> >
>> > diff --git a/libsepol/tests/test-linker-cond-map.c b/libsepol/tests/test-linker-cond-map.c
>> > index 142066669c0c..6ea0e4c2ac6b 100644
>> > --- a/libsepol/tests/test-linker-cond-map.c
>> > +++ b/libsepol/tests/test-linker-cond-map.c
>> > @@ -51,7 +51,7 @@
>> >   */
>> >
>> >  typedef struct test_cond_expr {
>> > -       const char *boolean;
>> > +       const char *bool;
>> >         uint32_t expr_type;
>> >  } test_cond_expr_t;
>> >
>> > @@ -69,18 +69,18 @@ static void test_cond_expr_mapping(policydb_t * p, avrule_decl_t * d, test_cond_
>> >                 CU_ASSERT_FATAL(expr != NULL);
>> >
>> >                 CU_ASSERT(expr->expr_type == bools[i].expr_type);
>> > -               if (bools[i].boolean) {
>> > -                       CU_ASSERT(strcmp(p->sym_val_to_name[SYM_BOOLS][expr->boolean - 1], bools[i].boolean) == 0);
>> > +               if (bools[i].bool) {
>> > +                       CU_ASSERT(strcmp(p->sym_val_to_name[SYM_BOOLS][expr->boolean - 1], bools[i].bool) == 0);
>> >                 }
>> >                 expr = expr->next;
>> >         }
>> >  }
>> >
>> > -static void test_bool_state(policydb_t * p, const char *boolean, int state)
>> > +static void test_bool_state(policydb_t * p, const char *bool, int state)
>> >  {
>> >         cond_bool_datum_t *b;
>> >
>> > -       b = hashtab_search(p->p_bools.table, boolean);
>> > +       b = hashtab_search(p->p_bools.table, bool);
>> >         CU_ASSERT_FATAL(b != NULL);
>> >         CU_ASSERT(b->state == state);
>> >  }
>> > @@ -100,7 +100,7 @@ void base_cond_tests(policydb_t * base)
>> >         test_sym_presence(base, "g_b_bool_1", SYM_BOOLS, SCOPE_DECL, decls, 1);
>> >         test_bool_state(base, "g_b_bool_1", 0);
>> >         /* conditional expression mapped correctly */
>> > -       bools[0].boolean = "g_b_bool_1";
>> > +       bools[0].bool = "g_b_bool_1";
>> >         bools[0].expr_type = COND_BOOL;
>> >         test_cond_expr_mapping(base, d, bools, 1);
>> >
>> > @@ -110,7 +110,7 @@ void base_cond_tests(policydb_t * base)
>> >         test_sym_presence(base, "o1_b_bool_1", SYM_BOOLS, SCOPE_DECL, decls, 1);
>> >         test_bool_state(base, "o1_b_bool_1", 1);
>> >         /* conditional expression mapped correctly */
>> > -       bools[0].boolean = "o1_b_bool_1";
>> > +       bools[0].bool = "o1_b_bool_1";
>> >         bools[0].expr_type = COND_BOOL;
>> >         test_cond_expr_mapping(base, d, bools, 1);
>> >
>> > @@ -128,7 +128,7 @@ void module_cond_tests(policydb_t * base)
>> >         test_sym_presence(base, "g_m1_bool_1", SYM_BOOLS, SCOPE_DECL, decls, 1);
>> >         test_bool_state(base, "g_m1_bool_1", 1);
>> >         /* conditional expression mapped correctly */
>> > -       bools[0].boolean = "g_m1_bool_1";
>> > +       bools[0].bool = "g_m1_bool_1";
>> >         bools[0].expr_type = COND_BOOL;
>> >         test_cond_expr_mapping(base, d, bools, 1);
>> >
>> > @@ -138,7 +138,7 @@ void module_cond_tests(policydb_t * base)
>> >         test_sym_presence(base, "o1_m1_bool_1", SYM_BOOLS, SCOPE_DECL, decls, 1);
>> >         test_bool_state(base, "o1_m1_bool_1", 0);
>> >         /* conditional expression mapped correctly */
>> > -       bools[0].boolean = "o1_m1_bool_1";
>> > +       bools[0].bool = "o1_m1_bool_1";
>> >         bools[0].expr_type = COND_BOOL;
>> >         test_cond_expr_mapping(base, d, bools, 1);
>> >
>> > @@ -150,11 +150,11 @@ void module_cond_tests(policydb_t * base)
>> >         test_bool_state(base, "g_m2_bool_1", 1);
>> >         test_bool_state(base, "g_m2_bool_2", 0);
>> >         /* conditional expression mapped correctly */
>> > -       bools[0].boolean = "g_m2_bool_1";
>> > +       bools[0].bool = "g_m2_bool_1";
>> >         bools[0].expr_type = COND_BOOL;
>> > -       bools[1].boolean = "g_m2_bool_2";
>> > +       bools[1].bool = "g_m2_bool_2";
>> >         bools[1].expr_type = COND_BOOL;
>> > -       bools[2].boolean = NULL;
>> > +       bools[2].bool = NULL;
>> >         bools[2].expr_type = COND_AND;
>> >         test_cond_expr_mapping(base, d, bools, 3);
>> >  }
>> > --
>> > 2.41.0
>> >
>> >
>>


  parent reply	other threads:[~2023-12-04 18:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04 16:19 setools build is broken by 61f21385004 ("libsepol: rename struct member"), revert? Petr Lautrbach
2023-12-04 16:26 ` James Carter
2023-12-04 16:45 ` [PATCH 1/2] Revert "libsepol/tests: rename bool indentifiers" Petr Lautrbach
2023-12-04 16:45   ` [PATCH 2/2] Revert "libsepol: rename struct member" Petr Lautrbach
2023-12-04 18:19   ` [PATCH 1/2] Revert "libsepol/tests: rename bool indentifiers" James Carter
2023-12-04 18:24     ` Christian Göttsche
2023-12-04 18:31       ` James Carter
2023-12-04 18:37       ` Petr Lautrbach [this message]
2023-12-06 13:43         ` Chris PeBenito

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=8734whu84b.fsf@redhat.com \
    --to=lautrbach@redhat.com \
    --cc=cgzones@googlemail.com \
    --cc=chpebeni@linux.microsoft.com \
    --cc=jwcart2@gmail.com \
    --cc=pebenito@ieee.org \
    --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.