[CDRIVER-3134] Append wrapping driver platform data before CFLAGS and LDFLAGS Created: 17/May/19  Updated: 28/Oct/23  Resolved: 21/Jun/19

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: None
Fix Version/s: 1.15.0

Type: Improvement Priority: Major - P3
Reporter: Jeremy Mikola Assignee: Haris Sheikh (Inactive)
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to PHPC-1378 CFLAGS and LDFLAGS can cause truncate... Closed

 Description   

PHPC-1378 presents a case where PHP platform information is getting cut off due to user-specified CFLAGS and LDFLAGS taking precedence in the handshake document (limited to 512 bytes). While PHP could avoid setting these constants in its own build configuration, that wouldn't apply to deployments where libmongoc is used as a system library. I would like to propose deferring CFLAG/LDFLAG appending until after the wrapping driver's own platform info.

This would require some reordering of the handshake construction, given that the platform string is first initialized during _mongoc_handshake_init, which is likely before a wrapping driver would have a chance to call mongoc_handshake_data_append.

Note: "posix", "stdc", and compiler info are also appended to the platform string before a wrapping driver's data; however, I'm not too concerned with those fields as their values should be short (unlike CFLAGS and LDFLAGS, which can easily exceed a handshake's size limit).



 Comments   
Comment by Githook User [ 26/Jun/19 ]

Author:

{'name': 'Haris Sheikh', 'email': 'harissheikh@Hariss-MacBook-Pro.local'}

Message: CDRIVER-3134 fixed error in oversized_flags test
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/a4c9cb29b5bde87134dd6d9fcb4489fae08e11c4

Comment by Githook User [ 21/Jun/19 ]

Author:

{'name': 'Haris Sheikh', 'email': 'harissheikh@Hariss-MacBook-Pro.local'}

Message: CDRIVER-3134 append wrapping driver platform data before cflags and ldflags
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/facdfe99a069fbfd33ed8a829e2d07f7e3074fc7

Comment by Jeremy Mikola [ 17/May/19 ]

Alternatively, we might consider dropping CFLAGS and LDFLAGS from client metadata altogether, since it's very likely these values may exceed the handshake limit if set and be truncated (with or without extra driver platform data appended). I suppose this is a question of whether incomplete CFLAGS/LDFLAGS are better than no data at all. Is it possible that truncated CFLAGS could lead to incorrect assumptions?

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