Bug 2242051

Summary: EMBOSS: incomplete pcre2 port is not working
Product: [Fedora] Fedora Reporter: Samuel Ortion <samuel+fedora>
Component: EMBOSSAssignee: Tom "spot" Callaway <spotrh>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 38CC: fweimer, spotrh
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: EMBOSS-6.6.0-26.fc38 EMBOSS-6.6.0-26.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-12-29 01:05:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2137512    
Attachments:
Description Flags
GDB Segfault trace on water (the same on seqret) none

Description Samuel Ortion 2023-10-04 05:35:24 UTC
I am not sure if It is specific to my machine, but on my fedora 38 installation, the EMBOSS binaries installed with DNF return a segfault, rendering them unusable.


Reproducible: Always

Steps to Reproduce:
1. Install EMBOSS with DNF
2. Run one of the binaries (e.g. seqret, water: I did not test them all)



I ran GDB on seqret and water, to try to trace the segmentation fault, after installing EMBOSS-devel, as proposed on ASK - Fedora (<https://discussion.fedoraproject.org/t/emboss-binaries-segfault-on-my-fedora38-should-i-file-a-bug/91283>.

Comment 1 Samuel Ortion 2023-10-04 05:37:32 UTC
Created attachment 1991946 [details]
GDB Segfault trace on water (the same on seqret)

Comment 2 Florian Weimer 2023-12-20 12:23:53 UTC
The pcre2 port is faulty. The ovector handling was not changed:

diff -up EMBOSS-6.6.0/ajax/core/ajreg.c.pcre2 EMBOSS-6.6.0/ajax/core/ajreg.c
--- EMBOSS-6.6.0/ajax/core/ajreg.c.pcre2	2011-10-18 10:23:40.000000000 -0400
+++ EMBOSS-6.6.0/ajax/core/ajreg.c	2022-09-20 12:15:54.710050043 -0400
@@ -85,13 +85,13 @@ AjPRegexp ajRegCompC(const char* rexp)
     AjPRegexp ret;
     int options = 0;
     int errpos  = 0;
-    const char *errptr            = NULL;
-    const unsigned char *tableptr = NULL;
+    const char *errptr              = NULL;
+    pcre2_compile_context *tableptr = NULL;
 
     AJNEW0(ret);
     AJCNEW0(ret->ovector, AJREG_OVECSIZE);
     ret->ovecsize = AJREG_OVECSIZE/3;
-    ret->pcre = pcre_compile(rexp, options, &errptr, &errpos, tableptr);
+    ret->pcre = pcre2_compile((PCRE2_SPTR)rexp, PCRE2_ZERO_TERMINATED, options, &errptr, &errpos, tableptr);
 
     if(!ret->pcre)
     {

With pcre2, the ovector needs to be allocated using pcre2_match_data_create_from_patter and related functions.

I noticed this because GCC 14 correctly refuses to compile this code due to many type errors, and the crash you observe is proof that the errors are indeed warranted.

Comment 3 Tom "spot" Callaway 2023-12-20 21:53:23 UTC
Well, as the person who did this work (poorly) the first time, I felt obliged to come clean it up.

I reworked the pcre2 implementation and now seqret and water don't segfault. I don't have any immediate test cases I could run them through, but I suspect the bug reporter might.

Please test the bodhi builds!

Comment 4 Fedora Update System 2023-12-20 21:54:58 UTC
FEDORA-2023-4583e503b9 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-4583e503b9

Comment 5 Fedora Update System 2023-12-20 21:55:01 UTC
FEDORA-2023-f5e1cc77de has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-f5e1cc77de

Comment 6 Florian Weimer 2023-12-20 22:45:16 UTC
Thank you. The C compatibility issues are gone, at least.

Comment 7 Fedora Update System 2023-12-21 02:45:24 UTC
FEDORA-2023-4583e503b9 has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-4583e503b9`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-4583e503b9

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2023-12-21 03:23:44 UTC
FEDORA-2023-f5e1cc77de has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-f5e1cc77de`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-f5e1cc77de

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2023-12-29 01:05:00 UTC
FEDORA-2023-4583e503b9 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Fedora Update System 2023-12-29 01:13:59 UTC
FEDORA-2023-f5e1cc77de has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.