[SERVER-21529] Sign of log severity values may get lost, depending on compiler Created: 18/Nov/15  Updated: 23/Nov/16  Resolved: 22/Dec/15

Status: Closed
Project: Core Server
Component/s: Portability
Affects Version/s: None
Fix Version/s: 3.2.5, 3.3.0

Type: Bug Priority: Major - P3
Reporter: Bryan Chan Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: code-only, ppc64le_3_2_backport
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-21909 Unittest failure in server_options_te... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Sprint: Platforms E (01/08/16)
Participants:

 Description   

LogSeverity::Log().toInt() returns a possibly negative integer, which is cast into a char in several places, with the assumption that char's are signed by default. This assumption is not true for all platforms; GCC on ppc64 and s390x treats char's as unsigned by default. This causes the unit test server_options_test to fail on those platforms.

The fix is to explicitly declare LogComponentSettings::_minimumLoggedSeverity as a signed char array.



 Comments   
Comment by Githook User [ 08/Mar/16 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: SERVER-21529 Don't assume char is unsigned in logging

(cherry picked from commit 07b2e02ffddbd9998b8c738895f3fae85b592176)
Branch: v3.2
https://github.com/mongodb/mongo/commit/53f855e045c0e97f49986519e6675e2f6d86f367

Comment by Githook User [ 22/Dec/15 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: SERVER-21529 Don't assume char is unsigned in logging
Branch: master
https://github.com/mongodb/mongo/commit/07b2e02ffddbd9998b8c738895f3fae85b592176

Generated at Thu Feb 08 03:57:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.