Bug 998477 - Bad throwspec in ~LuceneBase destructor (g++-4.8 error)
Bad throwspec in ~LuceneBase destructor (g++-4.8 error)
Product: Fedora
Classification: Fedora
Component: clucene09 (Show other bugs)
All Linux
unspecified Severity high
: ---
: ---
Assigned To: Rex Dieter
Fedora Extras Quality Assurance
: Patch
Depends On:
Blocks: qt5-qttools
  Show dependency treegraph
Reported: 2013-08-19 08:10 EDT by Kevin Kofler
Modified: 2014-10-25 18:17 EDT (History)
3 users (show)

See Also:
Fixed In Version: clucene09-0.9.21b-8.fc19
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-09-11 21:59:21 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
proposed fix (607 bytes, patch)
2013-08-19 08:25 EDT, Dan Horák
no flags Details | Diff
more intrusive version (6.84 KB, patch)
2013-08-27 14:21 EDT, Rex Dieter
no flags Details | Diff

  None (edit)
Description Kevin Kofler 2013-08-19 08:10:36 EDT
Description of problem:
When attempting to unbundle clucene09 from qt5-qttools, we ran into the following build error:

In file included from /usr/include/clucene09/CLucene/index/IndexReader.h:15:0,
                 from /usr/include/clucene09/CLucene.h:14,
                 from qtokenstream.cpp:20:
/usr/include/clucene09/CLucene/store/FSDirectory.h:92:5: error: looser throw specifier for ‘virtual lucene::store::FSDirectory::FSIndexInput::SharedHandle::~SharedHandle() throw (CLuceneError&)’
     ~SharedHandle() throw(CLuceneError&);
In file included from /usr/include/clucene09/CLucene/debug/mem.h:14:0,
                 from /usr/include/clucene09/CLucene/StdHeader.h:440,
                 from /usr/include/clucene09/CLucene.h:11,
                 from qtokenstream.cpp:20:
/usr/include/clucene09/CLucene/debug/lucenebase.h:61:13: error:   overriding ‘virtual lucene::debug::LuceneBase::~LuceneBase() noexcept (true)’
     virtual ~LuceneBase(){};

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Try to build qt5-qttools on F19 or Rawhide with the patch from https://bugzilla.redhat.com/show_bug.cgi?id=915005#c36

Actual results:
FTBFS with the above error.

Expected results:
Successful build.

Additional info:
The problem is that the virtual ~LuceneBase() destructor must not be noexcept because at least 1 subclass does throw exceptions in the destructor. So I think that noexcept in lucenebase.h needs to go away.
Comment 1 Robert Scheck 2013-08-19 08:15:18 EDT
Unfortunately, I am not a C++ programmer, thus I would like to see a patch
proposed - which also does not break something else.
Comment 2 Dan Horák 2013-08-19 08:18:30 EDT
If my repoquery was correct, then only zarafa depends on clucene09.
Comment 3 Dan Horák 2013-08-19 08:25:29 EDT
Created attachment 788030 [details]
proposed fix

I think Kevin meant this change instead my original idea of dropping the throw() in the child class.
Comment 4 Kevin Kofler 2013-08-20 14:11:50 EDT
Yes, this change should be right.

I guess g++ 4.8 now assumes that destructors with no throwspec are throw() (i.e. throw nothing) rather than "throw anything". (There must be some obscure clause somewhere in the C++ standard which says that.)
Comment 5 Rex Dieter 2013-08-27 12:32:52 EDT
I need this fix to finish qt5-qttools review, so will take a crack at applying the proposed patch for rawhide and how it goes.
Comment 6 Rex Dieter 2013-08-27 12:51:19 EDT
* Tue Aug 27 2013 Rex Dieter <rdieter@fedoraproject.org> 0.9.21b-7
- Bad throwspec in ~LuceneBase destructor (#998477)
Comment 7 Rex Dieter 2013-08-27 13:38:52 EDT
I botched -7, in that it didnt actually apply the patch, -8 on the way.
Comment 8 Rex Dieter 2013-08-27 14:09:10 EDT
Arg, build failed,

started adding more throw items to more headers,

now hit:

../src/CLucene/index/CompoundFile.cpp:97:41: error: declaration of ‘virtual lucene::index::CompoundFileReader::~CompoundFileReader()’ has a different exception specifier
../src/CLucene/index/CompoundFile.h:98:2: error: from previous declaration ‘virtual lucene::index::CompoundFileReader::~CompoundFileReader() throw (CLuceneError&)’
../src/CLucene/index/Term.cpp:84:13: error: declaration of ‘virtual lucene::index::Term::~Term()’ has a different exception specifier
../src/CLucene/index/Term.h:71:2: error: from previous declaration ‘virtual lucene::index::Term::~Term() throw (CLuceneError&)’
../src/CLucene/store/FSDirectory.cpp:371:29: error: declaration of ‘virtual lucene::store::FSDirectory::~FSDirectory()’ has a different exception specifier
../src/CLucene/store/FSDirectory.h:158:3: error: from previous declaration ‘virtual lucene::store::FSDirectory::~FSDirectory() throw (CLuceneError&)’
../src/CLucene/store/RAMDirectory.cpp:222:31: error: declaration of ‘virtual lucene::store::RAMDirectory::~RAMDirectory()’ has a different exception specifier
../src/CLucene/store/RAMDirectory.h:134:11: error: from previous declaration ‘virtual lucene::store::RAMDirectory::~RAMDirectory() throw (CLuceneError&)’
../src/CLucene/store/TransactionalRAMDirectory.cpp:19:57: error: declaration of ‘virtual lucene::store::TransactionalRAMDirectory::~TransactionalRAMDirectory()’ has a different exception specifier
../src/CLucene/store/TransactionalRAMDirectory.h:47:13: error: from previous declaration ‘virtual lucene::store::TransactionalRAMDirectory::~TransactionalRAMDirectory() throw (CLuceneError&)’

I suppose I need to figure out how to change the declarations accordingly in the .cpp files too?
Comment 9 Rex Dieter 2013-08-27 14:21:03 EDT
Created attachment 791139 [details]
more intrusive version

Here's a more intrusive version I needed to use to get things to build.
Comment 10 Fedora Update System 2013-09-03 09:24:39 EDT
clucene09-0.9.21b-8.fc19 has been submitted as an update for Fedora 19.
Comment 11 Fedora Update System 2013-09-03 18:24:52 EDT
Package clucene09-0.9.21b-8.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing clucene09-0.9.21b-8.fc19'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
Comment 12 Fedora Update System 2013-09-11 21:59:21 EDT
clucene09-0.9.21b-8.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 13 Kevin Kofler 2014-10-25 18:17:10 EDT
For the record, it seems that g++ ≥ 4.8 only assumes noexcept(true) in C++11 mode, and in that mode, it is possible to write noexcept(false) to disable that, so I changed the patch to do that:

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