Bug 595653

Summary: qpid c++ client library missing symbol `qpid::sys::Duration::Duration(qpid::sys::AbsTime&)'
Product: Red Hat Enterprise MRG Reporter: Frantisek Reznicek <freznice>
Component: qpid-cppAssignee: Andrew Stitcher <astitcher>
Status: CLOSED NOTABUG QA Contact: MRG Quality Engineering <mrgqe-bugs>
Severity: high Docs Contact:
Priority: high    
Version: DevelopmentCC: esammons, gsim
Target Milestone: 1.3   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-05-25 14:17:43 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: 595788    

Description Frantisek Reznicek 2010-05-25 09:55:17 UTC
Description of problem:

There is recent change in qpid::sys::Duration::Duration() c++ client library which causes all c++ clients using qpid::sys::Duration::Duration(qpid::sys::AbsTime&) call to be not compilable:

[root@mrg-qe-07 c++]# g++ ${cli_fn}.cpp -Wall -O3 -ggdb -I/usr/include/qpid-boost     -lqpidclient -o ${cli_fn}
qc_tsxtest.cpp: In constructor `Opts::Opts()':
qc_tsxtest.cpp:114: warning: `Opts::events' will be initialized after
qc_tsxtest.cpp:107: warning:   `int Opts::rate'
qc_tsxtest.cpp:130: warning:   when initialized here
qc_tsxtest.cpp:113: warning: `Opts::depth' will be initialized after
qc_tsxtest.cpp:89: warning:   `bool Opts::run_now'
qc_tsxtest.cpp:130: warning:   when initialized here
qc_tsxtest.cpp:117: warning: `Opts::ring_d' will be initialized after
qc_tsxtest.cpp:115: warning:   `int Opts::symbol_queues'
qc_tsxtest.cpp:130: warning:   when initialized here
qc_tsxtest.cpp: In function `std::string timeStr(qpid::sys::AbsTime)':
qc_tsxtest.cpp:274: error: no matching function for call to `qpid::sys::Duration::Duration(qpid::sys::AbsTime&)'
/usr/include/qpid/sys/Time.h:115: note: candidates are: qpid::sys::Duration::Duration(const qpid::sys::Duration&)
/usr/include/qpid/sys/Time.h:123: note:                 qpid::sys::Duration::Duration(const qpid::sys::AbsTime&, const qpid::sys::AbsTime&)
/usr/include/qpid/sys/Time.h:136: note:                 qpid::sys::Duration::Duration(int64_t)
qc_tsxtest.cpp: In constructor `SMRStats::SMRStats()':
qc_tsxtest.cpp:699: warning: `SMRStats::end' will be initialized after
qc_tsxtest.cpp:696: warning:   `int64_t SMRStats::delay[3]'
qc_tsxtest.cpp:702: warning:   when initialized here
qc_tsxtest.cpp: In constructor `Smr::Smr()':
qc_tsxtest.cpp:757: warning: `Smr::expect' will be initialized after
qc_tsxtest.cpp:756: warning:   `int Smr::msg_cnt'
qc_tsxtest.cpp:760: warning:   when initialized here
qc_tsxtest.cpp: In constructor `Report::Report()':
qc_tsxtest.cpp:883: warning: `Report::expect' will be initialized after
qc_tsxtest.cpp:880: warning:   `int64_t Report::max_l'
qc_tsxtest.cpp:885: warning:   when initialized here
[root@mrg-qe-07 c++]# echo $?
1

It looks like 
qpid::sys::Duration::Duration(const qpid::sys::AbsTime&, 
                              const qpid::sys::AbsTime&)
candidate should have second parameter with default value like this:
qpid::sys::Duration::Duration(const qpid::sys::AbsTime&, 
                              const qpid::sys::AbsTime& = N)


Version-Release number of selected component (if applicable):
qpid-cpp-*0.7.946106-1.el[45]

How reproducible:
100%

Steps to Reproduce:
1. compile a client with qpid::sys::Duration::Duration(qpid::sys::AbsTime&) call
  
Actual results:
Client does not compile.

Expected results:
Client should compile fine.

Additional info:

Comment 1 Frantisek Reznicek 2010-05-25 09:57:39 UTC
This issue breaks ABI compatibility between releases.

Comment 2 Frantisek Reznicek 2010-05-25 10:06:40 UTC
It seems that 937147 commit introduced the issue:
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/sys/Time.h?r1=931995&r2=937147&diff_format=h

Comment 3 Andrew Stitcher 2010-05-25 14:16:36 UTC
This removal was deliberate, and was not in the API/ABI poart of the library.

The timing classes are only exposed incidentally to clients.

The major reason for the removal is that the meaning of constructing a Duration from an AbsTime is ambiguous, and potentially different between platforms, as it was just exposing the underlying nanosecond count. You can only meaningfully construct a duration from the difference between two absolute times.

We've now added a constant AbsTime::EPOCH which corresponds to the absolute time at the Unix Epoch, so you can construct what you probably wanted all along.

If you've code like this then you need to replace it with something like:

Duration d(AbsTime::EPOCH, time);