Bug 1555231 - monotone-1.1-25.fc29 FTBFS: src/pcrewrap.cc:107:64: error: invalid const_cast from type 'const real_pcre*' to type 'pcre_t*'
Summary: monotone-1.1-25.fc29 FTBFS: src/pcrewrap.cc:107:64: error: invalid const_cast...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: monotone
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Thomas Moschny
QA Contact: Fedora Extras Quality Assurance
URL: https://apps.fedoraproject.org/kosche...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-03-14 08:54 UTC by Petr Pisar
Modified: 2018-05-23 06:09 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-23 06:09:40 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Fix (1.96 KB, patch)
2018-05-07 12:16 UTC, Petr Pisar
no flags Details | Diff

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


Note You need to log in before you can comment on or make changes to this bug.