Skip to content

Commit 2ed06da

Browse files
committed
MONGOCRYPT-797 bump libbson to 1.30.3 (#996)
* bump downloaded libbson from 1.28.1 to 1.30.3 * add patch for old GCC
1 parent 941f152 commit 2ed06da

8 files changed

+180
-15
lines changed

.evergreen/linker-tests.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ if is_true USE_NINJA; then
5959
fi
6060

6161
run_chdir "$MONGOC_DIR" git apply --ignore-whitespace "$linker_tests_deps_root/bson_patches/libbson1.patch"
62-
# Apply patch to fix compile on RHEL 6.2. TODO: try to remove once RHEL 6.2 is dropped (MONGOCRYPT-688).
62+
# Apply patches to fix compile on RHEL 6.2. TODO: try to remove once RHEL 6.2 is dropped (MONGOCRYPT-688).
6363
run_chdir "$MONGOC_DIR" git apply "$LIBMONGOCRYPT_DIR/etc/libbson-remove-GCC-diagnostic-pragma.patch"
64+
run_chdir "$MONGOC_DIR" git apply "$LIBMONGOCRYPT_DIR/etc/libbson-remove-GCC-diagnostic-in-functions.patch"
6465

6566
BUILD_PATH="$MONGOC_DIR/cmake-build"
6667
BSON1_INSTALL_PATH="$linker_tests_root/install/bson1"
@@ -79,6 +80,7 @@ run_chdir "$MONGOC_DIR" git reset --hard
7980
run_chdir "$MONGOC_DIR" git apply --ignore-whitespace "$linker_tests_deps_root/bson_patches/libbson2.patch"
8081
# Apply patch to fix compile on RHEL 6.2. TODO: try to remove once RHEL 6.2 is dropped (MONGOCRYPT-688).
8182
run_chdir "$MONGOC_DIR" git apply "$LIBMONGOCRYPT_DIR/etc/libbson-remove-GCC-diagnostic-pragma.patch"
83+
run_chdir "$MONGOC_DIR" git apply "$LIBMONGOCRYPT_DIR/etc/libbson-remove-GCC-diagnostic-in-functions.patch"
8284
LIBBSON2_SRC_DIR="$MONGOC_DIR"
8385
echo "Prepare libbson2 ... done"
8486

.evergreen/prep_c_driver_source.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -euxo pipefail
44

55
# Clone mongo-c-driver and check out to a tagged version.
6-
MONGO_C_DRIVER_VERSION=1.28.1
6+
MONGO_C_DRIVER_VERSION=1.30.3
77

88
# Force checkout with lf endings since .sh must have lf, not crlf on Windows
99
git clone https://github.com/mongodb/mongo-c-driver.git --config core.eol=lf --config core.autocrlf=false --depth=1 --branch $MONGO_C_DRIVER_VERSION

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# ChangeLog
2+
## 1.13.2
3+
### Notes
4+
- Bump downloaded libbson version from 1.28.1 to 1.30.3. Fixes a CMake configure error on macOS with CMake 4.
25
## 1.13.1
36
### Fixed
47
- Fix possible double free on parse error of malformed payload.

cmake/FetchMongoC.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
include (FetchContent)
22

33
# Set the tag that we will fetch.
4-
# When updating the version of libbson, also update the version in etc/purls.txt
5-
set (MONGOC_FETCH_TAG_FOR_LIBBSON "1.28.1" CACHE STRING "The Git tag of mongo-c-driver that will be fetched to obtain libbson")
4+
# When updating the version of libbson, also update the version in etc/purls.txt and .evergreen/prep_c_driver_source.sh
5+
set (MONGOC_FETCH_TAG_FOR_LIBBSON "1.30.3" CACHE STRING "The Git tag of mongo-c-driver that will be fetched to obtain libbson")
66

77
# Add an option to disable patching if a patch command is unavailable.
88
option (LIBBSON_PATCH_ENABLED "Whether to apply patches to the libbson library" ON)
@@ -18,6 +18,8 @@ make_patch_command (patch_command
1818
DISABLED "${patch_disabled}"
1919
PATCHES
2020
${PROJECT_SOURCE_DIR}/etc/libbson-remove-GCC-diagnostic-pragma.patch
21+
# Fix old GCC error: "#pragma GCC diagnostic not allowed inside functions". Remove patch after libbson 2.0.0:
22+
${PROJECT_SOURCE_DIR}/etc/libbson-remove-GCC-diagnostic-in-functions.patch
2123
)
2224

2325
# Fetch the source archive for the requested tag from GitHub

etc/cyclonedx.sbom.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"components": [
33
{
4-
"bom-ref": "pkg:github/mongodb/mongo-c-driver@v1.28.1#src/libbson",
4+
"bom-ref": "pkg:github/mongodb/mongo-c-driver@v1.30.3#src/libbson",
55
"copyright": "Copyright 2009-present MongoDB, Inc.",
66
"externalReferences": [
77
{
88
"type": "distribution",
9-
"url": "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/v1.28.1.tar.gz"
9+
"url": "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/v1.30.3.tar.gz"
1010
},
1111
{
1212
"type": "website",
13-
"url": "https://github.com/mongodb/mongo-c-driver/tree/v1.28.1"
13+
"url": "https://github.com/mongodb/mongo-c-driver/tree/v1.30.3"
1414
}
1515
],
1616
"group": "mongodb",
@@ -22,9 +22,9 @@
2222
}
2323
],
2424
"name": "mongo-c-driver",
25-
"purl": "pkg:github/mongodb/mongo-c-driver@v1.28.1#src/libbson",
25+
"purl": "pkg:github/mongodb/mongo-c-driver@v1.30.3#src/libbson",
2626
"type": "library",
27-
"version": "v1.28.1"
27+
"version": "v1.30.3"
2828
},
2929
{
3030
"bom-ref": "pkg:generic/IntelRDFPMathLib@20U2?download_url=https://www.netlib.org/misc/intel/IntelRDFPMathLib20U2.tar.gz",
@@ -53,11 +53,11 @@
5353
"ref": "pkg:generic/IntelRDFPMathLib@20U2?download_url=https://www.netlib.org/misc/intel/IntelRDFPMathLib20U2.tar.gz"
5454
},
5555
{
56-
"ref": "pkg:github/mongodb/mongo-c-driver@v1.28.1#src/libbson"
56+
"ref": "pkg:github/mongodb/mongo-c-driver@v1.30.3#src/libbson"
5757
}
5858
],
5959
"metadata": {
60-
"timestamp": "2025-02-27T16:24:58.542719+00:00",
60+
"timestamp": "2025-04-08T13:06:37.750496+00:00",
6161
"tools": [
6262
{
6363
"externalReferences": [
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
diff --git a/src/libmongoc/src/mongoc/mongoc-collection.c b/src/libmongoc/src/mongoc/mongoc-collection.c
2+
index d21a043788..ac0194e477 100644
3+
--- a/src/libmongoc/src/mongoc/mongoc-collection.c
4+
+++ b/src/libmongoc/src/mongoc/mongoc-collection.c
5+
@@ -681,6 +681,7 @@ mongoc_collection_command_simple (mongoc_collection_t *collection,
6+
*--------------------------------------------------------------------------
7+
*/
8+
9+
+BEGIN_IGNORE_DEPRECATIONS
10+
int64_t
11+
mongoc_collection_count (mongoc_collection_t *collection, /* IN */
12+
mongoc_query_flags_t flags, /* IN */
13+
@@ -705,13 +706,12 @@ mongoc_collection_count (mongoc_collection_t *collection, /* IN */
14+
/* Server Selection Spec: "may-use-secondary" commands SHOULD take a read
15+
* preference argument and otherwise MUST use the default read preference
16+
* from client, database or collection configuration. */
17+
- BEGIN_IGNORE_DEPRECATIONS
18+
ret = mongoc_collection_count_with_opts (collection, flags, query, skip, limit, &opts, read_prefs, error);
19+
- END_IGNORE_DEPRECATIONS
20+
21+
bson_destroy (&opts);
22+
return ret;
23+
}
24+
+END_IGNORE_DEPRECATIONS
25+
26+
27+
int64_t
28+
@@ -1231,6 +1231,7 @@ mongoc_collection_keys_to_index_string (const bson_t *keys)
29+
}
30+
31+
32+
+BEGIN_IGNORE_DEPRECATIONS
33+
bool
34+
mongoc_collection_create_index (mongoc_collection_t *collection,
35+
const bson_t *keys,
36+
@@ -1240,15 +1241,14 @@ mongoc_collection_create_index (mongoc_collection_t *collection,
37+
bson_t reply;
38+
bool ret;
39+
40+
- BEGIN_IGNORE_DEPRECATIONS
41+
42+
ret = mongoc_collection_create_index_with_opts (collection, keys, opt, NULL, &reply, error);
43+
44+
- END_IGNORE_DEPRECATIONS
45+
46+
bson_destroy (&reply);
47+
return ret;
48+
}
49+
+END_IGNORE_DEPRECATIONS
50+
51+
static bool
52+
_mongoc_collection_index_keys_equal (const bson_t *expected, const bson_t *actual)
53+
@@ -1578,16 +1578,16 @@ done:
54+
}
55+
56+
57+
+BEGIN_IGNORE_DEPRECATIONS
58+
bool
59+
mongoc_collection_ensure_index (mongoc_collection_t *collection,
60+
const bson_t *keys,
61+
const mongoc_index_opt_t *opt,
62+
bson_error_t *error)
63+
{
64+
- BEGIN_IGNORE_DEPRECATIONS
65+
return mongoc_collection_create_index (collection, keys, opt, error);
66+
- END_IGNORE_DEPRECATIONS
67+
}
68+
+END_IGNORE_DEPRECATIONS
69+
70+
71+
mongoc_cursor_t *
72+
@@ -2317,6 +2317,7 @@ mongoc_collection_replace_one (mongoc_collection_t *collection,
73+
*--------------------------------------------------------------------------
74+
*/
75+
76+
+BEGIN_IGNORE_DEPRECATIONS
77+
bool
78+
mongoc_collection_save (mongoc_collection_t *collection,
79+
const bson_t *document,
80+
@@ -2330,7 +2331,6 @@ mongoc_collection_save (mongoc_collection_t *collection,
81+
BSON_ASSERT_PARAM (collection);
82+
BSON_ASSERT_PARAM (document);
83+
84+
- BEGIN_IGNORE_DEPRECATIONS
85+
if (!bson_iter_init_find (&iter, document, "_id")) {
86+
return mongoc_collection_insert (collection, MONGOC_INSERT_NONE, document, write_concern, error);
87+
}
88+
@@ -2350,12 +2350,12 @@ mongoc_collection_save (mongoc_collection_t *collection,
89+
90+
ret = mongoc_collection_update (
91+
collection, MONGOC_UPDATE_UPSERT | MONGOC_UPDATE_NO_VALIDATE, &selector, document, write_concern, error);
92+
- END_IGNORE_DEPRECATIONS
93+
94+
bson_destroy (&selector);
95+
96+
return ret;
97+
}
98+
+END_IGNORE_DEPRECATIONS
99+
100+
101+
bool
102+
diff --git a/src/libmongoc/src/mongoc/mongoc-stream-tls.c b/src/libmongoc/src/mongoc/mongoc-stream-tls.c
103+
index 744fdc4089..252d6209f3 100644
104+
--- a/src/libmongoc/src/mongoc/mongoc-stream-tls.c
105+
+++ b/src/libmongoc/src/mongoc/mongoc-stream-tls.c
106+
@@ -187,6 +187,7 @@ mongoc_stream_tls_check_cert (mongoc_stream_t *stream, const char *host)
107+
*--------------------------------------------------------------------------
108+
*/
109+
110+
+BEGIN_IGNORE_DEPRECATIONS
111+
mongoc_stream_t *
112+
mongoc_stream_tls_new_with_hostname (mongoc_stream_t *base_stream, const char *host, mongoc_ssl_opt_t *opt, int client)
113+
{
114+
@@ -208,9 +209,7 @@ mongoc_stream_tls_new_with_hostname (mongoc_stream_t *base_stream, const char *h
115+
#if defined(MONGOC_ENABLE_SSL_OPENSSL)
116+
return mongoc_stream_tls_openssl_new (base_stream, host, opt, client);
117+
#elif defined(MONGOC_ENABLE_SSL_LIBRESSL)
118+
- BEGIN_IGNORE_DEPRECATIONS
119+
return mongoc_stream_tls_libressl_new (base_stream, host, opt, client);
120+
- END_IGNORE_DEPRECATIONS
121+
#elif defined(MONGOC_ENABLE_SSL_SECURE_TRANSPORT)
122+
return mongoc_stream_tls_secure_transport_new (base_stream, host, opt, client);
123+
#elif defined(MONGOC_ENABLE_SSL_SECURE_CHANNEL)
124+
@@ -219,6 +218,7 @@ mongoc_stream_tls_new_with_hostname (mongoc_stream_t *base_stream, const char *h
125+
#error "Don't know how to create TLS stream"
126+
#endif
127+
}
128+
+END_IGNORE_DEPRECATIONS
129+
130+
#if defined(MONGOC_ENABLE_SSL_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10100000L
131+
/*
132+
diff --git a/src/libmongoc/src/mongoc/mongoc-write-concern.c b/src/libmongoc/src/mongoc/mongoc-write-concern.c
133+
index 82ac8d3c32..10b8585c1c 100644
134+
--- a/src/libmongoc/src/mongoc/mongoc-write-concern.c
135+
+++ b/src/libmongoc/src/mongoc/mongoc-write-concern.c
136+
@@ -492,6 +492,7 @@ mongoc_write_concern_append (mongoc_write_concern_t *write_concern, bson_t *comm
137+
* Returns: A newly allocated mongoc_write_concern_t. This should be freed
138+
* with mongoc_write_concern_destroy().
139+
*/
140+
+BEGIN_IGNORE_DEPRECATIONS
141+
mongoc_write_concern_t *
142+
_mongoc_write_concern_new_from_iter (const bson_iter_t *iter, bson_error_t *error)
143+
{
144+
@@ -532,9 +533,7 @@ _mongoc_write_concern_new_from_iter (const bson_iter_t *iter, bson_error_t *erro
145+
if (!BSON_ITER_HOLDS_BOOL (&inner)) {
146+
goto fail;
147+
}
148+
- BEGIN_IGNORE_DEPRECATIONS
149+
mongoc_write_concern_set_fsync (write_concern, bson_iter_bool (&inner));
150+
- END_IGNORE_DEPRECATIONS
151+
} else if (BSON_ITER_IS_KEY (&inner, "j")) {
152+
if (!BSON_ITER_HOLDS_BOOL (&inner)) {
153+
goto fail;
154+
@@ -560,3 +559,4 @@ fail:
155+
mongoc_write_concern_destroy (write_concern);
156+
return NULL;
157+
}
158+
+END_IGNORE_DEPRECATIONS

etc/libbson-remove-GCC-diagnostic-pragma.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
diff --git a/src/common/bson-dsl.h b/src/common/bson-dsl.h
1+
diff --git a/src/common/src/common-bson-dsl-private.h b/src/common/src/common-bson-dsl-private.h
22
index 58a14e28e..3341e603f 100644
3-
--- a/src/common/bson-dsl.h
4-
+++ b/src/common/bson-dsl.h
3+
--- a/src/common/src/common-bson-dsl-private.h
4+
+++ b/src/common/src/common-bson-dsl-private.h
55
@@ -29,6 +29,13 @@ enum {
66
BSON_IF_WINDOWS (__declspec (selectany)) \
77
BSON_IF_POSIX (__attribute__ ((weak)))

etc/purls.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# `copyright` property. This information can be manually added.
99

1010
# libbson is obtained via `cmake/FetchMongoC.cmake`.
11-
pkg:github/mongodb/mongo-c-driver@v1.28.1?#src/libbson
11+
pkg:github/mongodb/mongo-c-driver@v1.30.3?#src/libbson
1212

1313
# IntelDFP is obtained via `cmake/IntelDFP.cmake`
1414
pkg:generic/IntelRDFPMathLib@20U2?download_url=https://www.netlib.org/misc/intel/IntelRDFPMathLib20U2.tar.gz

0 commit comments

Comments
 (0)