config/cfg_rules.ini: Make regexp's more POSIX compliant#8227
config/cfg_rules.ini: Make regexp's more POSIX compliant#8227aplopez merged 1 commit intoSSSD:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request improves the POSIX compliance of regular expressions in src/config/cfg_rules.ini by replacing the non-standard \+ quantifier with the more portable \{1,\}. This change is well-motivated, as it fixes configuration validation on platforms like FreeBSD where \+ is not supported in Basic Regular Expressions. The changes are correct and have been applied consistently. I've reviewed the modifications and find them to be a good improvement for portability. No issues were found.
|
One test still fails even after this change: It uses Not sure how to fix this properly given the rule itself is huge. |
Hi, I did not look into the Does that help? |
|
The code that processes these rules is not in SSSD, but in ding-libs. Since it is a just an INI file, I don't think that listing the same key twice will append to its value, but I'll try your suggestion nevertheless. |
No, in 'libini_config' "last key wins". |
|
Actually, we would like to port SSSD to use 'libeconf' instead of 'libini_config'. But I don't know yet if 'libeconf' has any support for config validation (and what to do if it doesn't). |
Why we have this?: Lines 14 to 20 in 637b7bc |
|
I think Tomáš meant "we already have duplicated keys and they seem to work". I'll dive into the code once I get free time. |
|
JFTR: feature was added around SSSD/ding-libs@edf8547 |
|
Yes, exactly - we have duplicit keys and they are working, as Alexey mentioned that is supported by dinglibs. |
Honestly, I don't know, just searched where feature was added. |
|
@arrowd - I added a label |
|
So, yes, it is an intended usage of libini: https://github.com/SSSD/ding-libs/blob/9078835b3c30bbd382d80f1b9e7dbc599e1190b5/ini/ini_configobj.h#L385-L393 |
|
It looks like the |
|
Alas, the "ini_allowed_options" validator uses So we're stuck with |
3e95c81 to
b39e87c
Compare
|
We can modify ding-libs and teach validator to use multiple re's when matching a rule. Or we can modify ding-libs to use ERE's instead of BRE's. Unfortunately, either way requires modifications to ding-libs, making a new release and then waiting for it to be packaged downstreams. |
As Alexey mentioned, we are moving away from ding-libs. It does not make much sense to invest into it. |
|
Is there anything "merge-able" in this PR without ding-libs update? (Sorry I didn't look into patch details) |
|
@alexey-tikhonov yes, all the updates are fine. I will check why splitting the one with (|) is not working. IMO it should since we have that in other sections. |
|
For the sake of future development I spent few minutes investigating this. Multiple The only solution available at the moment for you (@arrowd) is to duplicate whole section into Otherwise it looks good, ACK |
|
@arrowd Are you OK with the proposed solution? |
|
Yes, I will arrange the CI appropriately. |
According to section 9.3.2 BRE Ordinary Characters [1], the '\+' sequence may
work as a plain character or like ERE special character. It is the latter for
Linux, but it is the former for FreeBSD.
Instead, use '{1,}' as a portable way of expressing "one or many".
This fixes most of config validation tests on FreeBSD.
[1] https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/basedefs/V1_chap09.html#tag_09_03_02
Reviewed-by: Alejandro López <allopez@redhat.com>
Reviewed-by: Tomáš Halman <thalman@redhat.com>
b39e87c to
8465579
Compare
According to section 9.3.2 BRE Ordinary Characters [1], the '+' sequence may work as a plain character or like ERE special character. It is the latter for Linux, but it is the former for FreeBSD.
Instead, use '{1,}' as a portable way of expressing "one or many".
This fixes most of config validation tests on FreeBSD.
[1] https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/basedefs/V1_chap09.html#tag_09_03_02