SELinuxProject / selint

Static code analysis of refpolicy style SELinux policy
Apache License 2.0
38 stars 17 forks source link

Error handling M4 ifelse #203

Closed pebenito closed 3 years ago

pebenito commented 3 years ago
2021-05-07T15:14:58.0933714Z systemd.if:        1731: (F): syntax error, unexpected COMMA, expecting STRING or BACKTICK (F-001)
2021-05-07T15:14:58.0934589Z  1731 |     ifelse(`$2',,, `
2021-05-07T15:14:58.0934964Z       |                 ^
2021-05-07T15:14:58.0935633Z systemd.if:        1731: (F): Error: Invalid statement (F-001)
2021-05-07T15:14:58.0936284Z  1731 |     ifelse(`$2',,, `
2021-05-07T15:14:58.0936640Z       |     ^~~~~~~~~~~~~
2021-05-07T15:14:58.0937060Z Error: Failed to parse files

I'm not clear but it may also not like the ,,, which means 2 empty parameters (empty strings) followed by quoted string parameter.

Original refpolicy build log

cgzones commented 3 years ago

The solution in #204 allows empty m4 arguments.

As a workaround

ifelse(`$1',`',`', `
    refpolicywarn(`dollar one defined')
')

should work.