Page MenuHomePhabricator

[backport#16577] util: CBufferedFile fixes
ClosedPublic

Authored by PiRK on Oct 23 2020, 09:20.

Details

Reviewers
Fabien
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rABC06a61dcb12a4: [backport#16577] util: CBufferedFile fixes
Summary

PR description:

The CBufferedFile object guarantees its user is able to "rewind" the data stream (that's being read from a file) up to a certain number of bytes, as specified by the user in the constructor. This guarantee is not honored due to a bug in the SetPos method.

Such rewinding is done in LoadExternalBlockFile() (currently the only user of this object), which deserializes a series of CBlock objects. If that function encounters something unexpected in the data stream, which is coming from a blocks/blk00???.dat file, it "rewinds" to an earlier position in the stream to try to get in sync again. The CBufferedFile object does not actually rewind its file offset; it simply repositions its internal offset, nReadPos, to an earlier position within the object's private buffer; this is why there's a limit to how far the user may rewind.

If LoadExternalBlockFile() needs to rewind (call blkdat.SetPos()), the stream may not be positioned as it should be, causing errors in deserialization. This need to rewind is probably rare, which is likely why this bug hasn't been noticed already. But if this object is used elsewhere in the future, this could be a serious problem, especially as, due to the nature of the bug, the SetPos() sometimes works.

This PR adds a unit test for CBufferedFile that fails due to this bug. (Until now it has had no unit tests.) The unit test provides good documentation and examples for developers trying to understand LoadExternalBlockFile() and for future users of this object.

This PR also adds code to throw an exception from the constructor if the rewind argument is not less than the buffer size (since that doesn't make any sense).

Finally, I discovered that the object is too restrictive in one respect: When the deserialization methods call this object's read method, a check ensures that the number of bytes being requested is less than the size of the buffer (adjusting for the rewind size), else it throws an exception. This restriction is unnecessary; the object being deserialized can be larger than the buffer because multiple reads from disk can satisfy the request.

This is a backport of Core PR16577

Test Plan

ninja && ninja check

Diff Detail

Event Timeline

Owners added a reviewer: Restricted Owners Package.Oct 23 2020, 09:20
PiRK requested review of this revision.Oct 23 2020, 09:20

fix parameter type for SeedInsecureRand

Tail of the build log:

[83/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/interfaces_tests.cpp.o
[84/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/limitedmap_tests.cpp.o
[85/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/op_reversebytes_tests.cpp.o
[86/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/key_tests.cpp.o
[87/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/multisig_tests.cpp.o
[88/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/net_tests.cpp.o
[89/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/netbase_tests.cpp.o
[90/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/prevector_tests.cpp.o
[91/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/pmt_tests.cpp.o
[92/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/policyestimator_tests.cpp.o
[93/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/raii_event_tests.cpp.o
[94/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/mempool_tests.cpp.o
[95/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/radix_tests.cpp.o
[96/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/random_tests.cpp.o
[97/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rcu_tests.cpp.o
[98/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sanity_tests.cpp.o
[99/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rpc_server_tests.cpp.o
[100/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/scheduler_tests.cpp.o
[101/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rwcollection_tests.cpp.o
[102/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_bitfield_tests.cpp.o
[103/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/schnorr_tests.cpp.o
[104/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rpc_tests.cpp.o
[105/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/scriptnum_tests.cpp.o
[106/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_standard_tests.cpp.o
[107/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_commitment_tests.cpp.o
[108/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/serialize_tests.cpp.o
[109/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sigencoding_tests.cpp.o
[110/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_p2sh_tests.cpp.o
[111/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/settings_tests.cpp.o
[112/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sigcache_tests.cpp.o
[113/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sighashtype_tests.cpp.o
[114/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/skiplist_tests.cpp.o
[115/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sigcheckcount_tests.cpp.o
[116/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sighash_tests.cpp.o
[117/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o
FAILED: src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o 
/usr/bin/ccache /usr/bin/c++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBOOST_TEST_DYN_LINK -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/univalue/include -I../../src/. -Isrc -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIE -fvisibility=hidden   -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wshadow -Wredundant-decls -Wformat-security -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++14 -MD -MT src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o -MF src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o.d -o src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o -c ../../src/test/streams_tests.cpp
../../src/test/streams_tests.cpp: In member function ‘void streams_tests::streams_buffered_file_rand::test_method()’:
../../src/test/streams_tests.cpp:357:26: error: cannot convert ‘bool’ to ‘SeedRand’
     SeedInsecureRand(true);
                          ^
In file included from ../../src/test/streams_tests.cpp:8:
../../src/./test/util/setup_common.h:65:46: note:   initializing argument 1 of ‘void SeedInsecureRand(SeedRand)’
 static inline void SeedInsecureRand(SeedRand seed = SeedRand::SEED) {
                                     ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
[118/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_tests.cpp.o
[119/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sync_tests.cpp.o
[120/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/timedata_tests.cpp.o
[121/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/torcontrol_tests.cpp.o
[122/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/txindex_tests.cpp.o
[123/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/util_threadnames_tests.cpp.o
[124/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/uint256_tests.cpp.o
[125/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/txvalidation_tests.cpp.o
[126/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/txvalidationcache_tests.cpp.o
[127/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/undo_tests.cpp.o
[128/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/transaction_tests.cpp.o
[129/422] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/util_tests.cpp.o
[130/422] secp256k1: testing secp256k1-tests
ninja: build stopped: subcommand failed.
Build build-debug failed with exit code 1

Tail of the build log:

[80/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/hash_tests.cpp.o
[81/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/getarg_tests.cpp.o
[82/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/limitedmap_tests.cpp.o
[83/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/key_io_tests.cpp.o
[84/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/interfaces_tests.cpp.o
[85/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/pmt_tests.cpp.o
[86/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/op_reversebytes_tests.cpp.o
[87/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/key_tests.cpp.o
[88/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/policyestimator_tests.cpp.o
[89/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/multisig_tests.cpp.o
[90/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/net_tests.cpp.o
[91/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/prevector_tests.cpp.o
[92/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/netbase_tests.cpp.o
[93/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/raii_event_tests.cpp.o
[94/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/random_tests.cpp.o
[95/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sanity_tests.cpp.o
[96/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rcu_tests.cpp.o
[97/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rpc_server_tests.cpp.o
[98/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_bitfield_tests.cpp.o
[99/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/scheduler_tests.cpp.o
[100/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rwcollection_tests.cpp.o
[101/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/schnorr_tests.cpp.o
[102/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/mempool_tests.cpp.o
[103/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/radix_tests.cpp.o
[104/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_commitment_tests.cpp.o
[105/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/scriptnum_tests.cpp.o
[106/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rpc_tests.cpp.o
[107/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_p2sh_tests.cpp.o
[108/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_standard_tests.cpp.o
[109/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sigencoding_tests.cpp.o
[110/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sighashtype_tests.cpp.o
[111/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sigcache_tests.cpp.o
[112/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/settings_tests.cpp.o
[113/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/skiplist_tests.cpp.o
[114/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/serialize_tests.cpp.o
[115/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o
FAILED: src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o 
/usr/bin/ccache /usr/bin/clang++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBOOST_TEST_DYN_LINK -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/univalue/include -I../../src/. -Isrc -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIE -fvisibility=hidden   -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wshadow -Wshadow-field -Wrange-loop-analysis -Wredundant-decls -Wformat-security -Wredundant-move -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++14 -MD -MT src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o -MF src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o.d -o src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o -c ../../src/test/streams_tests.cpp
../../src/test/streams_tests.cpp:357:5: error: no matching function for call to 'SeedInsecureRand'
    SeedInsecureRand(true);
    ^~~~~~~~~~~~~~~~
../../src/./test/util/setup_common.h:65:20: note: candidate function not viable: no known conversion from 'bool' to 'SeedRand' for 1st argument
static inline void SeedInsecureRand(SeedRand seed = SeedRand::SEED) {
                   ^
1 error generated.
[116/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sighash_tests.cpp.o
[117/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sync_tests.cpp.o
[118/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sigcheckcount_tests.cpp.o
[119/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/timedata_tests.cpp.o
[120/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/txindex_tests.cpp.o
[121/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/torcontrol_tests.cpp.o
[122/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/txvalidation_tests.cpp.o
[123/421] secp256k1: testing secp256k1-tests
[124/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/uint256_tests.cpp.o
[125/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/undo_tests.cpp.o
[126/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/txvalidationcache_tests.cpp.o
[127/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/transaction_tests.cpp.o
[128/421] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_tests.cpp.o
ninja: build stopped: subcommand failed.
Build build-clang failed with exit code 1

Tail of the build log:

[76/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/interfaces_tests.cpp.o
[77/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/limitedmap_tests.cpp.o
[78/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/merkle_tests.cpp.o
[79/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/merkleblock_tests.cpp.o
[80/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/key_io_tests.cpp.o
[81/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/multisig_tests.cpp.o
[82/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/op_reversebytes_tests.cpp.o
[83/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/pmt_tests.cpp.o
[84/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/net_tests.cpp.o
[85/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/ref_tests.cpp.o
[86/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/monolith_opcodes_tests.cpp.o
[87/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/prevector_tests.cpp.o
[88/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/policyestimator_tests.cpp.o
[89/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/miner_tests.cpp.o
[90/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/netbase_tests.cpp.o
[91/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/raii_event_tests.cpp.o
[92/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/random_tests.cpp.o
[93/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rcu_tests.cpp.o
[94/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/reverselock_tests.cpp.o
[95/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sanity_tests.cpp.o
[96/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/scheduler_tests.cpp.o
[97/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rwcollection_tests.cpp.o
[98/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rpc_server_tests.cpp.o
[99/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_bitfield_tests.cpp.o
[100/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/schnorr_tests.cpp.o
[101/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/radix_tests.cpp.o
[102/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_commitment_tests.cpp.o
[103/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_standard_tests.cpp.o
[104/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o
FAILED: src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o 
/usr/bin/ccache /usr/bin/c++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBOOST_TEST_DYN_LINK -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/univalue/include -I../../src/. -Isrc -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIE -fvisibility=hidden   -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wshadow -Wredundant-decls -Wformat-security -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++14 -MD -MT src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o -MF src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o.d -o src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o -c ../../src/test/streams_tests.cpp
../../src/test/streams_tests.cpp: In member function ‘void streams_tests::streams_buffered_file_rand::test_method()’:
../../src/test/streams_tests.cpp:357:26: error: cannot convert ‘bool’ to ‘SeedRand’
     SeedInsecureRand(true);
                          ^
In file included from ../../src/test/streams_tests.cpp:8:
../../src/./test/util/setup_common.h:65:46: note:   initializing argument 1 of ‘void SeedInsecureRand(SeedRand)’
 static inline void SeedInsecureRand(SeedRand seed = SeedRand::SEED) {
                                     ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
[105/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_p2sh_tests.cpp.o
[106/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rpc_tests.cpp.o
[107/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/scriptnum_tests.cpp.o
[108/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/settings_tests.cpp.o
[109/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sync_tests.cpp.o
[110/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sigcache_tests.cpp.o
[111/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/skiplist_tests.cpp.o
[112/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/timedata_tests.cpp.o
[113/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/serialize_tests.cpp.o
[114/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/torcontrol_tests.cpp.o
[115/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/txindex_tests.cpp.o
[116/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/transaction_tests.cpp.o
[117/385] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_tests.cpp.o
In file included from /usr/include/boost/test/unit_test.hpp:19,
                 from ../../src/test/script_tests.cpp:30:
../../src/test/script_tests.cpp: In member function ‘void script_tests::script_build::test_method()’:
../../src/test/script_tests.cpp:541:22: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without
 BOOST_AUTO_TEST_CASE(script_build) {
                      ^~~~~~~~~~~~
ninja: build stopped: subcommand failed.
Build build-without-wallet failed with exit code 1

Tail of the build log:

[73/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/finalization_tests.cpp.o
[74/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/lcg_tests.cpp.o
[75/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/descriptor_tests.cpp.o
[76/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/denialofservice_tests.cpp.o
[77/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/getarg_tests.cpp.o
[78/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/hash_tests.cpp.o
[79/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/limitedmap_tests.cpp.o
[80/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/interfaces_tests.cpp.o
[81/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/key_io_tests.cpp.o
[82/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/multisig_tests.cpp.o
[83/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/key_tests.cpp.o
[84/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/pmt_tests.cpp.o
[85/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/op_reversebytes_tests.cpp.o
[86/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/prevector_tests.cpp.o
[87/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/policyestimator_tests.cpp.o
[88/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/raii_event_tests.cpp.o
[89/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/netbase_tests.cpp.o
[90/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/net_tests.cpp.o
[91/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/random_tests.cpp.o
[92/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sanity_tests.cpp.o
[93/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rcu_tests.cpp.o
[94/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/scheduler_tests.cpp.o
[95/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/mempool_tests.cpp.o
[96/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/radix_tests.cpp.o
[97/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rpc_server_tests.cpp.o
[98/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_bitfield_tests.cpp.o
[99/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rwcollection_tests.cpp.o
[100/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/schnorr_tests.cpp.o
[101/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_commitment_tests.cpp.o
[102/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rpc_tests.cpp.o
[103/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_standard_tests.cpp.o
[104/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o
FAILED: src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o 
/usr/bin/cmake -E __run_co_compile --launcher=/usr/bin/ccache --tidy="/usr/bin/clang-tidy-8;-warnings-as-errors=*" --source=../../src/test/streams_tests.cpp -- /usr/bin/clang++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBOOST_TEST_DYN_LINK -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/univalue/include -I../../src/. -Isrc -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -g -O2 -fPIE -fvisibility=hidden   -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wshadow -Wshadow-field -Wrange-loop-analysis -Wredundant-decls -Wformat-security -Wredundant-move -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++14 -MD -MT src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o -MF src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o.d -o src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o -c ../../src/test/streams_tests.cpp
/work/abc-ci-builds/build-clang-tidy/../../src/test/streams_tests.cpp:357:5: error: no matching function for call to 'SeedInsecureRand' [clang-diagnostic-error]
    SeedInsecureRand(true);
    ^
../../src/./test/util/setup_common.h:65:20: note: candidate function not viable: no known conversion from 'bool' to 'SeedRand' for 1st argument
static inline void SeedInsecureRand(SeedRand seed = SeedRand::SEED) {
                   ^
2421 warnings and 1 error generated.
Error while processing /work/abc-ci-builds/build-clang-tidy/../../src/test/streams_tests.cpp.
Suppressed 2421 warnings (2421 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
Found compiler error(s).
[105/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_p2sh_tests.cpp.o
[106/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/scriptnum_tests.cpp.o
[107/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sigencoding_tests.cpp.o
[108/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sighashtype_tests.cpp.o
[109/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sigcache_tests.cpp.o
[110/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/settings_tests.cpp.o
[111/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/skiplist_tests.cpp.o
[112/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/serialize_tests.cpp.o
[113/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sigcheckcount_tests.cpp.o
[114/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sighash_tests.cpp.o
[115/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sync_tests.cpp.o
[116/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/timedata_tests.cpp.o
[117/414] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_tests.cpp.o
ninja: build stopped: subcommand failed.
Build build-clang-tidy failed with exit code 1

Tail of the build log:

[163/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/net_tests.cpp.o
[164/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/key_tests.cpp.o
[165/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/prevector_tests.cpp.o
[166/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/pmt_tests.cpp.o
[167/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/policyestimator_tests.cpp.o
[168/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/raii_event_tests.cpp.o
[169/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/netbase_tests.cpp.o
[170/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rcu_tests.cpp.o
[171/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/mempool_tests.cpp.o
[172/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/random_tests.cpp.o
[173/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/radix_tests.cpp.o
[174/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sanity_tests.cpp.o
[175/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/scheduler_tests.cpp.o
[176/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rpc_server_tests.cpp.o
[177/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_bitfield_tests.cpp.o
[178/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rwcollection_tests.cpp.o
[179/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/schnorr_tests.cpp.o
[180/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_commitment_tests.cpp.o
[181/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/rpc_tests.cpp.o
[182/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_p2sh_tests.cpp.o
[183/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/scriptnum_tests.cpp.o
[184/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_standard_tests.cpp.o
[185/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sigencoding_tests.cpp.o
[186/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/settings_tests.cpp.o
[187/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sigcache_tests.cpp.o
[188/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sighashtype_tests.cpp.o
[189/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/skiplist_tests.cpp.o
[190/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/serialize_tests.cpp.o
[191/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o
FAILED: src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o 
/usr/bin/ccache /usr/bin/c++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBOOST_TEST_DYN_LINK -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/univalue/include -I../../src/. -Isrc -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIE -fvisibility=hidden   -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wshadow -Wredundant-decls -Wformat-security -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++14 -MD -MT src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o -MF src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o.d -o src/test/CMakeFiles/test_bitcoin.dir/streams_tests.cpp.o -c ../../src/test/streams_tests.cpp
../../src/test/streams_tests.cpp: In member function ‘void streams_tests::streams_buffered_file_rand::test_method()’:
../../src/test/streams_tests.cpp:357:26: error: cannot convert ‘bool’ to ‘SeedRand’
     SeedInsecureRand(true);
                          ^
In file included from ../../src/test/streams_tests.cpp:8:
../../src/./test/util/setup_common.h:65:46: note:   initializing argument 1 of ‘void SeedInsecureRand(SeedRand)’
 static inline void SeedInsecureRand(SeedRand seed = SeedRand::SEED) {
                                     ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
[192/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sigcheckcount_tests.cpp.o
[193/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sighash_tests.cpp.o
[194/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/sync_tests.cpp.o
[195/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/timedata_tests.cpp.o
[196/740] leveldb: testing db_test
[197/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/txindex_tests.cpp.o
[198/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/torcontrol_tests.cpp.o
[199/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/txvalidation_tests.cpp.o
[200/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/undo_tests.cpp.o
[201/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/uint256_tests.cpp.o
[202/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/txvalidationcache_tests.cpp.o
[203/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/transaction_tests.cpp.o
[204/740] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/script_tests.cpp.o
In file included from /usr/include/boost/test/unit_test.hpp:19,
                 from ../../src/test/script_tests.cpp:30:
../../src/test/script_tests.cpp: In member function ‘void script_tests::script_build::test_method()’:
../../src/test/script_tests.cpp:541:22: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without
 BOOST_AUTO_TEST_CASE(script_build) {
                      ^~~~~~~~~~~~
ninja: build stopped: subcommand failed.
Build build-diff failed with exit code 1
Fabien requested changes to this revision.Oct 23 2020, 09:41
Fabien added a subscriber: Fabien.

Please investigate the failure

This revision now requires changes to proceed.Oct 23 2020, 09:41
PiRK requested review of this revision.Oct 23 2020, 09:59
This revision is now accepted and ready to land.Oct 23 2020, 10:19