Skip to content
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

backport: trivial 2024 10 25 pr1 #6362

Merged
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3070c3e
Merge bitcoin/bitcoin#30078: depends: set AR & RANLIB for CMake
fanquake May 14, 2024
3be0d3e
Merge bitcoin/bitcoin#30097: crypto: disable asan for sha256_sse4 wit…
fanquake May 16, 2024
63e139d
Merge bitcoin/bitcoin#30185: guix: show `*_FLAGS` variables in pre-bu…
fanquake Jun 5, 2024
ca83773
Merge bitcoin/bitcoin#30283: upnp: fix build with miniupnpc 2.2.8
fanquake Jun 19, 2024
479cb8b
Merge bitcoin/bitcoin#30312: contrib: add R(UN)PATH check to ELF symb…
fanquake Jun 26, 2024
9793fb1
Merge bitcoin/bitcoin#30340: test: Added coverage to Block not found …
achow101 Jul 2, 2024
ebed8af
Merge bitcoin/bitcoin#30336: depends: update doc in Qt pwd patch
fanquake Jul 12, 2024
69c04b2
Merge bitcoin/bitcoin#30372: util: Use SteadyClock in RandAddSeedPerfmon
fanquake Jul 12, 2024
4e144be
Merge bitcoin-core/gui#795: Keep focus on "Hide" while ModalOverlay i…
hebasto Jul 15, 2024
745addf
Merge bitcoin/bitcoin#30245: net: Allow -proxy=[::1] on nodes with IP…
achow101 Jul 18, 2024
62dcd43
Merge bitcoin/bitcoin#29880: depends: build FreeType with CMake
fanquake Jul 19, 2024
e016ffa
Merge bitcoin/bitcoin#29878: depends: build expat with CMake
fanquake Jul 24, 2024
57945ce
Merge bitcoin/bitcoin#30506: depends: Cleanup postprocess commands af…
fanquake Jul 25, 2024
df3c239
Merge bitcoin/bitcoin#26950: cleanse: switch to SecureZeroMemory for …
fanquake Jul 26, 2024
e4e5605
Merge bitcoin/bitcoin#30552: test: fix constructor of msg_tx
fanquake Jul 31, 2024
ddaec96
Merge bitcoin/bitcoin#30565: depends: Fix `zeromq` build on OpenBSD
fanquake Aug 1, 2024
f66547f
Merge bitcoin/bitcoin#30588: depends: fix ZMQ CMake getcachesize check
fanquake Aug 6, 2024
8a12237
Merge bitcoin/bitcoin#30630: doc: Update ccache website link
fanquake Aug 12, 2024
1bd090e
Merge bitcoin/bitcoin#30597: doc: Drop no longer needed workaround fo…
fanquake Aug 12, 2024
432f352
Merge bitcoin/bitcoin#30580: doc: Add note about distro's `g++-mingw-…
fanquake Aug 12, 2024
01b570e
Merge bitcoin/bitcoin#29999: guix: fix suggested fake date for openss…
achow101 Aug 12, 2024
745a819
Merge bitcoin/bitcoin#30690: devtools, utxo-snapshot: Fix block heigh…
achow101 Aug 26, 2024
b654479
Merge bitcoin/bitcoin#30705: test: Avoid intermittent block download …
fanquake Aug 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions contrib/devtools/symbol-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ def check_exported_symbols(binary) -> bool:
ok = False
return ok

def check_RUNPATH(binary) -> bool:
assert binary.get(lief.ELF.DYNAMIC_TAGS.RUNPATH) is None
assert binary.get(lief.ELF.DYNAMIC_TAGS.RPATH) is None
return True

