Re: [PATCH 1/2] Revert "libsepol/tests: rename bool indentifiers"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 4 Dec 2023 at 19:20, James Carter <jwcart2@xxxxxxxxx> wrote:
>
> On Mon, Dec 4, 2023 at 11:46 AM Petr Lautrbach <lautrbach@xxxxxxxxxx> 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@xxxxxxxxxx>
>
> 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?

>
> > ---
> >  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
> >
> >
>





[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux