From 7130cf0c61e259ee6d8479cd804e9284cf6859f6 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 3 Oct 2017 10:12:57 +0100 Subject: Add tools::on_startup, and warn about glibc 2.25 bug if found https://sourceware.org/bugzilla/show_bug.cgi?id=21778 --- src/blockchain_utilities/blockchain_export.cpp | 2 +- src/blockchain_utilities/blockchain_import.cpp | 2 +- src/common/util.cpp | 15 +++++++++++++++ src/common/util.h | 2 ++ src/daemon/main.cpp | 2 +- src/debug_utilities/cn_deserialize.cpp | 2 +- src/debug_utilities/object_sizes.cpp | 2 +- src/wallet/wallet_args.cpp | 2 +- 8 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/blockchain_utilities/blockchain_export.cpp b/src/blockchain_utilities/blockchain_export.cpp index 20eca09f2..d27756c66 100644 --- a/src/blockchain_utilities/blockchain_export.cpp +++ b/src/blockchain_utilities/blockchain_export.cpp @@ -55,7 +55,7 @@ int main(int argc, char* argv[]) uint64_t block_stop = 0; bool blocks_dat = false; - tools::sanitize_locale(); + tools::on_startup(); boost::filesystem::path default_data_path {tools::get_default_data_dir()}; boost::filesystem::path default_testnet_data_path {default_data_path / "testnet"}; diff --git a/src/blockchain_utilities/blockchain_import.cpp b/src/blockchain_utilities/blockchain_import.cpp index d6302ea1d..8b7b0d3cb 100644 --- a/src/blockchain_utilities/blockchain_import.cpp +++ b/src/blockchain_utilities/blockchain_import.cpp @@ -551,7 +551,7 @@ int main(int argc, char* argv[]) std::string m_config_folder; std::string db_arg_str; - tools::sanitize_locale(); + tools::on_startup(); boost::filesystem::path default_data_path {tools::get_default_data_dir()}; boost::filesystem::path default_testnet_data_path {default_data_path / "testnet"}; diff --git a/src/common/util.cpp b/src/common/util.cpp index 74a6babf1..30746f680 100644 --- a/src/common/util.cpp +++ b/src/common/util.cpp @@ -30,6 +30,10 @@ #include +#ifdef __GLIBC__ +#include +#endif + #include "include_base_utils.h" #include "file_io_utils.h" using namespace epee; @@ -536,6 +540,17 @@ std::string get_nix_version_display_string() } return false; } + bool on_startup() + { + sanitize_locale(); + +#ifdef __GLIBC__ + const char *ver = gnu_get_libc_version(); + if (!strcmp(ver, "2.25")) + MCLOG_RED(el::Level::Warning, "global", "Running with glibc " << ver << ", hangs may occur - change glibc version if possible"); +#endif + return true; + } void set_strict_default_file_permissions(bool strict) { #if defined(__MINGW32__) || defined(__MINGW__) diff --git a/src/common/util.h b/src/common/util.h index 48bdbbc28..2e4d6e917 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -129,6 +129,8 @@ namespace tools bool sanitize_locale(); + bool on_startup(); + /*! \brief Defines a signal handler for win32 and *nix */ class signal_handler diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp index acc23b9f9..5d06f65dd 100644 --- a/src/daemon/main.cpp +++ b/src/daemon/main.cpp @@ -61,7 +61,7 @@ int main(int argc, char const * argv[]) // TODO parse the debug options like set log level right here at start - tools::sanitize_locale(); + tools::on_startup(); epee::string_tools::set_module_name_and_folder(argv[0]); diff --git a/src/debug_utilities/cn_deserialize.cpp b/src/debug_utilities/cn_deserialize.cpp index a1b569554..7235ef855 100644 --- a/src/debug_utilities/cn_deserialize.cpp +++ b/src/debug_utilities/cn_deserialize.cpp @@ -45,7 +45,7 @@ int main(int argc, char* argv[]) uint32_t log_level = 0; std::string input; - tools::sanitize_locale(); + tools::on_startup(); boost::filesystem::path output_file_path; diff --git a/src/debug_utilities/object_sizes.cpp b/src/debug_utilities/object_sizes.cpp index 47ba5cf6c..63b702700 100644 --- a/src/debug_utilities/object_sizes.cpp +++ b/src/debug_utilities/object_sizes.cpp @@ -64,7 +64,7 @@ int main(int argc, char* argv[]) { size_logger sl; - tools::sanitize_locale(); + tools::on_startup(); mlog_configure("", true); diff --git a/src/wallet/wallet_args.cpp b/src/wallet/wallet_args.cpp index 22cfcc269..6137a0e02 100644 --- a/src/wallet/wallet_args.cpp +++ b/src/wallet/wallet_args.cpp @@ -91,7 +91,7 @@ namespace wallet_args std::string lang = i18n_get_language(); - tools::sanitize_locale(); + tools::on_startup(); tools::set_strict_default_file_permissions(true); epee::string_tools::set_module_name_and_folder(argv[0]); -- cgit v1.2.3