def check_ELF_libraries(binary) -> bool:
ok: bool = True
for library in binary.libraries:
Expand Down Expand Up @@ -280,6 +285,7 @@ def check_ELF_ABI(binary) -> bool:
('LIBRARY_DEPENDENCIES', check_ELF_libraries),
('INTERPRETER_NAME', check_ELF_interpreter),
('ABI', check_ELF_ABI),
('RUNPATH', check_RUNPATH),
],
lief.EXE_FORMATS.MACHO: [
('DYNAMIC_LIBRARIES', check_MACHO_libraries),
Expand Down
4 changes: 4 additions & 0 deletions contrib/guix/guix-build
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ INFO: Building ${VERSION:?not set} for platform triple ${HOST:?not set}:
...bind-mounted in container to: '$(DISTSRC_BASE=/distsrc-base && distsrc_for_host "$HOST")'
...outputting in: '$(outdir_for_host "$HOST")'
...bind-mounted in container to: '$(OUTDIR_BASE=/outdir-base && outdir_for_host "$HOST")'
ADDITIONAL FLAGS (if set)
ADDITIONAL_GUIX_COMMON_FLAGS: ${ADDITIONAL_GUIX_COMMON_FLAGS}
ADDITIONAL_GUIX_ENVIRONMENT_FLAGS: ${ADDITIONAL_GUIX_ENVIRONMENT_FLAGS}
ADDITIONAL_GUIX_TIMEMACHINE_FLAGS: ${ADDITIONAL_GUIX_TIMEMACHINE_FLAGS}
EOF

# Run the build script 'contrib/guix/libexec/build.sh' in the build
Expand Down
3 changes: 3 additions & 0 deletions depends/funcs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ $(1)_cmake=env CC="$$($(1)_cc)" \
CXXFLAGS="$$($(1)_cppflags) $$($(1)_cxxflags)" \
LDFLAGS="$$($(1)_ldflags)" \
cmake -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)" \
-DCMAKE_AR=`which $$($(1)_ar)` \
-DCMAKE_NM=`which $$($(1)_nm)` \
-DCMAKE_RANLIB=`which $$($(1)_ranlib)` \
-DCMAKE_INSTALL_LIBDIR=lib/ \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
$$($(1)_config_opts)
Expand Down
16 changes: 11 additions & 5 deletions depends/packages/expat.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@ $(package)_version=2.4.8
$(package)_download_path=https://github.com/libexpat/libexpat/releases/download/R_$(subst .,_,$($(package)_version))/
$(package)_file_name=$(package)-$($(package)_version).tar.xz
$(package)_sha256_hash=f79b8f904b749e3e0d20afeadecf8249c55b2e32d4ebb089ae378df479dcaf25
$(package)_build_subdir=build
$(package)_patches += cmake_minimum.patch

# -D_DEFAULT_SOURCE defines __USE_MISC, which exposes additional
# definitions in endian.h, which are required for a working
# endianess check in configure when building with -flto.
define $(package)_set_vars
$(package)_config_opts=--disable-shared --without-docbook --without-tests --without-examples
$(package)_config_opts += --disable-dependency-tracking --enable-option-checking
$(package)_config_opts += --without-xmlwf
$(package)_config_opts := -DCMAKE_BUILD_TYPE=None -DEXPAT_BUILD_TOOLS=OFF
$(package)_config_opts += -DEXPAT_BUILD_EXAMPLES=OFF -DEXPAT_BUILD_TESTS=OFF
$(package)_config_opts += -DBUILD_SHARED_LIBS=OFF
$(package)_cppflags += -D_DEFAULT_SOURCE
endef

define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/cmake_minimum.patch
endef

define $(package)_config_cmds
$($(package)_autoconf)
$($(package)_cmake) -S .. -B .
endef

define $(package)_build_cmds
Expand All @@ -27,5 +33,5 @@ define $(package)_stage_cmds
endef

