From 9329b99cba735842f704f378679cbc000a4c8868 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Mon, 11 Mar 2019 22:07:12 +0000 Subject: [PATCH 01/16] Continue with 5.0.1-dev --- CMakeLists.txt | 4 ++-- doc/client_lua_api.txt | 4 ++-- doc/menu_lua_api.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 121086680..a2fed51e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,11 +17,11 @@ set(CLANG_MINIMUM_VERSION "3.4") # Also remember to set PROTOCOL_VERSION in network/networkprotocol.h when releasing set(VERSION_MAJOR 5) set(VERSION_MINOR 0) -set(VERSION_PATCH 0) +set(VERSION_PATCH 1) set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string") # Change to false for releases -set(DEVELOPMENT_BUILD FALSE) +set(DEVELOPMENT_BUILD TRUE) set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") if(VERSION_EXTRA) diff --git a/doc/client_lua_api.txt b/doc/client_lua_api.txt index f0e585355..9253b5568 100644 --- a/doc/client_lua_api.txt +++ b/doc/client_lua_api.txt @@ -1,5 +1,5 @@ -Minetest Lua Client Modding API Reference 5.0.0 -================================================ +Minetest Lua Client Modding API Reference 5.0.1 +=============================================== * More information at * Developer Wiki: diff --git a/doc/menu_lua_api.txt b/doc/menu_lua_api.txt index 419bc2f8a..2c76c6b8f 100644 --- a/doc/menu_lua_api.txt +++ b/doc/menu_lua_api.txt @@ -1,4 +1,4 @@ -Minetest Lua Mainmenu API Reference 5.0.0 +Minetest Lua Mainmenu API Reference 5.0.1 ========================================= Introduction From fc24bf09153f17bec023cde164a039202102a66c Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 6 Mar 2019 22:24:39 +0000 Subject: [PATCH 02/16] Fix incorrect string length check after cast --- src/network/networkpacket.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/network/networkpacket.cpp b/src/network/networkpacket.cpp index 35a131a34..6d869e5eb 100644 --- a/src/network/networkpacket.cpp +++ b/src/network/networkpacket.cpp @@ -110,11 +110,12 @@ NetworkPacket& NetworkPacket::operator>>(std::string& dst) NetworkPacket& NetworkPacket::operator<<(const std::string &src) { - u16 msgsize = src.size(); - if (msgsize > STRING_MAX_LEN) { + if (src.size() > STRING_MAX_LEN) { throw PacketError("String too long"); } + u16 msgsize = src.size(); + *this << msgsize; putRawString(src.c_str(), (u32)msgsize); @@ -124,11 +125,12 @@ NetworkPacket& NetworkPacket::operator<<(const std::string &src) void NetworkPacket::putLongString(const std::string &src) { - u32 msgsize = src.size(); - if (msgsize > LONG_STRING_MAX_LEN) { + if (src.size() > LONG_STRING_MAX_LEN) { throw PacketError("String too long"); } + u32 msgsize = src.size(); + *this << msgsize; putRawString(src.c_str(), msgsize); @@ -160,11 +162,12 @@ NetworkPacket& NetworkPacket::operator>>(std::wstring& dst) NetworkPacket& NetworkPacket::operator<<(const std::wstring &src) { - u16 msgsize = src.size(); - if (msgsize > WIDE_STRING_MAX_LEN) { + if (src.size() > WIDE_STRING_MAX_LEN) { throw PacketError("String too long"); } + u16 msgsize = src.size(); + *this << msgsize; // Write string From da4739a26cb8327d1e6c5d8642692e5fbb0ad4a0 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Thu, 7 Mar 2019 06:41:21 +0000 Subject: [PATCH 03/16] Fix detach inventory serialisation (#8331) --- src/network/clientpackethandler.cpp | 6 ++++-- src/server.cpp | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 3e50173a6..889002a82 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -895,8 +895,10 @@ void Client::handleCommand_DetachedInventory(NetworkPacket* pkt) inv = inv_it->second; } - std::string contents; - *pkt >> contents; + u16 ignore; + *pkt >> ignore; // this used to be the length of the following string, ignore it + + std::string contents = pkt->getRemainingString(); std::istringstream is(contents, std::ios::binary); inv->deSerialize(is); } diff --git a/src/server.cpp b/src/server.cpp index ad469d655..701339ad8 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2576,7 +2576,10 @@ void Server::sendDetachedInventory(const std::string &name, session_t peer_id) // Serialization & NetworkPacket isn't a love story std::ostringstream os(std::ios_base::binary); inv_it->second->serialize(os); - pkt << os.str(); + + std::string os_str = os.str(); + pkt << static_cast(os_str.size()); // HACK: to keep compatibility with 5.0.0 clients + pkt.putRawString(os_str); } if (peer_id == PEER_ID_INEXISTENT) From bf4deb0ce628b423600d397a725831cc980e961c Mon Sep 17 00:00:00 2001 From: Paramat Date: Sun, 10 Mar 2019 01:49:03 +0000 Subject: [PATCH 04/16] Confirm registration GUI: Remove positional strings to fix Windows bug (#8258) Positional strings don't work on some Windows builds. Remove server address string, leave player name string present. --- src/gui/guiConfirmRegistration.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/gui/guiConfirmRegistration.cpp b/src/gui/guiConfirmRegistration.cpp index 9a374b405..6e6b7ad16 100644 --- a/src/gui/guiConfirmRegistration.cpp +++ b/src/gui/guiConfirmRegistration.cpp @@ -89,23 +89,18 @@ void GUIConfirmRegistration::regenerateGui(v2u32 screensize) */ s32 ypos = 30 * s; { - std::string address = m_address; - if (address.empty()) - address = "localhost"; core::rect rect2(0, 0, 540 * s, 180 * s); rect2 += topleft_client + v2s32(30 * s, ypos); static const std::string info_text_template = strgettext( - "You are about to join the server at %1$s with the " - "name \"%2$s\" for the first time. If you proceed, a " - "new account using your credentials will be created " - "on this server.\n" - "Please retype your password and click Register and " - "Join to confirm account creation or click Cancel to " - "abort."); + "You are about to join this server with the name \"%s\" for the " + "first time.\n" + "If you proceed, a new account using your credentials will be " + "created on this server.\n" + "Please retype your password and click 'Register and Join' to " + "confirm account creation, or click 'Cancel' to abort."); char info_text_buf[1024]; porting::mt_snprintf(info_text_buf, sizeof(info_text_buf), - info_text_template.c_str(), address.c_str(), - m_playername.c_str()); + info_text_template.c_str(), m_playername.c_str()); wchar_t *info_text_buf_wide = utf8_to_wide_c(info_text_buf); gui::IGUIEditBox *e = new gui::intlGUIEditBox(info_text_buf_wide, true, From d8ece2e3e951e070b37f670bd910d24855be5262 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 10 Mar 2019 18:53:02 +0000 Subject: [PATCH 05/16] Fix serialization of std::time_t by casting to u64 first (#8353) Fixes #8332 --- src/network/clientpackethandler.cpp | 4 +++- src/network/networkpacket.cpp | 16 ---------------- src/network/networkpacket.h | 4 ---- src/server.cpp | 2 +- 4 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 889002a82..2f5deae2a 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -408,7 +408,9 @@ void Client::handleCommand_ChatMessage(NetworkPacket *pkt) return; } - *pkt >> chatMessage->sender >> chatMessage->message >> chatMessage->timestamp; + u64 timestamp; + *pkt >> chatMessage->sender >> chatMessage->message >> timestamp; + chatMessage->timestamp = static_cast(timestamp); chatMessage->type = (ChatMessageType) message_type; diff --git a/src/network/networkpacket.cpp b/src/network/networkpacket.cpp index 6d869e5eb..22c035c5b 100644 --- a/src/network/networkpacket.cpp +++ b/src/network/networkpacket.cpp @@ -281,12 +281,6 @@ NetworkPacket& NetworkPacket::operator<<(u64 src) return *this; } -NetworkPacket& NetworkPacket::operator<<(std::time_t src) -{ - *this << (u64) src; - return *this; -} - NetworkPacket& NetworkPacket::operator<<(float src) { checkDataSize(4); @@ -372,16 +366,6 @@ NetworkPacket& NetworkPacket::operator>>(u64& dst) return *this; } -NetworkPacket& NetworkPacket::operator>>(std::time_t& dst) -{ - checkReadOffset(m_read_offset, 8); - - dst = readU64(&m_data[m_read_offset]); - - m_read_offset += 8; - return *this; -} - NetworkPacket& NetworkPacket::operator>>(float& dst) { checkReadOffset(m_read_offset, 4); diff --git a/src/network/networkpacket.h b/src/network/networkpacket.h index 760b51f7a..a8b741374 100644 --- a/src/network/networkpacket.h +++ b/src/network/networkpacket.h @@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once -#include #include "util/pointer.h" #include "util/numeric.h" #include "networkprotocol.h" @@ -88,9 +87,6 @@ public: NetworkPacket &operator>>(u64 &dst); NetworkPacket &operator<<(u64 src); - NetworkPacket &operator>>(std::time_t &dst); - NetworkPacket &operator<<(std::time_t src); - NetworkPacket &operator>>(float &dst); NetworkPacket &operator<<(float src); diff --git a/src/server.cpp b/src/server.cpp index 701339ad8..003ad45b4 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1559,7 +1559,7 @@ void Server::SendChatMessage(session_t peer_id, const ChatMessage &message) NetworkPacket pkt(TOCLIENT_CHAT_MESSAGE, 0, peer_id); u8 version = 1; u8 type = message.type; - pkt << version << type << std::wstring(L"") << message.message << message.timestamp; + pkt << version << type << std::wstring(L"") << message.message << (u64)message.timestamp; if (peer_id != PEER_ID_INEXISTENT) { RemotePlayer *player = m_env->getPlayer(peer_id); From 19825d853e6f30685f367e99e206327a6bcf14a2 Mon Sep 17 00:00:00 2001 From: sofar Date: Mon, 4 Mar 2019 23:11:13 -0800 Subject: [PATCH 06/16] getS16NoEx() returns true unless syntactical error in conf. (#8304) The getS16NoEx() handler will return true unless there is a `[num_emerge_threads]` line in the `minetest.conf` at which point the excption handler part is reached. Due to the fact that `defaultsettings.cpp` has a default value set for this setting, that never will happen. Because of this, the code will never check the number of threads on the system, and keep `nthreads = 0`. If that happens, the value is changed to `1` and only 1 emerge thread will be used. The default should be set to `1` instead, due to the potential unsafe consequences for the standard sqlite map files, but that should be a separate commit that also adds documentation for that setting. This commit focuses on removing this `hiding` bug instead. --- src/emerge.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/emerge.cpp b/src/emerge.cpp index 592b1bef7..0ad6ee29b 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -130,11 +130,13 @@ EmergeManager::EmergeManager(Server *server) // If unspecified, leave a proc for the main thread and one for // some other misc thread - s16 nthreads = 0; - if (!g_settings->getS16NoEx("num_emerge_threads", nthreads)) + s16 nthreads; + g_settings->getS16NoEx("num_emerge_threads", nthreads); + if (nthreads == 0) nthreads = Thread::getNumberOfProcessors() - 2; if (nthreads < 1) nthreads = 1; + verbosestream << "Using " << nthreads << " emerge threads." << std::endl; m_qlimit_total = g_settings->getU16("emergequeue_limit_total"); if (!g_settings->getU16NoEx("emergequeue_limit_diskonly", m_qlimit_diskonly)) From 82739f4d7d634eaccdc8414382da5d55ae39734d Mon Sep 17 00:00:00 2001 From: Paramat Date: Tue, 5 Mar 2019 22:58:38 +0000 Subject: [PATCH 07/16] Change 'num_emerge_threads' default to 1 (#8303) --- builtin/settingtypes.txt | 2 +- minetest.conf.example | 2 +- src/defaultsettings.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index da9b8bf10..3df0376a3 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -1925,7 +1925,7 @@ emergequeue_limit_generate (Limit of emerge queues to generate) int 64 # processes, especially in singleplayer and/or when running Lua code in # 'on_generated'. # For many users the optimum setting may be '1'. -num_emerge_threads (Number of emerge threads) int 0 +num_emerge_threads (Number of emerge threads) int 1 [Online Content Repository] diff --git a/minetest.conf.example b/minetest.conf.example index f31d9356a..6e40a4b6b 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -3005,7 +3005,7 @@ # 'on_generated'. # For many users the optimum setting may be '1'. # type: int -# num_emerge_threads = 0 +# num_emerge_threads = 1 # # Online Content Repository diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 1df6dccb6..5a56f3d77 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -374,7 +374,7 @@ void set_default_settings(Settings *settings) settings->setDefault("emergequeue_limit_total", "512"); settings->setDefault("emergequeue_limit_diskonly", "64"); settings->setDefault("emergequeue_limit_generate", "64"); - settings->setDefault("num_emerge_threads", "0"); + settings->setDefault("num_emerge_threads", "1"); settings->setDefault("secure.enable_security", "true"); settings->setDefault("secure.trusted_mods", ""); settings->setDefault("secure.http_mods", ""); From 444ec1e4128e68523f1bbf51aa03e8bf2006156c Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 12 Mar 2019 07:56:56 +0000 Subject: [PATCH 08/16] HPChange Reason: Fix push after free, and type being overwritten (#8359) * HPChange Reason: Fix push after free, and type being overwritten Fixes #8227 and #8344 --- src/content_sao.h | 5 +++++ src/script/cpp_api/s_base.cpp | 14 +++++++++----- src/script/lua_api/l_object.cpp | 3 +++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/content_sao.h b/src/content_sao.h index 14f959e30..f54bc16c2 100644 --- a/src/content_sao.h +++ b/src/content_sao.h @@ -405,6 +405,11 @@ struct PlayerHPChangeReason { bool from_mod = false; int lua_reference = -1; + inline bool hasLuaReference() const + { + return lua_reference >= 0; + } + bool setTypeFromString(const std::string &typestr) { if (typestr == "set_hp") diff --git a/src/script/cpp_api/s_base.cpp b/src/script/cpp_api/s_base.cpp index bf89f748c..a8ed902dd 100644 --- a/src/script/cpp_api/s_base.cpp +++ b/src/script/cpp_api/s_base.cpp @@ -384,14 +384,18 @@ void ScriptApiBase::objectrefGetOrCreate(lua_State *L, void ScriptApiBase::pushPlayerHPChangeReason(lua_State *L, const PlayerHPChangeReason &reason) { - if (reason.lua_reference >= 0) { + if (reason.hasLuaReference()) lua_rawgeti(L, LUA_REGISTRYINDEX, reason.lua_reference); - luaL_unref(L, LUA_REGISTRYINDEX, reason.lua_reference); - } else + else lua_newtable(L); - lua_pushstring(L, reason.getTypeAsString().c_str()); - lua_setfield(L, -2, "type"); + lua_getfield(L, -1, "type"); + bool has_type = (bool)lua_isstring(L, -1); + lua_pop(L, 1); + if (!has_type) { + lua_pushstring(L, reason.getTypeAsString().c_str()); + lua_setfield(L, -2, "type"); + } lua_pushstring(L, reason.from_mod ? "mod" : "engine"); lua_setfield(L, -2, "from"); diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 9edb2f4f8..b3ed39c7c 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -257,6 +257,9 @@ int ObjectRef::l_set_hp(lua_State *L) if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER) getServer(L)->SendPlayerHPOrDie((PlayerSAO *)co, reason); + if (reason.hasLuaReference()) + luaL_unref(L, LUA_REGISTRYINDEX, reason.lua_reference); + // Return return 0; } From dd451a8a0055ad082d3fbc4af34c401f22bfb7d6 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 12 Mar 2019 07:58:02 +0000 Subject: [PATCH 09/16] Fix cast from const by accessing string data directly (#8354) Fixes #8327 --- src/irrlicht_changes/irrUString.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/irrlicht_changes/irrUString.h b/src/irrlicht_changes/irrUString.h index fce49e717..b628c092c 100644 --- a/src/irrlicht_changes/irrUString.h +++ b/src/irrlicht_changes/irrUString.h @@ -2916,13 +2916,13 @@ public: ret[0] = unicode::BOM; else if (endian == unicode::EUTFEE_LITTLE) { - uchar8_t* ptr8 = reinterpret_cast(ret.c_str()); + uchar8_t* ptr8 = reinterpret_cast(&ret[0]); *ptr8++ = unicode::BOM_ENCODE_UTF16_LE[0]; *ptr8 = unicode::BOM_ENCODE_UTF16_LE[1]; } else { - uchar8_t* ptr8 = reinterpret_cast(ret.c_str()); + uchar8_t* ptr8 = reinterpret_cast(&ret[0]); *ptr8++ = unicode::BOM_ENCODE_UTF16_BE[0]; *ptr8 = unicode::BOM_ENCODE_UTF16_BE[1]; } From 10cc62d2ca03517b9653efb18df299fff9c96876 Mon Sep 17 00:00:00 2001 From: Paramat Date: Thu, 14 Mar 2019 12:49:33 +0000 Subject: [PATCH 10/16] num_emerge_threads: Warn of crashes when > 1 (#8357) --- builtin/settingtypes.txt | 8 +++++--- minetest.conf.example | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 3df0376a3..6c5b3f317 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -1915,16 +1915,18 @@ emergequeue_limit_diskonly (Limit of emerge queues on disk) int 64 emergequeue_limit_generate (Limit of emerge queues to generate) int 64 # Number of emerge threads to use. +# WARNING: Currently there are multiple bugs that may cause crashes when +# 'num_emerge_threads' is larger than 1. Until this warning is removed it is +# strongly recommended this value is set to the default '1'. # Empty or 0 value: # - Automatic selection. The number of emerge threads will be # - 'number of processors - 2', with a lower limit of 1. # Any other value: # - Specifies the number of emerge threads, with a lower limit of 1. -# Warning: Increasing the number of emerge threads increases engine mapgen +# WARNING: Increasing the number of emerge threads increases engine mapgen # speed, but this may harm game performance by interfering with other # processes, especially in singleplayer and/or when running Lua code in -# 'on_generated'. -# For many users the optimum setting may be '1'. +# 'on_generated'. For many users the optimum setting may be '1'. num_emerge_threads (Number of emerge threads) int 1 [Online Content Repository] diff --git a/minetest.conf.example b/minetest.conf.example index 6e40a4b6b..6e881596f 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -2994,16 +2994,18 @@ # emergequeue_limit_generate = 64 # Number of emerge threads to use. +# WARNING: Currently there are multiple bugs that may cause crashes when +# 'num_emerge_threads' is larger than 1. Until this warning is removed it is +# strongly recommended this value is set to the default '1'. # Empty or 0 value: # - Automatic selection. The number of emerge threads will be # - 'number of processors - 2', with a lower limit of 1. # Any other value: # - Specifies the number of emerge threads, with a lower limit of 1. -# Warning: Increasing the number of emerge threads increases engine mapgen +# WARNING: Increasing the number of emerge threads increases engine mapgen # speed, but this may harm game performance by interfering with other # processes, especially in singleplayer and/or when running Lua code in -# 'on_generated'. -# For many users the optimum setting may be '1'. +# 'on_generated'. For many users the optimum setting may be '1'. # type: int # num_emerge_threads = 1 From ca1bff6b66c4df8bd42f1249523cf235e275e265 Mon Sep 17 00:00:00 2001 From: paramat Date: Sun, 17 Mar 2019 08:38:15 +0000 Subject: [PATCH 11/16] num_emerge_threads: Fix documentation of automatic selection --- builtin/settingtypes.txt | 2 +- minetest.conf.example | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 6c5b3f317..5d68007e3 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -1918,7 +1918,7 @@ emergequeue_limit_generate (Limit of emerge queues to generate) int 64 # WARNING: Currently there are multiple bugs that may cause crashes when # 'num_emerge_threads' is larger than 1. Until this warning is removed it is # strongly recommended this value is set to the default '1'. -# Empty or 0 value: +# Value 0: # - Automatic selection. The number of emerge threads will be # - 'number of processors - 2', with a lower limit of 1. # Any other value: diff --git a/minetest.conf.example b/minetest.conf.example index 6e881596f..1574d5c3f 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -2997,7 +2997,7 @@ # WARNING: Currently there are multiple bugs that may cause crashes when # 'num_emerge_threads' is larger than 1. Until this warning is removed it is # strongly recommended this value is set to the default '1'. -# Empty or 0 value: +# Value 0: # - Automatic selection. The number of emerge threads will be # - 'number of processors - 2', with a lower limit of 1. # Any other value: From 1ae0335b626e1c9f31cbaf45509099e4676f2d1a Mon Sep 17 00:00:00 2001 From: Paramat Date: Mon, 18 Mar 2019 10:19:53 +0000 Subject: [PATCH 12/16] num_emerge_threads: Initialise value to cope with setting syntax error (#8396) --- src/emerge.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/emerge.cpp b/src/emerge.cpp index 0ad6ee29b..0a1852985 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -128,10 +128,10 @@ EmergeManager::EmergeManager(Server *server) enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info"); - // If unspecified, leave a proc for the main thread and one for - // some other misc thread - s16 nthreads; + s16 nthreads = 1; g_settings->getS16NoEx("num_emerge_threads", nthreads); + // If automatic, leave a proc for the main thread and one for + // some other misc thread if (nthreads == 0) nthreads = Thread::getNumberOfProcessors() - 2; if (nthreads < 1) From 57e0f52aaad7a0dc7738cfa20cfc304294f41e93 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 18 Mar 2019 15:06:27 +0100 Subject: [PATCH 13/16] httpfetch: Disable IPv6 here too if requested by settings (#8399) --- src/httpfetch.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/httpfetch.cpp b/src/httpfetch.cpp index 6b67e0e13..326b5052f 100644 --- a/src/httpfetch.cpp +++ b/src/httpfetch.cpp @@ -253,6 +253,10 @@ HTTPFetchOngoing::HTTPFetchOngoing(const HTTPFetchRequest &request_, curl_easy_setopt(curl, CURLOPT_INTERFACE, bind_address.c_str()); } + if (!g_settings->getBool("enable_ipv6")) { + curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); + } + #if LIBCURL_VERSION_NUM >= 0x071304 // Restrict protocols so that curl vulnerabilities in // other protocols don't affect us. From 538a7b12bd0c5c10e0ef16dde363f16eb447c101 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 18 Mar 2019 22:41:39 +0100 Subject: [PATCH 14/16] Fix texture rotation for wallmounted nodeboxes fixes #8358 --- src/client/mapblock_mesh.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/mapblock_mesh.cpp b/src/client/mapblock_mesh.cpp index ed8a073de..6b5ba9f9d 100644 --- a/src/client/mapblock_mesh.cpp +++ b/src/client/mapblock_mesh.cpp @@ -744,7 +744,7 @@ void getNodeTile(MapNode mn, const v3s16 &p, const v3s16 &dir, MeshMakeData *dat u8 dir_i = ((dir.X + 2 * dir.Y + 3 * dir.Z) & 7) * 2; // Get rotation for things like chests - u8 facedir = mn.getFaceDir(ndef); + u8 facedir = mn.getFaceDir(ndef, true); static const u16 dir_to_tile[24 * 16] = { From cf1802a6de51ec14c98b1424ba95e86a66cf7c75 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 26 Mar 2019 01:18:52 +0000 Subject: [PATCH 15/16] Prevent multi-line chat messages server-side (#8420) --- src/server.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/server.cpp b/src/server.cpp index 003ad45b4..172bb4744 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -2874,8 +2874,13 @@ std::wstring Server::handleChat(const std::string &name, const std::wstring &wna L"It was refused. Send a shorter message"; } + auto message = trim(wide_to_utf8(wmessage)); + if (message.find_first_of("\n\r") != std::wstring::npos) { + return L"New lines are not permitted in chat messages"; + } + // Run script hook, exit if script ate the chat message - if (m_script->on_chat_message(name, wide_to_utf8(wmessage))) + if (m_script->on_chat_message(name, message)) return L""; // Line to send From 76325d0ba925cfdd18e387ae96d27921136e98e5 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 31 Mar 2019 22:57:45 +0200 Subject: [PATCH 16/16] Bump version to 5.0.1 --- CMakeLists.txt | 2 +- build/android/build.gradle | 2 +- misc/net.minetest.minetest.appdata.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a2fed51e1..e647f62b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(VERSION_PATCH 1) set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string") # Change to false for releases -set(DEVELOPMENT_BUILD TRUE) +set(DEVELOPMENT_BUILD FALSE) set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") if(VERSION_EXTRA) diff --git a/build/android/build.gradle b/build/android/build.gradle index 7b9ebb9ec..11a4a714c 100644 --- a/build/android/build.gradle +++ b/build/android/build.gradle @@ -28,7 +28,7 @@ android { buildToolsVersion "28.0.3" defaultConfig { - versionCode 23 + versionCode 24 versionName "${System.env.VERSION_STR}.${versionCode}" minSdkVersion 14 targetSdkVersion 28 diff --git a/misc/net.minetest.minetest.appdata.xml b/misc/net.minetest.minetest.appdata.xml index 089383b5d..f1aab53a9 100644 --- a/misc/net.minetest.minetest.appdata.xml +++ b/misc/net.minetest.minetest.appdata.xml @@ -56,6 +56,6 @@ minetest sfan5@live.de - +