1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
From e534a7e65efabd21e22b9243795e3cd06268f49a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Valenduc?= <francoisvalenduc@gmail.com>
Date: Wed, 30 Apr 2025 00:25:10 +0200
Subject: [PATCH] fix boost
---
src/mongo/db/initialize_server_global_state.cpp | 4 ++--
src/mongo/db/repl/tenant_file_cloner.h | 1 +
src/mongo/db/startup_warnings_mongod.cpp | 1 +
src/mongo/db/storage/backup_block.cpp | 5 ++++-
.../db/storage/storage_engine_lock_file_posix.cpp | 4 ++--
src/mongo/db/storage/storage_engine_metadata.cpp | 4 ++--
.../db/storage/wiredtiger/wiredtiger_kv_engine.cpp | 2 +-
src/mongo/scripting/engine.cpp | 2 +-
src/mongo/shell/shell_utils_extended.cpp | 9 +++++++++
src/mongo/shell/shell_utils_launcher.cpp | 12 ++++++------
src/mongo/shell/shell_utils_launcher.h | 2 +-
src/mongo/util/ctype.h | 1 +
src/mongo/util/processinfo_linux.cpp | 1 +
src/mongo/util/stacktrace_threads.cpp | 10 +++++++---
14 files changed, 39 insertions(+), 19 deletions(-)
diff --git a/src/mongo/db/initialize_server_global_state.cpp b/src/mongo/db/initialize_server_global_state.cpp
index 4dc953ff8ce..2e9e22bfd61 100644
--- a/src/mongo/db/initialize_server_global_state.cpp
+++ b/src/mongo/db/initialize_server_global_state.cpp
@@ -34,7 +34,7 @@
#include "mongo/db/initialize_server_global_state.h"
#include "mongo/db/initialize_server_global_state_gen.h"
-#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem.hpp>
#include <fmt/format.h>
#include <iostream>
#include <memory>
@@ -307,7 +307,7 @@ bool checkAndMoveLogFile(const std::string& absoluteLogpath) {
<< "\" should name a file, not a directory.");
}
- if (!serverGlobalParams.logAppend && boost::filesystem::is_regular(absoluteLogpath)) {
+ if (!serverGlobalParams.logAppend && boost::filesystem::is_regular_file(absoluteLogpath)) {
std::string renameTarget = absoluteLogpath + "." + terseCurrentTimeForFilename();
boost::system::error_code ec;
boost::filesystem::rename(absoluteLogpath, renameTarget, ec);
diff --git a/src/mongo/db/repl/tenant_file_cloner.h b/src/mongo/db/repl/tenant_file_cloner.h
index def09528953..0625e4687f7 100644
--- a/src/mongo/db/repl/tenant_file_cloner.h
+++ b/src/mongo/db/repl/tenant_file_cloner.h
@@ -32,6 +32,7 @@
#include <boost/filesystem.hpp>
#include <memory>
#include <vector>
+#include <fstream>
#include "mongo/db/repl/base_cloner.h"
#include "mongo/db/repl/task_runner.h"
diff --git a/src/mongo/db/startup_warnings_mongod.cpp b/src/mongo/db/startup_warnings_mongod.cpp
index fb4969106af..f19aa6b32c4 100644
--- a/src/mongo/db/startup_warnings_mongod.cpp
+++ b/src/mongo/db/startup_warnings_mongod.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/startup_warnings_mongod.h"
#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/exception.hpp>
#include <fstream>
#ifndef _WIN32
#include <sys/resource.h>
diff --git a/src/mongo/db/storage/backup_block.cpp b/src/mongo/db/storage/backup_block.cpp
index 9b8dc29f209..10fd6632fc3 100644
--- a/src/mongo/db/storage/backup_block.cpp
+++ b/src/mongo/db/storage/backup_block.cpp
@@ -30,6 +30,9 @@
#include "mongo/db/storage/backup_block.h"
#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
#include <set>
#include "mongo/base/string_data.h"
@@ -59,7 +62,7 @@ std::string extractIdentFromPath(const boost::filesystem::path& dbpath,
// Remove the file extension and convert to generic form (i.e. replace "\" with "/"
// on windows, no-op on unix).
- return boost::filesystem::change_extension(identWithExtension, "").generic_string();
+ return boost::filesystem::path(identWithExtension).replace_extension("").generic_string();
}
} // namespace details
diff --git a/src/mongo/db/storage/storage_engine_lock_file_posix.cpp b/src/mongo/db/storage/storage_engine_lock_file_posix.cpp
index 0d67885718a..035b07c2eac 100644
--- a/src/mongo/db/storage/storage_engine_lock_file_posix.cpp
+++ b/src/mongo/db/storage/storage_engine_lock_file_posix.cpp
@@ -55,7 +55,7 @@ void flushMyDirectory(const boost::filesystem::path& file) {
// if called without a fully qualified path it asserts; that makes mongoperf fail.
// so make a warning. need a better solution longer term.
// massert(40389, str::stream() << "Couldn't find parent dir for file: " << file.string(),);
- if (!file.has_branch_path()) {
+ if (!file.has_parent_path()) {
LOGV2(22274,
"warning flushMyDirectory couldn't find parent dir for file: {file}",
"flushMyDirectory couldn't find parent dir for file",
@@ -64,7 +64,7 @@ void flushMyDirectory(const boost::filesystem::path& file) {
}
- boost::filesystem::path dir = file.branch_path(); // parent_path in new boosts
+ boost::filesystem::path dir = file.parent_path(); // parent_path in new boosts
LOGV2_DEBUG(22275, 1, "flushing directory {dir_string}", "dir_string"_attr = dir.string());
diff --git a/src/mongo/db/storage/storage_engine_metadata.cpp b/src/mongo/db/storage/storage_engine_metadata.cpp
index 07b21b448e1..87c7cd56cd1 100644
--- a/src/mongo/db/storage/storage_engine_metadata.cpp
+++ b/src/mongo/db/storage/storage_engine_metadata.cpp
@@ -220,7 +220,7 @@ void flushMyDirectory(const boost::filesystem::path& file) {
// if called without a fully qualified path it asserts; that makes mongoperf fail.
// so make a warning. need a better solution longer term.
// massert(13652, str::stream() << "Couldn't find parent dir for file: " << file.string(),);
- if (!file.has_branch_path()) {
+ if (!file.has_parent_path()) {
LOGV2(22283,
"warning flushMyDirectory couldn't find parent dir for file: {file}",
"flushMyDirectory couldn't find parent dir for file",
@@ -229,7 +229,7 @@ void flushMyDirectory(const boost::filesystem::path& file) {
}
- boost::filesystem::path dir = file.branch_path(); // parent_path in new boosts
+ boost::filesystem::path dir = file.parent_path(); // parent_path in new boosts
LOGV2_DEBUG(22284, 1, "flushing directory {dir_string}", "dir_string"_attr = dir.string());
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index 0de1c43284f..1f400f32612 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -1279,7 +1279,7 @@ WiredTigerKVEngine::beginNonBlockingBackup(OperationContext* opCtx,
// Create ongoingBackup.lock file to signal recovery that it should delete WiredTiger.backup if
// we have an unclean shutdown with the cursor still open.
- { boost::filesystem::ofstream ongoingBackup(getOngoingBackupPath()); }
+ { boost::filesystem::std::ofstream ongoingBackup(getOngoingBackupPath()); }
// Oplog truncation thread won't remove oplog since the checkpoint pinned by the backup cursor.
stdx::lock_guard<Latch> lock(_oplogPinnedByBackupMutex);
diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp
index 49e920bdf69..d198de51788 100644
--- a/src/mongo/scripting/engine.cpp
+++ b/src/mongo/scripting/engine.cpp
@@ -34,7 +34,7 @@
#include "mongo/scripting/engine.h"
#include <algorithm>
-#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem.hpp>
#include "mongo/base/string_data.h"
#include "mongo/client/dbclient_base.h"
diff --git a/src/mongo/shell/shell_utils_extended.cpp b/src/mongo/shell/shell_utils_extended.cpp
index 6cd6dc6ed0d..29b886d6acf 100644
--- a/src/mongo/shell/shell_utils_extended.cpp
+++ b/src/mongo/shell/shell_utils_extended.cpp
@@ -37,6 +37,15 @@
#endif
#include <boost/filesystem.hpp>
+#include <boost/filesystem/directory.hpp>
+#include <boost/filesystem/exception.hpp>
+#include <boost/filesystem/file_status.hpp>
+#include <boost/filesystem/fstream.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+#include <boost/iterator/iterator_facade.hpp>
+#include <boost/move/utility_core.hpp>
+
#include <fmt/format.h>
#include <fstream>
diff --git a/src/mongo/shell/shell_utils_launcher.cpp b/src/mongo/shell/shell_utils_launcher.cpp
index 0f6b6f2cf42..cf18b896c36 100644
--- a/src/mongo/shell/shell_utils_launcher.cpp
+++ b/src/mongo/shell/shell_utils_launcher.cpp
@@ -1000,26 +1000,26 @@ void copyDir(const boost::filesystem::path& from, const boost::filesystem::path&
boost::filesystem::directory_iterator i(from);
while (i != end) {
boost::filesystem::path p = *i;
- if (p.leaf() == "metrics.interim" || p.leaf() == "metrics.interim.temp") {
+ if (p.filename() == "metrics.interim" || p.filename() == "metrics.interim.temp") {
// Ignore any errors for metrics.interim* files as these may disappear during copy
boost::system::error_code ec;
- boost::filesystem::copy_file(p, to / p.leaf(), ec);
+ boost::filesystem::copy_file(p, to / p.filename(), ec);
if (ec) {
LOGV2_INFO(22814,
"Skipping copying of file from '{from}' to "
"'{to}' due to: {error}",
"Skipping copying of file due to error"
"from"_attr = p.generic_string(),
- "to"_attr = (to / p.leaf()).generic_string(),
+ "to"_attr = (to / p.filename()).generic_string(),
"error"_attr = ec.message());
}
- } else if (p.leaf() != "mongod.lock" && p.leaf() != "WiredTiger.lock") {
+ } else if (p.filename() != "mongod.lock" && p.filename() != "WiredTiger.lock") {
if (boost::filesystem::is_directory(p)) {
- boost::filesystem::path newDir = to / p.leaf();
+ boost::filesystem::path newDir = to / p.filename();
boost::filesystem::create_directory(newDir);
copyDir(p, newDir);
} else {
- boost::filesystem::copy_file(p, to / p.leaf());
+ boost::filesystem::copy_file(p, to / p.filename());
}
}
++i;
diff --git a/src/mongo/shell/shell_utils_launcher.h b/src/mongo/shell/shell_utils_launcher.h
index 14a6ce06390..960f78a71e8 100644
--- a/src/mongo/shell/shell_utils_launcher.h
+++ b/src/mongo/shell/shell_utils_launcher.h
@@ -29,7 +29,7 @@
#pragma once
-#include <boost/filesystem/convenience.hpp>
+#include <boost/filesystem/path.hpp>
#include <map>
#include <sstream>
#include <string>
diff --git a/src/mongo/util/ctype.h b/src/mongo/util/ctype.h
index a3880e281a8..78ee57e3d0c 100644
--- a/src/mongo/util/ctype.h
+++ b/src/mongo/util/ctype.h
@@ -67,6 +67,7 @@
#pragma once
#include <array>
+#include <cstdint>
namespace mongo::ctype {
namespace detail {
diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp
index 7793011e901..ff3c940bab0 100644
--- a/src/mongo/util/processinfo_linux.cpp
+++ b/src/mongo/util/processinfo_linux.cpp
@@ -36,6 +36,7 @@
#include <iostream>
#include <malloc.h>
#include <pcrecpp.h>
+#include <fstream>
#include <sched.h>
#include <stdio.h>
#include <sys/mman.h>
diff --git a/src/mongo/util/stacktrace_threads.cpp b/src/mongo/util/stacktrace_threads.cpp
index 51581c4dc9b..99c30f153b0 100644
--- a/src/mongo/util/stacktrace_threads.cpp
+++ b/src/mongo/util/stacktrace_threads.cpp
@@ -35,7 +35,11 @@
#include <array>
#include <atomic>
-#include <boost/filesystem.hpp>
+#include <boost/filesystem/directory.hpp>
+#include <boost/filesystem/fstream.hpp>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+#include <boost/iterator/iterator_facade.hpp>
#include <cstdint>
#include <cstdlib>
#include <dirent.h>
@@ -243,8 +247,8 @@ bool tidExists(int tid) {
std::string readThreadName(int tid) {
std::string threadName;
try {
- boost::filesystem::ifstream in(taskDir() / std::to_string(tid) / "comm");
- std::getline(in, threadName);
+ boost::filesystem::ifstream in(taskDir() / boost::filesystem::path(std::to_string(tid)) / "comm");
+ std::getline(in, threadName);
} catch (...) {
}
return threadName;
--
2.49.0
|