define $(package)_postprocess_cmds
rm -rf share lib/cmake lib/*.la
rm -rf share lib/cmake
endef
12 changes: 6 additions & 6 deletions depends/packages/freetype.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ $(package)_version=2.11.0
$(package)_download_path=https://download.savannah.gnu.org/releases/$(package)
$(package)_file_name=$(package)-$($(package)_version).tar.xz
$(package)_sha256_hash=8bee39bd3968c4804b70614a0a3ad597299ad0e824bc8aad5ce8aaf48067bde7
$(package)_build_subdir=build

define $(package)_set_vars
$(package)_config_opts=--without-zlib --without-png --without-harfbuzz --without-bzip2 --disable-static
$(package)_config_opts += --enable-option-checking --without-brotli
$(package)_config_opts := -DCMAKE_BUILD_TYPE=None -DBUILD_SHARED_LIBS=TRUE
$(package)_config_opts += -DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_PNG=TRUE
$(package)_config_opts += -DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE
$(package)_config_opts += -DCMAKE_DISABLE_FIND_PACKAGE_BrotliDec=TRUE
endef

define $(package)_config_cmds
$($(package)_autoconf)
$($(package)_cmake) -S .. -B .
endef

define $(package)_build_cmds
Expand All @@ -21,6 +24,3 @@ define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install
endef

define $(package)_postprocess_cmds
rm -rf share/man lib/*.la
endef
2 changes: 1 addition & 1 deletion depends/packages/libevent.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ define $(package)_stage_cmds
endef

define $(package)_postprocess_cmds
rm bin/event_rpcgen.py && \
rm -rf bin && \
rm include/ev*.h && \
rm include/event2/*_compat.h
endef
5 changes: 5 additions & 0 deletions depends/packages/miniupnpc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ define $(package)_stage_cmds
install *.h $($(package)_staging_prefix_dir)/include/miniupnpc &&\
install libminiupnpc.a $($(package)_staging_prefix_dir)/lib
endef

define $(package)_postprocess_cmds
rm -rf bin && \
rm -rf share
endef
4 changes: 4 additions & 0 deletions depends/packages/qrencode.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ endef
define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install
endef

define $(package)_postprocess_cmds
rm -rf share
endef
2 changes: 1 addition & 1 deletion depends/packages/zeromq.mk
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ define $(package)_stage_cmds
endef

define $(package)_postprocess_cmds
rm -rf bin share lib/*.la
rm -rf share
endef
13 changes: 13 additions & 0 deletions depends/patches/expat/cmake_minimum.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
build: set minimum required CMake to 3.16

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,7 +33,7 @@
# Unlike most of Expat,
# this file is copyrighted under the BSD-license for buildsystem files of KDE.

-cmake_minimum_required(VERSION 3.1.3)
+cmake_minimum_required(VERSION 3.16)

# This allows controlling documented build time switches
# when Expat is pulled in using the add_subdirectory function, e.g.
14 changes: 7 additions & 7 deletions depends/patches/qt/dont_hardcode_pwd.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
commit 0e953866fc4672486e29e1ba6d83b4207e7b2f0b
Author: fanquake <[email protected]>
Date: Tue Aug 18 15:09:06 2020 +0800
Do not assume FHS in scripts

Don't hardcode pwd path
On systems that do not follow the Filesystem Hierarchy Standard, such as
guix, the hardcoded `/bin/pwd` will fail to be found so that the script
will fail.

Let a man use his builtins if he wants to! Also, removes the unnecessary
assumption that pwd lives under /bin/pwd.
Use `pwd`, instead, so that the command can be found through the normal
path search mechanism.

See #15581.
See https://github.com/qt/qtbase/commit/3388de698bfb9bbc456c08f03e83bf3e749df35c.

diff --git a/qtbase/configure b/qtbase/configure
index 08b49a8d..faea5b55 100755
Expand Down
7 changes: 7 additions & 0 deletions src/crypto/sha256_sse4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
namespace sha256_sse4
{
void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks)
#if defined(__clang__) && !defined(__OPTIMIZE__)
/*
clang is unable to compile this with -O0 and -fsanitize=address.
See upstream bug: https://github.com/llvm/llvm-project/issues/92182
*/
__attribute__((no_sanitize("address")))
#endif
{
static const uint32_t K256 alignas(16) [] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
Expand Down
5 changes: 4 additions & 1 deletion src/mapport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,11 @@ static bool ProcessUpnp()
struct UPNPUrls urls;
struct IGDdatas data;
int r;

#if MINIUPNPC_API_VERSION <= 17
r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
#else
r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr), nullptr, 0);
#endif
if (r == 1)
{
if (fDiscover) {
Expand Down
13 changes: 12 additions & 1 deletion src/netbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ std::vector<CNetAddr> WrappedGetAddrInfo(const std::string& name, bool allow_loo
ai_hint.ai_protocol = IPPROTO_TCP;
// We don't care which address family (IPv4 or IPv6) is returned
ai_hint.ai_family = AF_UNSPEC;

// If we allow lookups of hostnames, use the AI_ADDRCONFIG flag to only
// return addresses whose family we have an address configured for.
//
Expand All @@ -58,7 +59,17 @@ std::vector<CNetAddr> WrappedGetAddrInfo(const std::string& name, bool allow_loo
addrinfo* ai_res{nullptr};
const int n_err{getaddrinfo(name.c_str(), nullptr, &ai_hint, &ai_res)};
if (n_err != 0) {
return {};
if ((ai_hint.ai_flags & AI_ADDRCONFIG) == AI_ADDRCONFIG) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this can fix our IPv6 on CI: #6038

I will test it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// AI_ADDRCONFIG on some systems may exclude loopback-only addresses
// If first lookup failed we perform a second lookup without AI_ADDRCONFIG
ai_hint.ai_flags = (ai_hint.ai_flags & ~AI_ADDRCONFIG);
const int n_err_retry{getaddrinfo(name.c_str(), nullptr, &ai_hint, &ai_res)};
if (n_err_retry != 0) {
return {};
}
} else {
return {};
}
}

// Traverse the linked list starting with ai_trav.
Expand Down
10 changes: 10 additions & 0 deletions src/qt/modaloverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ foreverHidden(false)
parent->installEventFilter(this);
raise();
}
ui->closeButton->installEventFilter(this);

blockProcessTime.clear();
setVisible(false);
Expand Down Expand Up @@ -75,6 +76,11 @@ bool ModalOverlay::eventFilter(QObject * obj, QEvent * ev) {
raise();
}
}

if (obj == ui->closeButton && ev->type() == QEvent::FocusOut && layerIsVisible) {
ui->closeButton->setFocus(Qt::OtherFocusReason);
}

return QWidget::eventFilter(obj, ev);
}

