-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix get_database_size on Windows #9663
base: master
Are you sure you want to change the base?
Conversation
Worth noting: I think there are build system PRs in queue which would upgrade the relevant components to make std::filesystem available everywhere; however, linking the stdc++fs library properly across environments poses its own challenges, so I don't think the change from boost to std will be a simple find/replace. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/blockchain_db/lmdb/db_lmdb.cpp
Outdated
if (!epee::file_io_utils::get_file_size(datafile.string(), size)) | ||
size = 0; | ||
return size; | ||
datafile /= boost::filesystem::path(CRYPTONOTE_BLOCKCHAINDATA_FILENAME); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conversion before appending isn't needed and is harder to read
src/common/download.cpp
Outdated
uint64_t existing_size = 0; | ||
if (epee::file_io_utils::get_file_size(control->path, existing_size) && existing_size > 0) | ||
boost::system::error_code ec{}; | ||
uint64_t existing_size = static_cast<uint64_t>(boost::filesystem::file_size(boost::filesystem::path(control->path), ec)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
Replace all calls to epee::file_io::get_file_size with boost::filesystem::file_size in order to avoid lossy conversions from paths to strings, which tend to break filename resolution. This commit fixes a bug on Windows where the get_info RPC call reported a zero database size because BlockchainLMBD::get_database_size returned zero.
0f078fd
to
978f1d7
Compare
Replace all calls to epee::file_io::get_file_size with boost::filesystem::file_size in order to avoid lossy conversions from paths to strings, which tend to break filename resolution. This commit fixes a bug on Windows where the get_info RPC call reported a zero database size because BlockchainLMBD::get_database_size returned zero.