Bug 884036

Summary: testConversionsFromString c++ unit test failing
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: qpid-cppAssignee: mick <mgoulish>
Status: CLOSED ERRATA QA Contact: Petr Matousek <pematous>
Severity: medium Docs Contact:
Priority: medium    
Version: DevelopmentCC: jross, lzhaldyb, mcressma
Target Milestone: 2.3Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-cpp-0.18-14 Doc Type: Bug Fix
Doc Text:
Cause: Bug in older GCC libraries Consequence: Attempt to cast negative-zero to an unsigned type would fail Fix: Rearrange the casting logic to handle the "minus" sign separately. Result: negative-zero now works properly on older and newer GCC libs. Other values are unaffected.
Story Points: ---
Clone Of:
: 905661 (view as bug list) Environment:
Last Closed: 2013-03-06 18:53:07 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:
Bug Depends On:    
Bug Blocks: 905661    

Description Petr Matousek 2012-12-05 16:39:56 UTC
Description of problem:

testConversionsFromString unit test starts to fail on latest packages:

unknown location(0): fatal error in "testConversionsFromString": std::exception: invalid conversion: Cannot convert -0 (qpid/types/Variant.cpp:126)

This issue is only valid for rhel5 (tested on rhel5.8 and rhel5.9 - x86_64/i386), rhel6.x do not suffer from that.

Version-Release number of selected component (if applicable):
qpid-cpp-*-0.18-12.el5

How reproducible:
100%

Steps to Reproduce:
1. execute c++ unit test testConversionsFromString
  
Actual results:
testConversionsFromString fails

Expected results:
testConversionsFromString pass

Additional info:
# SPATH=$(pwd)
# g++ -Wall -DBOOST_TEST_DYN_LINK -I${SPATH}/tests -I${SPATH} -I/usr/include/qpid-boost ${SPATH}/tests/Variant.cpp ${SPATH}/tests/unit_test.cpp  -lboost_unit_test_framework -lqpidclient -lqpidmessaging -lqmfconsole -lqpidbroker -o unit_test_custom
# BOOST_TEST_LOG_LEVEL=all ./unit_test_custom 
Running 10 test cases...
Entering test suite "Master Test Suite"
Entering test suite "VariantSuite"
Entering test case "testConversionsFromString"
<snip/>
/mnt/tests/distribution/MRG/Messaging/qpid_common/qpid-tree/cpp/src/tests/Variant.cpp(135): info: check 0 == value.asInt16() passed
unknown location(0): fatal error in "testConversionsFromString": std::exception: invalid conversion: Cannot convert -0 (qpid/types/Variant.cpp:126)

Comment 1 Justin Ross 2012-12-06 15:17:32 UTC
Petr, is it fair to label this one a regression?

Comment 2 Petr Matousek 2012-12-06 16:58:51 UTC
Yes, I think so. Keyword updated.

Comment 4 mick 2012-12-11 20:08:05 UTC
fixed in branch 0.18-mrg-mick-884036

negative-0 would not happily cast to an unsigned type, so I tested for that case and cast a positive 0.

Comment 6 Petr Matousek 2012-12-14 10:14:36 UTC
This issue has been fixed.

Verified on rhel5.9 and rhel6.3 (x86_64, i386)

packages used for testing:
qpid-cpp-*-0.18-13

-> VERIFIED

Comment 7 mick 2013-01-11 20:37:46 UTC
I know we verified this already, but yesterday I did something like the same fix in trunk and Andrew pointed out that it was

  1. evil, and
  2. wrong.

Then he wrote a much nicer fix that was 

  1. good, and
  2. correct.

I checked *that* fix into trunk.

Could we reopen this BZ somehow, so I could use his fix in place of my evil hack ?

Comment 8 Leonid Zhaldybin 2013-01-14 09:15:10 UTC
As per request from the development, changing this back to ASSIGNED.

Comment 9 Justin Ross 2013-01-21 15:13:30 UTC
Mick, any update?

Comment 10 mick 2013-01-22 20:01:38 UTC
pushed as branch   0.18-mrg-mick-884036

Comment 13 Petr Matousek 2013-01-28 09:41:55 UTC
This issue has been fixed.

Verified on rhel5.9 and rhel6.4 (x86_64, i386)

packages used for testing:
qpid-cpp-*-0.18-14

-> VERIFIED

Comment 15 errata-xmlrpc 2013-03-06 18:53:07 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-0561.html