-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PCRE2 #2015
PCRE2 #2015
Conversation
@@ -577,35 +446,15 @@ static int process_pattern_match(const char *path, pcre **regex_out) | |||
} | |||
*/ | |||
break; | |||
case PCRE_ERROR_BADPARTIAL: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need that case anymore. Any more or less recent version of the library does not have limits on partial matches. This is just a dead code block now.
2e294a9
to
ac8100a
Compare
c90701a
to
099bb05
Compare
98a6f16
to
33140c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, the changes look OK to me. Thanks for your patch!
I have reviewed the build and test results and I have seen that we build and test with PCRE2 in GH CI.
Regarding the Developer Guide, I understand your point, but I think that you should mention it there that there is an option to build the project with PCRE2. You can also make the Developer Guide ready for the situation that PCRE will be sunset in future Fedora.
Lastly, please fix the Windows build, we have committed that we will make sure that OpenSCAP is buildable on Windows for the entire lifetime of version 1.3.x (https://github.com/OpenSCAP/openscap/blob/maint-1.3/docs/windows.md). I think it'd be possible to replace the bzero()
by calloc()
.
Recognize PCRE2 library in the build system. Add wrapper for pcre_/pcre2_ functions.
Use oscap_pcre_* wrapper in the code.
Move the oscap_get_substring into the oscap_pcre.c module and rename it into oscap_pcre_get_substring. The function imposes implicit dependencies on PCRE/PCRE2 symbols even for utils.c users that won't use PCRE at all (SCE library).
Make use of the PCRE2 library (in Fedora CI + PackIt and Ubuntu IC).
Done. Also: #2022.
Done, thanks for reminding. |
This PR introduces support for PCRE2 library for regular expression handling. It does it in a backward-compatible way, keeping the possibility of linking with now-obsolete PCRE1 library.
No changes in the code are required to switch between libraries, the
oscap_pcre_*
group of functions would take care of all the differences between compilation and matching API.By default the build system will try to link with the old PCRE1 library. To force the new PCRE2 one must pass
-DWITH_PCRE2=True
argument during CMake configuration step.This PR also moves
oscap_get_substrings
function fromutils
intooscap_pcre
module, because of the semantics and implicit dependencies of this function.It also get rid of code that handles
PCRE_ERROR_BADPARTIAL
match error, as this error is not actual for any usable version of the library.