[CDRIVER-2282] Test that mongoc_topology_compatible accepts null bson_error_t pointer Created: 14/Sep/17  Updated: 28/Oct/23  Resolved: 02/Oct/17

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.9.0
Fix Version/s: 1.8.1, 1.9.0

Type: Improvement Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

An incompatible topology is possible beginning in 1.9.0 when we bump our min wire version to 2 (dropping support for MongoDB 2.4 and older).

We have a risky convention throughout our code that bson_error_t pointers can be NULL, which sometimes bites us. There was a latent bug in mongoc_topology_compatible that tried to memcpy topology->compatibility_error to the bson_error_t out-pointer even if the latter was NULL, fixed as part of CDRIVER-2270. Write a test to prevent regression.



 Comments   
Comment by Githook User [ 13/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: Revert "CDRIVER-2282 test NULL error and mongoc_topology_compatible"

This reverts commit 7e8c82d

I forgot that on the 1.8 branch, a maxWireVersion 1 server is still
considered compatible.
Branch: r1.8
https://github.com/mongodb/mongo-c-driver/commit/bfcd1a4cd2aee39ec56cca365bd6e90dcf65e6af

Comment by Githook User [ 12/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2282 test NULL error and mongoc_topology_compatible
Branch: debian
https://github.com/mongodb/mongo-c-driver/commit/7e8c82db0a5f748c43439415d01a5e97e6512bfe

Comment by Githook User [ 02/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2282 test NULL error and mongoc_topology_compatible
Branch: r1.8
https://github.com/mongodb/mongo-c-driver/commit/7e8c82db0a5f748c43439415d01a5e97e6512bfe

Comment by Githook User [ 02/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: CDRIVER-2282 test NULL error and mongoc_topology_compatible
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/20f983378b7690df3a2ce26f2304b32d29244dfc

Comment by A. Jesse Jiryu Davis [ 14/Sep/17 ]

Also backport to r1.8 branch in case there's a 1.8.1 release - it would deserve to have the fix and this test too.

Generated at Wed Feb 07 21:14:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.