Bug 1555231

Summary: monotone-1.1-25.fc29 FTBFS: src/pcrewrap.cc:107:64: error: invalid const_cast from type 'const real_pcre*' to type 'pcre_t*'
Product: [Fedora] Fedora Reporter: Petr Pisar <ppisar>
Component: monotoneAssignee: Thomas Moschny <thomas.moschny>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: thomas.moschny
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://apps.fedoraproject.org/koschei/package/monotone
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-23 06:09:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Fix none

Description Petr Pisar 2018-03-14 08:54:45 UTC
monotone-1.1-25.fc29 fails to build in F29:

g++  -I.    -I/usr/include/botan-1.10           -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -Wall -W -Wno-unused -c -o src/pcrewrap.o src/pcrewrap.cc
src/pcrewrap.cc: In destructor 'pcre::regex_cache_manager::~regex_cache_manager()':
src/pcrewrap.cc:107:64: error: invalid const_cast from type 'const real_pcre*' to type 'pcre_t*' {aka 'real_pcre8_or_16*'}
               pcre_free(const_cast<pcre_t *>(iter->second.first));
                                                                ^

A difference between passing and failing build root is at <https://apps.fedoraproject.org/koschei/build/4366391>.

This could be caused by upgrading pcre or gcc.

Comment 1 Petr Pisar 2018-05-07 12:15:19 UTC
The issue that monotone uses PCRE's internal real_pcre type in src/pcrewrap.hh:

// This is a sensible C++ wrapper interface around the bare C API exported
// by pcre.h.  Note that pcre.h is a very "noisy" header in terms of macro
// definitions and so we don't actually expose it here. Unfortunately, this
// means we have to hope this pair of forward declarations will not change...

struct real_pcre;
struct pcre_extra;

and later then in src/pcrewrap.cc. 

PCRE 8.42 changed the real_pcre into real_pcre8_or_16 in 8.42 version. Application should use public pcre typedef instead, but monotone decided not to use it because it wanted pcre for C++ namespace. The "hope this pair of forward declarations will not change" worry was fulfilled.

It's necessary to adapt monotone to this change.

Comment 2 Petr Pisar 2018-05-07 12:16:41 UTC
Created attachment 1432584 [details]
Fix

Comment 3 Thomas Moschny 2018-05-23 06:09:40 UTC
Thanks for the patch.

Successful build: https://koji.fedoraproject.org/koji/buildinfo?buildID=1084062