Expand Down Expand Up @@ -195,6 +201,10 @@ void ModalOverlay::showHide(bool hide, bool userRequested)
m_animation.setEndValue(QPoint(0, hide ? height() : 0));
m_animation.start(QAbstractAnimation::KeepWhenStopped);
layerIsVisible = !hide;

if (layerIsVisible) {
ui->closeButton->setFocus(Qt::OtherFocusReason);
}
}

void ModalOverlay::closeClicked()
Expand Down
6 changes: 3 additions & 3 deletions src/randomenv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ void RandAddSeedPerfmon(CSHA512& hasher)

// This can take up to 2 seconds, so only do it every 10 minutes.
// Initialize last_perfmon to 0 seconds, we don't skip the first call.
static std::atomic<std::chrono::seconds> last_perfmon{0s};
static std::atomic<SteadyClock::time_point> last_perfmon{SteadyClock::time_point{0s}};
auto last_time = last_perfmon.load();
auto current_time = GetTime<std::chrono::seconds>();
if (current_time < last_time + std::chrono::minutes{10}) return;
auto current_time = SteadyClock::now();
if (current_time < last_time + 10min) return;
last_perfmon = current_time;

std::vector<unsigned char> vData(250000, 0);
Expand Down
8 changes: 4 additions & 4 deletions src/support/cleanse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

#include <cstring>

#if defined(_MSC_VER)
#include <Windows.h> // For SecureZeroMemory.
#if defined(WIN32)
#include <windows.h>
#endif

void memory_cleanse(void *ptr, size_t len)
{
#if defined(_MSC_VER)
/* SecureZeroMemory is guaranteed not to be optimized out by MSVC. */
#if defined(WIN32)
/* SecureZeroMemory is guaranteed not to be optimized out. */
SecureZeroMemory(ptr, len);
#else
std::memset(ptr, 0, len);
Expand Down
3 changes: 3 additions & 0 deletions test/functional/feature_coinstatsindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ def _test_coin_stats_index(self):
)
self.restart_node(1, extra_args=["-coinstatsindex"])

self.log.info("Test obtaining info for a non-existent block hash")
assert_raises_rpc_error(-5, "Block not found", index_node.gettxoutsetinfo, hash_type="none", hash_or_height="ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", use_index=True)

def _test_use_index_option(self):
self.log.info("Test use_index option for nodes running the index")

Expand Down
7 changes: 5 additions & 2 deletions test/functional/test_framework/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -1724,8 +1724,11 @@ class msg_tx:
__slots__ = ("tx",)
msgtype = b"tx"

def __init__(self, tx=CTransaction()):
self.tx = tx
def __init__(self, tx=None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing changes for class CMerkleBlock (same bug):

--- a/test/functional/test_framework/messages.py
+++ b/test/functional/test_framework/messages.py
@@ -1069,9 +1069,16 @@ class CPartialMerkleTree:
 class CMerkleBlock:
     __slots__ = ("header", "txn")
 
-    def __init__(self, header=CBlockHeader(), txn=CPartialMerkleTree()):
+    def __init__(self, header=None, txn=None):
+        if header is None:
+            self.header = CBlockHeader()
+        else:
+            self.header = header
         self.header = header
-        self.txn = txn
+        if txn is None:
+            self.txn = CPartialMerkleTree()
+        else:
+            self.txn = txn

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed: #6373

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

if tx is None:
self.tx = CTransaction()
else:
self.tx = tx

def deserialize(self, f):
self.tx.deserialize(f)
Expand Down