containers / qm

QM is a containerized environment for running Functional Safety qm (Quality Management) software
https://github.com/containers/qm
GNU General Public License v2.0
20 stars 20 forks source link

qm.if: fix syntax errors #478

Closed aesteve-rh closed 3 weeks ago

aesteve-rh commented 3 weeks ago

Fix syntax errors when running sepolgen-ifgen:

/usr/share/selinux/devel/include/services/qm.if: Syntax error on line 398 ) [type=CPAREN]
/usr/share/selinux/devel/include/services/qm.if: Syntax error on line 399 ) [type=CPAREN]
/usr/share/selinux/devel/include/services/qm.if: Syntax error on line 400 ) [type=CPAREN]
/usr/share/selinux/devel/include/services/qm.if: Syntax error on line 558 ' [type=SQUOTE]
/usr/share/selinux/devel/include/services/qm.if: Syntax error on line 621 ) [type=CPAREN]
/usr/share/selinux/devel/include/services/qm.if: Syntax error on line 622 ) [type=CPAREN]
/usr/share/selinux/devel/include/services/qm.if: Syntax error on line 623 ) [type=CPAREN]
aesteve-rh commented 3 weeks ago

@Yarboa it may be nice to have a syntax checker in the pipelines to prevent future issues. Not sure if there is one such tool, but I assume there must be?

sandrobonazzola commented 3 weeks ago

@aesteve-rh , @Yarboa here's the tool: https://github.com/SELinuxProject/selint ; would be great if it can be just added to pre-commit hooks :-)

sandrobonazzola commented 3 weeks ago

After giving it a try, not sure selint can be used, it tests the whole selinux system, not just the file itself. On my F40:

$ selint qm.if 
Note: Check E-007 is not performed because no permission macro has been parsed.
/usr/share/selinux/devel/include/contrib/virt.if:169: (F): syntax error, unexpected UNKNOWN_TOKEN (F-001)
  169 |     filetrans_pattern($1, virt_var_run_t, virtinterfaced_var_run_t, dir, "``interface''")
      |                                                                          ^
/usr/share/selinux/devel/include/contrib/virt.if:169: (F): Error: Invalid statement (F-001)
  169 |     filetrans_pattern($1, virt_var_run_t, virtinterfaced_var_run_t, dir, "``interface''")
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: Failed to parse files