From dd2f85c084cbcf88b7b00a9299f793b90c96f2fa Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sat, 2 Mar 2019 09:46:14 -0500 Subject: [PATCH 01/27] Merge #15296: tests: Add script checking for deterministic line coverage in unit tests 43206239a8 tests: Add script checking for deterministic line coverage (practicalswift) Pull request description: Add script checking for deterministic line coverage in unit tests. Context: #14343 ("coverage reports non-deterministic") When the coverage is deterministic this script can be invoked from Travis to guard against regressions, but left inactive for now. Output in case of determinism: ``` $ contrib/test_deterministic_coverage.sh 2 [2019-01-30 20:08:46] Measuring coverage, run #1 of 2 [2019-01-30 20:10:45] Measuring coverage, run #2 of 2 Coverage test passed: Deterministic coverage across 2 runs. ``` Output in case of non-determinism: ``` $ contrib/test_deterministic_coverage.sh 2 [2019-01-30 20:08:46] Measuring coverage, run #1 of 2 [2019-01-30 20:10:45] Measuring coverage, run #2 of 2 The line coverage is non-deterministic between runs. The test suite must be deterministic in the sense that the set of lines executed at least once must be identical between runs. This is a neccessary condition for meaningful coverage measuring. --- gcovr.run-1.txt 2019-01-30 23:14:07.419418694 +0100 +++ gcovr.run-2.txt 2019-01-30 23:15:57.998811282 +0100 @@ -471,7 +471,7 @@ test/crypto_tests.cpp 270 270 100% test/cuckoocache_tests.cpp 142 142 100% test/dbwrapper_tests.cpp 148 148 100% -test/denialofservice_tests.cpp 225 225 100% +test/denialofservice_tests.cpp 225 224 99% 363 test/descriptor_tests.cpp 116 116 100% test/fs_tests.cpp 24 3 12% 14,16-17,19-20,23,25-26,29,31-32,35-36,39,41-42,45-46,49,51-52 test/getarg_tests.cpp 111 111 100% @@ -585,5 +585,5 @@ zmq/zmqpublishnotifier.h 5 0 0% 12,31,37,43,49 zmq/zmqrpc.cpp 21 0 0% 16,18,20,22,33-35,38-45,49,52,56,60,62-63 ------------------------------------------------------------------------------ -TOTAL 61561 27606 44% +TOTAL 61561 27605 44% ------------------------------------------------------------------------------ ``` In this case line 363 of `test/denialofservice_tests.cpp` was executed only in the second run. Non-determinism detected! Tree-SHA512: 03f45590e70a87146f89aa7838beeff0925d7fd303697ff03e0e69f8a5861694be5f0dd10cb0020e3e3d40c9cf662f71dfcd838f6affb31bd5212314e0a4e3a9 --- .../devtools/test_deterministic_coverage.sh | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100755 contrib/devtools/test_deterministic_coverage.sh diff --git a/contrib/devtools/test_deterministic_coverage.sh b/contrib/devtools/test_deterministic_coverage.sh new file mode 100755 index 0000000000..7c8edf2cba --- /dev/null +++ b/contrib/devtools/test_deterministic_coverage.sh @@ -0,0 +1,152 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2019 The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. +# +# Test for deterministic coverage across unit test runs. + +export LC_ALL=C + +# Use GCOV_EXECUTABLE="gcov" if compiling with gcc. +# Use GCOV_EXECUTABLE="llvm-cov gcov" if compiling with clang. +GCOV_EXECUTABLE="gcov" + +# TODO this list is likely incomplete / incorrect for Dash +# Disable tests known to cause non-deterministic behaviour and document the source or point of non-determinism. +NON_DETERMINISTIC_TESTS=( + "coinselector_tests/knapsack_solver_test" # coinselector_tests.cpp: if (equal_sets(setCoinsRet, setCoinsRet2)) + "denialofservice_tests/DoS_mapOrphans" # denialofservice_tests.cpp: it = mapOrphanTransactions.lower_bound(InsecureRand256()); + "fs_tests/fsbridge_fstream" # deterministic test failure? + "miner_tests/CreateNewBlock_validity" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10) + "scheduler_tests/manythreads" # scheduler.cpp: CScheduler::serviceQueue() + "scheduler_tests/singlethreadedscheduler_ordered" # scheduler.cpp: CScheduler::serviceQueue() + "tx_validationcache_tests/checkinputs_test" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10) + "tx_validationcache_tests/tx_mempool_block_doublespend" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10) + "txindex_tests/txindex_initial_sync" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10) + "txvalidation_tests/tx_mempool_reject_coinbase" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10) + "validation_block_tests/processnewblock_signals_ordering" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10) + "wallet_tests/coin_mark_dirty_immature_credit" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10) + "wallet_tests/dummy_input_size_test" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10) + "wallet_tests/importmulti_rescan" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10) + "wallet_tests/importwallet_rescan" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10) + "wallet_tests/ListCoins" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10) + "wallet_tests/scan_for_wallet_transactions" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10) + "wallet_tests/wallet_disableprivkeys" # validation.cpp: if (GetMainSignals().CallbacksPending() > 10) +) + +TEST_BITCOIN_BINARY="src/test/test_dash" + +print_usage() { + echo "Usage: $0 [custom test filter (default: all but known non-deterministic tests)] [number of test runs (default: 2)]" +} + +N_TEST_RUNS=2 +BOOST_TEST_RUN_FILTERS="" +if [[ $# != 0 ]]; then + if [[ $1 == "--help" ]]; then + print_usage + exit + fi + PARSED_ARGUMENTS=0 + if [[ $1 =~ [a-z] ]]; then + BOOST_TEST_RUN_FILTERS=$1 + PARSED_ARGUMENTS=$((PARSED_ARGUMENTS + 1)) + shift + fi + if [[ $1 =~ ^[0-9]+$ ]]; then + N_TEST_RUNS=$1 + PARSED_ARGUMENTS=$((PARSED_ARGUMENTS + 1)) + shift + fi + if [[ ${PARSED_ARGUMENTS} == 0 || $# -gt 2 || ${N_TEST_RUNS} -lt 2 ]]; then + print_usage + exit + fi +fi +if [[ ${BOOST_TEST_RUN_FILTERS} == "" ]]; then + BOOST_TEST_RUN_FILTERS="$(IFS=":"; echo "!${NON_DETERMINISTIC_TESTS[*]}" | sed 's/:/:!/g')" +else + echo "Using Boost test filter: ${BOOST_TEST_RUN_FILTERS}" + echo +fi + +if ! command -v gcov > /dev/null; then + echo "Error: gcov not installed. Exiting." + exit 1 +fi + +if ! command -v gcovr > /dev/null; then + echo "Error: gcovr not installed. Exiting." + exit 1 +fi + +if [[ ! -e ${TEST_BITCOIN_BINARY} ]]; then + echo "Error: Executable ${TEST_BITCOIN_BINARY} not found. Run \"./configure --enable-lcov\" and compile." + exit 1 +fi + +get_file_suffix_count() { + find src/ -type f -name "*.$1" | wc -l +} + +if [[ $(get_file_suffix_count gcno) == 0 ]]; then + echo "Error: Could not find any *.gcno files. The *.gcno files are generated by the compiler. Run \"./configure --enable-lcov\" and re-compile." + exit 1 +fi + +get_covr_filename() { + echo "gcovr.run-$1.txt" +} + +TEST_RUN_ID=0 +while [[ ${TEST_RUN_ID} -lt ${N_TEST_RUNS} ]]; do + TEST_RUN_ID=$((TEST_RUN_ID + 1)) + echo "[$(date +"%Y-%m-%d %H:%M:%S")] Measuring coverage, run #${TEST_RUN_ID} of ${N_TEST_RUNS}" + find src/ -type f -name "*.gcda" -exec rm {} \; + if [[ $(get_file_suffix_count gcda) != 0 ]]; then + echo "Error: Stale *.gcda files found. Exiting." + exit 1 + fi + TEST_OUTPUT_TEMPFILE=$(mktemp) + if ! BOOST_TEST_RUN_FILTERS="${BOOST_TEST_RUN_FILTERS}" ${TEST_BITCOIN_BINARY} > "${TEST_OUTPUT_TEMPFILE}" 2>&1; then + cat "${TEST_OUTPUT_TEMPFILE}" + rm "${TEST_OUTPUT_TEMPFILE}" + exit 1 + fi + rm "${TEST_OUTPUT_TEMPFILE}" + if [[ $(get_file_suffix_count gcda) == 0 ]]; then + echo "Error: Running the test suite did not create any *.gcda files. The gcda files are generated when the instrumented test programs are executed. Run \"./configure --enable-lcov\" and re-compile." + exit 1 + fi + GCOVR_TEMPFILE=$(mktemp) + if ! gcovr --gcov-executable "${GCOV_EXECUTABLE}" -r src/ > "${GCOVR_TEMPFILE}"; then + echo "Error: gcovr failed. Output written to ${GCOVR_TEMPFILE}. Exiting." + exit 1 + fi + GCOVR_FILENAME=$(get_covr_filename ${TEST_RUN_ID}) + mv "${GCOVR_TEMPFILE}" "${GCOVR_FILENAME}" + if grep -E "^TOTAL *0 *0 " "${GCOVR_FILENAME}"; then + echo "Error: Spurious gcovr output. Make sure the correct GCOV_EXECUTABLE variable is set in $0 (\"gcov\" for gcc, \"llvm-cov gcov\" for clang)." + exit 1 + fi + if [[ ${TEST_RUN_ID} != 1 ]]; then + COVERAGE_DIFF=$(diff -u "$(get_covr_filename 1)" "${GCOVR_FILENAME}") + if [[ ${COVERAGE_DIFF} != "" ]]; then + echo + echo "The line coverage is non-deterministic between runs. Exiting." + echo + echo "The test suite must be deterministic in the sense that the set of lines executed at least" + echo "once must be identical between runs. This is a necessary condition for meaningful" + echo "coverage measuring." + echo + echo "${COVERAGE_DIFF}" + exit 1 + fi + rm "${GCOVR_FILENAME}" + fi +done + +echo +echo "Coverage test passed: Deterministic coverage across ${N_TEST_RUNS} runs." +exit From 1c374ebf5b4c994b81d11daca4f62b1ce65d654e Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sat, 2 Mar 2019 09:55:05 -0500 Subject: [PATCH 02/27] Merge #15338: ci: Build and run tests once on freebsd fa1d400003 cirrus ci: Inital config (MarcoFalke) Pull request description: Could be activated through https://github.com/marketplace/cirrus-ci Tree-SHA512: 3a25ad2a58249463e97a3b31122581d5d382fa1d9c830f36c72ca6211b0822950e56ea754a6bddc8f79af21d1fe3469caee9efe0e90411a9c6a59cb98c09f845 --- .cirrus.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .cirrus.yml diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 0000000000..9104a0a3d1 --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,26 @@ +task: + name: "FreeBsd 12.0 amd64 [GOAL: install] [no depends, only system libs]" + freebsd_instance: + image: freebsd-12-0-release-amd64 + ccache_cache: + folder: "/tmp/ccache_dir" + env: + MAKEJOBS: "-j3" + CONFIGURE_OPTS: "--disable-dependency-tracking" + GOAL: "install" + CCACHE_SIZE: "200M" + CCACHE_COMPRESS: 1 + CCACHE_DIR: "/tmp/ccache_dir" + install_script: + - pkg install -y autoconf automake boost-libs git gmake libevent libtool openssl pkgconf python3 ccache + - ./contrib/install_db4.sh $(pwd) + - ccache --max-size=${CCACHE_SIZE} + configure_script: + - ./autogen.sh + - ./configure ${CONFIGURE_OPTS} BDB_LIBS="-L$(pwd)/db4/lib -ldb_cxx-4.8" BDB_CFLAGS="-I$(pwd)/db4/include" || ( cat config.log && false) + make_script: + - gmake ${MAKEJOBS} ${GOAL} || ( echo "Build failure. Verbose build follows." && gmake ${GOAL} V=1 ; false ) + check_script: + - gmake check ${MAKEJOBS} VERBOSE=1 + functional_test_script: + - ./test/functional/test_runner.py --ci --combinedlogslen=1000 --quiet --failfast From f2d65948d3d8664d69d1b6013a253ea40d1f5bf7 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 4 Mar 2019 13:39:00 -0500 Subject: [PATCH 03/27] Merge #15479: test: Add .style.yapf fa45123f66 test: Add .style.yapf (MarcoFalke) Pull request description: This can *optionally* be used to format any added code before submitting a pull. I use this heavily and wouldn't want to hold it back from others, now that yapf is referred to in https://github.com/bitcoin/bitcoin/blob/master/doc/productivity.md#format-python-diffs-with-yapf-diffpy Tree-SHA512: 0f3d8bcbb76a710d9faa1226202073e8d967a82a05fc002cd10305ff58b382f5ff3df96a6faaec5bd01613d41f5fc2343e4999fb1217bf1f24f6da186d572ca1 --- .style.yapf | 261 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 261 insertions(+) create mode 100644 .style.yapf diff --git a/.style.yapf b/.style.yapf new file mode 100644 index 0000000000..fe6227baf6 --- /dev/null +++ b/.style.yapf @@ -0,0 +1,261 @@ +[style] +# Align closing bracket with visual indentation. +align_closing_bracket_with_visual_indent=True + +# Allow dictionary keys to exist on multiple lines. For example: +# +# x = { +# ('this is the first element of a tuple', +# 'this is the second element of a tuple'): +# value, +# } +allow_multiline_dictionary_keys=False + +# Allow lambdas to be formatted on more than one line. +allow_multiline_lambdas=False + +# Allow splits before the dictionary value. +allow_split_before_dict_value=True + +# Number of blank lines surrounding top-level function and class +# definitions. +blank_lines_around_top_level_definition=2 + +# Insert a blank line before a class-level docstring. +blank_line_before_class_docstring=False + +# Insert a blank line before a module docstring. +blank_line_before_module_docstring=False + +# Insert a blank line before a 'def' or 'class' immediately nested +# within another 'def' or 'class'. For example: +# +# class Foo: +# # <------ this blank line +# def method(): +# ... +blank_line_before_nested_class_or_def=False + +# Do not split consecutive brackets. Only relevant when +# dedent_closing_brackets is set. For example: +# +# call_func_that_takes_a_dict( +# { +# 'key1': 'value1', +# 'key2': 'value2', +# } +# ) +# +# would reformat to: +# +# call_func_that_takes_a_dict({ +# 'key1': 'value1', +# 'key2': 'value2', +# }) +coalesce_brackets=False + +# The column limit. +column_limit=79 + +# The style for continuation alignment. Possible values are: +# +# - SPACE: Use spaces for continuation alignment. This is default behavior. +# - FIXED: Use fixed number (CONTINUATION_INDENT_WIDTH) of columns +# (ie: CONTINUATION_INDENT_WIDTH/INDENT_WIDTH tabs) for continuation +# alignment. +# - LESS: Slightly left if cannot vertically align continuation lines with +# indent characters. +# - VALIGN-RIGHT: Vertically align continuation lines with indent +# characters. Slightly right (one more indent character) if cannot +# vertically align continuation lines with indent characters. +# +# For options FIXED, and VALIGN-RIGHT are only available when USE_TABS is +# enabled. +continuation_align_style=SPACE + +# Indent width used for line continuations. +continuation_indent_width=4 + +# Put closing brackets on a separate line, dedented, if the bracketed +# expression can't fit in a single line. Applies to all kinds of brackets, +# including function definitions and calls. For example: +# +# config = { +# 'key1': 'value1', +# 'key2': 'value2', +# } # <--- this bracket is dedented and on a separate line +# +# time_series = self.remote_client.query_entity_counters( +# entity='dev3246.region1', +# key='dns.query_latency_tcp', +# transform=Transformation.AVERAGE(window=timedelta(seconds=60)), +# start_ts=now()-timedelta(days=3), +# end_ts=now(), +# ) # <--- this bracket is dedented and on a separate line +dedent_closing_brackets=False + +# Disable the heuristic which places each list element on a separate line +# if the list is comma-terminated. +disable_ending_comma_heuristic=False + +# Place each dictionary entry onto its own line. +each_dict_entry_on_separate_line=True + +# The regex for an i18n comment. The presence of this comment stops +# reformatting of that line, because the comments are required to be +# next to the string they translate. +i18n_comment= + +# The i18n function call names. The presence of this function stops +# reformattting on that line, because the string it has cannot be moved +# away from the i18n comment. +i18n_function_call= + +# Indent the dictionary value if it cannot fit on the same line as the +# dictionary key. For example: +# +# config = { +# 'key1': +# 'value1', +# 'key2': value1 + +# value2, +# } +indent_dictionary_value=False + +# The number of columns to use for indentation. +indent_width=4 + +# Join short lines into one line. E.g., single line 'if' statements. +join_multiple_lines=True + +# Do not include spaces around selected binary operators. For example: +# +# 1 + 2 * 3 - 4 / 5 +# +# will be formatted as follows when configured with "*,/": +# +# 1 + 2*3 - 4/5 +# +no_spaces_around_selected_binary_operators= + +# Use spaces around default or named assigns. +spaces_around_default_or_named_assign=False + +# Use spaces around the power operator. +spaces_around_power_operator=False + +# The number of spaces required before a trailing comment. +spaces_before_comment=2 + +# Insert a space between the ending comma and closing bracket of a list, +# etc. +space_between_ending_comma_and_closing_bracket=True + +# Split before arguments +split_all_comma_separated_values=False + +# Split before arguments if the argument list is terminated by a +# comma. +split_arguments_when_comma_terminated=False + +# Set to True to prefer splitting before '&', '|' or '^' rather than +# after. +split_before_bitwise_operator=True + +# Split before the closing bracket if a list or dict literal doesn't fit on +# a single line. +split_before_closing_bracket=True + +# Split before a dictionary or set generator (comp_for). For example, note +# the split before the 'for': +# +# foo = { +# variable: 'Hello world, have a nice day!' +# for variable in bar if variable != 42 +# } +split_before_dict_set_generator=True + +# Split before the '.' if we need to split a longer expression: +# +# foo = ('This is a really long string: {}, {}, {}, {}'.format(a, b, c, d)) +# +# would reformat to something like: +# +# foo = ('This is a really long string: {}, {}, {}, {}' +# .format(a, b, c, d)) +split_before_dot=False + +# Split after the opening paren which surrounds an expression if it doesn't +# fit on a single line. +split_before_expression_after_opening_paren=False + +# If an argument / parameter list is going to be split, then split before +# the first argument. +split_before_first_argument=False + +# Set to True to prefer splitting before 'and' or 'or' rather than +# after. +split_before_logical_operator=True + +# Split named assignments onto individual lines. +split_before_named_assigns=True + +# Set to True to split list comprehensions and generators that have +# non-trivial expressions and multiple clauses before each of these +# clauses. For example: +# +# result = [ +# a_long_var + 100 for a_long_var in xrange(1000) +# if a_long_var % 10] +# +# would reformat to something like: +# +# result = [ +# a_long_var + 100 +# for a_long_var in xrange(1000) +# if a_long_var % 10] +split_complex_comprehension=False + +# The penalty for splitting right after the opening bracket. +split_penalty_after_opening_bracket=30 + +# The penalty for splitting the line after a unary operator. +split_penalty_after_unary_operator=10000 + +# The penalty for splitting right before an if expression. +split_penalty_before_if_expr=0 + +# The penalty of splitting the line around the '&', '|', and '^' +# operators. +split_penalty_bitwise_operator=300 + +# The penalty for splitting a list comprehension or generator +# expression. +split_penalty_comprehension=80 + +# The penalty for characters over the column limit. +split_penalty_excess_character=7000 + +# The penalty incurred by adding a line split to the unwrapped line. The +# more line splits added the higher the penalty. +split_penalty_for_added_line_split=30 + +# The penalty of splitting a list of "import as" names. For example: +# +# from a_very_long_or_indented_module_name_yada_yad import (long_argument_1, +# long_argument_2, +# long_argument_3) +# +# would reformat to something like: +# +# from a_very_long_or_indented_module_name_yada_yad import ( +# long_argument_1, long_argument_2, long_argument_3) +split_penalty_import_names=0 + +# The penalty of splitting the line around the 'and' and 'or' +# operators. +split_penalty_logical_operator=300 + +# Use the Tab character for indentation. +use_tabs=False + From a33756c72efdb8353950525c1f5461db881b2423 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 9 Mar 2019 06:45:09 +0100 Subject: [PATCH 04/27] Merge #15549: gitian: Improve error handling 32da92bdf6bb55d6d312b0f85797d439cc942db5 gitian: Improve error handling (Wladimir J. van der Laan) Pull request description: Improve error handling in gitian builds: - Set fail-on-error and pipefail flag, this causes a command to fail when either of the pipe stages fails, not only when the last of the stages fails, so this improves error detection. - Also use `xargs` instead of `find -exec`, because `find` will not propagate errors in the executed command, but `xargs` will. This will avoid some issues like #15541 where non-determinism is silently introduced due to errors caused by environment conditions (such as lack of disk space in that case). Tree-SHA512: d5d3f22ce2d04a75e5c25e935744327c3adc704c2d303133f2918113573a564dff3d3243d5569a2b93ee7eb0e97f8e1b1ba81767e966af9015ea711a14091035 --- contrib/devtools/split-debug.sh.in | 2 +- contrib/gitian-descriptors/gitian-linux.yml | 5 +++-- contrib/gitian-descriptors/gitian-osx-signer.yml | 2 ++ contrib/gitian-descriptors/gitian-osx.yml | 2 ++ contrib/gitian-descriptors/gitian-win-signer.yml | 2 ++ contrib/gitian-descriptors/gitian-win.yml | 2 ++ 6 files changed, 12 insertions(+), 3 deletions(-) diff --git a/contrib/devtools/split-debug.sh.in b/contrib/devtools/split-debug.sh.in index deda49cc54..92b72b1446 100644 --- a/contrib/devtools/split-debug.sh.in +++ b/contrib/devtools/split-debug.sh.in @@ -1,5 +1,5 @@ #!/bin/sh - +set -e if [ $# -ne 3 ]; then echo "usage: $0 " fi diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index d19bf393d2..ff68f0deb4 100755 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -35,6 +35,7 @@ remotes: "dir": "dash" files: [] script: | + set -e -o pipefail WRAP_DIR=$HOME/wrapped HOSTS="i686-pc-linux-gnu x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu" @@ -201,8 +202,8 @@ script: | find . -name "lib*.la" -delete find . -name "lib*.a" -delete rm -rf ${DISTNAME}/lib/pkgconfig - find ${DISTNAME}/bin -type f -executable -exec ../contrib/devtools/split-debug.sh {} {} {}.dbg \; - find ${DISTNAME}/lib -type f -exec ../contrib/devtools/split-debug.sh {} {} {}.dbg \; + find ${DISTNAME}/bin -type f -executable -print0 | xargs -0 -n1 -I{} ../contrib/devtools/split-debug.sh {} {} {}.dbg + find ${DISTNAME}/lib -type f -print0 | xargs -0 -n1 -I{} ../contrib/devtools/split-debug.sh {} {} {}.dbg cp ../doc/README.md ${DISTNAME}/ find ${DISTNAME} -not -name "*.dbg" | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}.tar.gz find ${DISTNAME} -name "*.dbg" | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}-debug.tar.gz diff --git a/contrib/gitian-descriptors/gitian-osx-signer.yml b/contrib/gitian-descriptors/gitian-osx-signer.yml index 43467434ec..e466995510 100644 --- a/contrib/gitian-descriptors/gitian-osx-signer.yml +++ b/contrib/gitian-descriptors/gitian-osx-signer.yml @@ -12,6 +12,8 @@ remotes: files: - "dashcore-osx-unsigned.tar.gz" script: | + set -e -o pipefail + WRAP_DIR=$HOME/wrapped mkdir -p ${WRAP_DIR} export PATH=`pwd`:$PATH diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml index c941dc8fc6..c02c25e35d 100644 --- a/contrib/gitian-descriptors/gitian-osx.yml +++ b/contrib/gitian-descriptors/gitian-osx.yml @@ -35,6 +35,8 @@ remotes: files: - "MacOSX10.11.sdk.tar.gz" script: | + set -e -o pipefail + WRAP_DIR=$HOME/wrapped HOSTS="x86_64-apple-darwin14" CONFIGFLAGS="--enable-reduce-exports --disable-miner --disable-bench --disable-gui-tests GENISOIMAGE=$WRAP_DIR/genisoimage --enable-crash-hooks" diff --git a/contrib/gitian-descriptors/gitian-win-signer.yml b/contrib/gitian-descriptors/gitian-win-signer.yml index e3afda64b8..fd08214aa7 100644 --- a/contrib/gitian-descriptors/gitian-win-signer.yml +++ b/contrib/gitian-descriptors/gitian-win-signer.yml @@ -17,6 +17,8 @@ files: - "osslsigncode-2.0.tar.gz" - "dashcore-win-unsigned.tar.gz" script: | + set -e -o pipefail + BUILD_DIR=`pwd` SIGDIR=${BUILD_DIR}/signature/win UNSIGNED_DIR=${BUILD_DIR}/unsigned diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index 98da27709a..1c33ce9615 100755 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -29,6 +29,8 @@ remotes: "dir": "dash" files: [] script: | + set -e -o pipefail + WRAP_DIR=$HOME/wrapped HOSTS="i686-w64-mingw32 x86_64-w64-mingw32" CONFIGFLAGS="--enable-reduce-exports --disable-miner --disable-bench --disable-gui-tests --enable-crash-hooks" From 55880fbe08df03774b9e44eec7471acfe81e546f Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 12 Mar 2019 10:40:34 +0100 Subject: [PATCH 05/27] Merge #15548: build: use full version string in setup.exe fa55104cb8e73c709e90fc5f81c9cb6a8a0713a6 build: use full version string in setup.exe (MarcoFalke) Pull request description: Fixes: #15546 Tree-SHA512: a8ccbfef6b9fdd10bd0facadb25019b9296579eee6c8f7b4e5298cc4df52bba61864135ab8f46b900f7a3888fbcc921e039412d5a8127e44d8f2dd2c8fc56f86 --- share/setup.nsi.in | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/share/setup.nsi.in b/share/setup.nsi.in index a656e006fa..ca7388f74b 100644 --- a/share/setup.nsi.in +++ b/share/setup.nsi.in @@ -5,7 +5,6 @@ SetCompressor /SOLID lzma # General Symbol Definitions !define REGKEY "SOFTWARE\$(^Name)" -!define VERSION @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@ !define COMPANY "@PACKAGE_NAME@ project" !define URL @PACKAGE_URL@ @@ -49,7 +48,7 @@ Var StartMenuGroup !insertmacro MUI_LANGUAGE English # Installer attributes -OutFile @abs_top_srcdir@/@PACKAGE_TARNAME@-${VERSION}-win@WINDOWS_BITS@-setup.exe +OutFile @abs_top_srcdir@/@PACKAGE_TARNAME@-@PACKAGE_VERSION@-win@WINDOWS_BITS@-setup.exe !if "@WINDOWS_BITS@" == "64" InstallDir $PROGRAMFILES64\DashCore !else @@ -59,12 +58,12 @@ CRCCheck on XPStyle on BrandingText " " ShowInstDetails show -VIProductVersion ${VERSION}.@CLIENT_VERSION_BUILD@ +VIProductVersion @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@.@CLIENT_VERSION_BUILD@ VIAddVersionKey ProductName "@PACKAGE_NAME@" -VIAddVersionKey ProductVersion "${VERSION}" +VIAddVersionKey ProductVersion "@PACKAGE_VERSION@" VIAddVersionKey CompanyName "${COMPANY}" VIAddVersionKey CompanyWebsite "${URL}" -VIAddVersionKey FileVersion "${VERSION}" +VIAddVersionKey FileVersion "@PACKAGE_VERSION@" VIAddVersionKey FileDescription "" VIAddVersionKey LegalCopyright "" InstallDirRegKey HKCU "${REGKEY}" Path @@ -97,7 +96,7 @@ Section -post SEC0001 CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe !insertmacro MUI_STARTMENU_WRITE_END WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)" - WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "@PACKAGE_VERSION@" WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}" WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}" WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe From 206c1ed9bac26001fa0eb41597f2ba11c9f6f228 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Thu, 14 Mar 2019 17:02:24 -0400 Subject: [PATCH 06/27] Merge #15444: [docs] Additional productivity tips ff7f31e07d [doc] productivity: more advanced git range-diff (Sjors Provoost) 3a21905a4e [doc] devtools: mention clang-format dependency (Sjors Provoost) bf12093191 [doc] productivity: fix broken link (Sjors Provoost) Pull request description: Fixes a broken link to `devtools/README.md`, points out the `clang-format` dependency and adds a `git range-diff` incantation that works even with rebases and squashes. Tree-SHA512: 36e46282f1e28d1bf3f48ada995fbac548f61b7747091eb032b60919cf76c7bdad0fa8aecb0c47adbdaa9ef986d3ec7752b0bb94c63191401856e2ddeec48f3e --- contrib/devtools/README.md | 2 ++ doc/productivity.md | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/contrib/devtools/README.md b/contrib/devtools/README.md index 41bdd33e74..39e14c4452 100644 --- a/contrib/devtools/README.md +++ b/contrib/devtools/README.md @@ -7,6 +7,8 @@ clang-format-diff.py A script to format unified git diffs according to [.clang-format](../../src/.clang-format). +Requires `clang-format`, installed e.g. via `brew install clang-format` on macOS. + For instance, to format the last commit with 0 lines of context, the script should be called from the git root folder as follows. diff --git a/doc/productivity.md b/doc/productivity.md index 862017290d..e0df558944 100644 --- a/doc/productivity.md +++ b/doc/productivity.md @@ -76,7 +76,7 @@ Writing code ### Format C/C++/Protobuf diffs with `clang-format-diff.py` -See [contrib/devtools/README.md](contrib/devtools/README.md#clang-format-diff.py). +See [contrib/devtools/README.md](/contrib/devtools/README.md#clang-format-diff.py). ### Format Python diffs with `yapf-diff.py` @@ -136,7 +136,7 @@ This will add an `upstream-pull` remote to your git repository, which can be fet ### Diff the diffs with `git range-diff` -It is very common for contributors to rebase their pull requests, or make changes to commits (perhaps in response to review) that are not at the head of their branch. This poses a problem for reviewers as when the contributor force pushes, the reviewer is no longer sure that his previous reviews of commits are still valid (as the commit hashes can now be different even though the diff is semantically the same). `git range-diff` can help solve this problem by diffing the diffs. +It is very common for contributors to rebase their pull requests, or make changes to commits (perhaps in response to review) that are not at the head of their branch. This poses a problem for reviewers as when the contributor force pushes, the reviewer is no longer sure that his previous reviews of commits are still valid (as the commit hashes can now be different even though the diff is semantically the same). [git range-diff](https://git-scm.com/docs/git-range-diff) (Git >= 2.19) can help solve this problem by diffing the diffs. For example, to identify the differences between your previously reviewed diffs P1-5, and the new diffs P1-2,N3-4 as illustrated below: ``` @@ -152,7 +152,19 @@ You can do: git range-diff master previously-reviewed-head new-head ``` -Note that `git range-diff` also work for rebases. +Note that `git range-diff` also work for rebases: + +``` + P1--P2--P3--P4--P5 <-- previously-reviewed-head + / +...--m--m1--m2--m3 <-- master + \ + P1--P2--N3--N4 <-- new-head (with P3 modified, P4 & P5 squashed) + +PREV=P5 N=4 && git range-diff `git merge-base --all HEAD $PREV`...$PREV HEAD~$N...HEAD +``` + +Where `P5` is the commit you last reviewed and `4` is the number of commits in the new version. ----- From a4b2ac0c597aca68eee8893044e31da0e3be1b50 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Fri, 15 Mar 2019 13:57:12 +0100 Subject: [PATCH 07/27] Merge #15577: Docs: Enable TLS in link to chris.beams.io 228e80608 Enable TLS in link to chris.beams.io (JeremyRand) Pull request description: This PR enables TLS in a documentation link to chris.beams.io, which improves security. This change was originally part of https://github.com/bitcoin/bitcoin/pull/13778 , which was closed for reasons unrelated to this change. Tree-SHA512: 01f02031b39ebdaa7fc1859befde7e3bfff105892a8b9e1737ff94741599c6c5936eff53871e5e3560931512c9b7a4ea34f48d8555b583d232c90c2ca6d4d776 --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3d7ac2aee0..fcb36e2c6d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,7 +43,7 @@ Commit messages should be verbose by default consisting of a short subject line paragraph(s), unless the title alone is self-explanatory (like "Corrected typo in init.cpp") in which case a single title line is sufficient. Commit messages should be helpful to people reading your code in the future, so explain the reasoning for -your decisions. Further explanation [here](http://chris.beams.io/posts/git-commit/). +your decisions. Further explanation [here](https://chris.beams.io/posts/git-commit/). If a particular commit references another issue, please add the reference. For example: `refs #1234` or `fixes #4321`. Using the `fixes` or `closes` keywords From f334f63d3dbf2b134058100c2787a22bc8236f0f Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 15 Mar 2019 09:48:21 -0400 Subject: [PATCH 08/27] Merge #15580: depends: native_protobuf: avoid system zlib 19a0c4af0f depends: native_protobuf: avoid system zlib (Carl Dong) Pull request description: I don't believe we use any zlib features in protobufs Tree-SHA512: cd09229f3fac215f58e9ddd4871f190cf2a301e25939aaa1c6ee130d1ba5bbb00d9ebe9ca012a2894bac4c2db923259f34fe43e255ad55ccd2b11ec88afc2a8f --- depends/packages/native_protobuf.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/packages/native_protobuf.mk b/depends/packages/native_protobuf.mk index ce50b366fa..1de8c37d36 100644 --- a/depends/packages/native_protobuf.mk +++ b/depends/packages/native_protobuf.mk @@ -5,7 +5,7 @@ $(package)_file_name=protobuf-$($(package)_version).tar.bz2 $(package)_sha256_hash=ee445612d544d885ae240ffbcbf9267faa9f593b7b101f21d58beceb92661910 define $(package)_set_vars -$(package)_config_opts=--disable-shared +$(package)_config_opts=--disable-shared --without-zlib endef define $(package)_config_cmds From 9c3401a91de62033f6599c0aa1297157e41ea28e Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 16 Mar 2019 17:07:14 +0100 Subject: [PATCH 09/27] Merge #15522: Document sizeof(size_t) assumptions and compiler assumptions in assumptions.h c7a7250302b60b78af39f39ee403d330c0cb7aa0 Document assumptions about C++ compiler (practicalswift) c7ea8d3236e7c1b0c198345cc78a6754338d3724 Add sizeof(size_t) assumptions (practicalswift) Pull request description: Document `sizeof(size_t)` assumptions and compiler assumptions by adding compile-time checks in `assumptions.h`. Tree-SHA512: db46481eecad6a87718ae637a7761d39d32cfe6f95fc8ad2b3a52a3d966c2a05c8f540dd3f362721279816571b04b6cce2de9b3b1d17606d7b197126cd4a8d1f --- src/compat/assumptions.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/compat/assumptions.h b/src/compat/assumptions.h index a3d81fe127..bfdf318b16 100644 --- a/src/compat/assumptions.h +++ b/src/compat/assumptions.h @@ -17,6 +17,17 @@ # error "Dash Core cannot be compiled without assertions." #endif +// Assumption: We assume a C++11 (ISO/IEC 14882:2011) compiler (minimum requirement). +// Example(s): We assume the presence of C++11 features everywhere :-) +// Note: MSVC does not report the expected __cplusplus value due to legacy +// reasons. +#if !defined(_MSC_VER) +// ISO Standard C++11 [cpp.predefined]p1: +// "The name __cplusplus is defined to the value 201103L when compiling a C++ +// translation unit." +static_assert(__cplusplus >= 201103L, "C++11 standard assumed"); +#endif + // Assumption: We assume the floating-point types to fulfill the requirements of // IEC 559 (IEEE 754) standard. // Example(s): Floating-point division by zero in ConnectBlock, CreateTransaction @@ -40,8 +51,13 @@ static_assert(sizeof(double) == 8, "64-bit double assumed"); static_assert(sizeof(short) == 2, "16-bit short assumed"); static_assert(sizeof(int) == 4, "32-bit int assumed"); +// Assumption: We assume size_t to be 32-bit or 64-bit. +// Example(s): size_t assumed to be at least 32-bit in ecdsa_signature_parse_der_lax(...). +// size_t assumed to be 32-bit or 64-bit in MallocUsage(...). +static_assert(sizeof(size_t) == 4 || sizeof(size_t) == 8, "size_t assumed to be 32-bit or 64-bit"); +static_assert(sizeof(size_t) == sizeof(void*), "Sizes of size_t and void* assumed to be equal"); + // Some important things we are NOT assuming (non-exhaustive list): -// * We are NOT assuming a specific value for sizeof(std::size_t). // * We are NOT assuming a specific value for std::endian::native. // * We are NOT assuming a specific value for std::locale("").name(). // * We are NOT assuming a specific value for std::numeric_limits::is_signed. From 4a543ac7ea5255491b842d420878d492eac12ff9 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 18 Mar 2019 11:31:05 -0400 Subject: [PATCH 10/27] Merge #15581: depends: Make less assumptions about build env f7696e6183 depends: qt: Don't hardcode pwd path (Carl Dong) 89bee1bdbf depends: tar: Always extract as yourself (Carl Dong) 340ef50772 depends: Defer to Python detected by autoconf (Carl Dong) Pull request description: Removes some implicit assumptions that the depends system has about its environment and, as a side-effect, makes it possible to build the depends tree under severely privilege-limited environments such as containers built by Guix. Tree-SHA512: e8618f9310a0deae864b44f9b60baa29e6225ba16817973ff7830b55798ebd4343aa06da6c1f92682a7afb709d26f80d6ee794a139d4d44c27caf4f0c8fe95fc --- depends/funcs.mk | 5 +++-- depends/packages/native_cctools.mk | 4 ++-- depends/packages/qt.mk | 8 ++++---- src/Makefile.am | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/depends/funcs.mk b/depends/funcs.mk index 5c05a4e7c2..03934db0d5 100644 --- a/depends/funcs.mk +++ b/depends/funcs.mk @@ -78,8 +78,9 @@ $(1)_download_path_fixed=$(subst :,\:,$$($(1)_download_path)) #default commands +# The default behavior for tar will try to set ownership when running as uid 0 and may not succeed, --no-same-owner disables this behavior $(1)_fetch_cmds ?= $(call fetch_file,$(1),$(subst \:,:,$$($(1)_download_path_fixed)),$$($(1)_download_file),$($(1)_file_name),$($(1)_sha256_hash)) -$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && tar --strip-components=1 -xf $$($(1)_source) +$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && tar --no-same-owner --strip-components=1 -xf $$($(1)_source) $(1)_preprocess_cmds ?= $(1)_build_cmds ?= $(1)_config_cmds ?= @@ -180,7 +181,7 @@ $($(1)_preprocessed): | $($(1)_dependencies) $($(1)_extracted) $(AT)touch $$@ $($(1)_configured): | $($(1)_preprocessed) $(AT)echo Configuring $(1)... - $(AT)rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar xf $($(package)_cached); ) + $(AT)rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar --no-same-owner -xf $($(package)_cached); ) $(AT)mkdir -p $$(@D) $(AT)+cd $$(@D); $($(1)_config_env) $(call $(1)_config_cmds, $(1)) $(AT)touch $$@ diff --git a/depends/packages/native_cctools.mk b/depends/packages/native_cctools.mk index 44d238cc4c..ccd72a99bd 100644 --- a/depends/packages/native_cctools.mk +++ b/depends/packages/native_cctools.mk @@ -22,12 +22,12 @@ define $(package)_extract_cmds echo "$($(package)_clang_sha256_hash) $($(package)_source_dir)/$($(package)_clang_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \ mkdir -p toolchain/bin toolchain/lib/clang/3.5/include && \ - tar --strip-components=1 -C toolchain -xf $($(package)_source_dir)/$($(package)_clang_file_name) && \ + tar --no-same-owner --strip-components=1 -C toolchain -xf $($(package)_source_dir)/$($(package)_clang_file_name) && \ rm -f toolchain/lib/libc++abi.so* && \ echo "#!/bin/sh" > toolchain/bin/$(host)-dsymutil && \ echo "exit 0" >> toolchain/bin/$(host)-dsymutil && \ chmod +x toolchain/bin/$(host)-dsymutil && \ - tar --strip-components=1 -xf $($(package)_source) + tar --no-same-owner --strip-components=1 -xf $($(package)_source) endef define $(package)_set_vars diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index 8f12ffa7fc..1605daa000 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -114,11 +114,11 @@ define $(package)_extract_cmds echo "$($(package)_qttools_sha256_hash) $($(package)_source_dir)/$($(package)_qttools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \ mkdir qtbase && \ - tar --strip-components=1 -xf $($(package)_source) -C qtbase && \ + tar --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \ mkdir qttranslations && \ - tar --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \ + tar --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \ mkdir qttools && \ - tar --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools + tar --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools endef define $(package)_preprocess_cmds @@ -127,7 +127,7 @@ define $(package)_preprocess_cmds sed -i.old "/updateqm.depends =/d" qttranslations/translations/translations.pro && \ sed -i.old "s/src_plugins.depends = src_sql src_network/src_plugins.depends = src_network/" qtbase/src/src.pro && \ sed -i.old "s|X11/extensions/XIproto.h|X11/X.h|" qtbase/src/plugins/platforms/xcb/qxcbxsettings.cpp && \ - sed -i.old 's/if \[ "$$$$XPLATFORM_MAC" = "yes" \]; then xspecvals=$$$$(macSDKify/if \[ "$$$$BUILD_ON_MAC" = "yes" \]; then xspecvals=$$$$(macSDKify/' qtbase/configure && \ + sed -i.old -e 's/if \[ "$$$$XPLATFORM_MAC" = "yes" \]; then xspecvals=$$$$(macSDKify/if \[ "$$$$BUILD_ON_MAC" = "yes" \]; then xspecvals=$$$$(macSDKify/' -e 's|/bin/pwd|pwd|' qtbase/configure && \ sed -i.old 's/CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, 0)/CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, kCGMouseButtonLeft)/' qtbase/src/plugins/platforms/cocoa/qcocoacursor.mm && \ mkdir -p qtbase/mkspecs/macx-clang-linux &&\ cp -f qtbase/mkspecs/macx-clang/Info.plist.lib qtbase/mkspecs/macx-clang-linux/ &&\ diff --git a/src/Makefile.am b/src/Makefile.am index 6006eac5d6..ccd7c9863f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -767,13 +767,13 @@ clean-local: check-symbols: $(bin_PROGRAMS) if GLIBC_BACK_COMPAT @echo "Checking glibc back compat..." - $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS) + $(AM_V_at) READELF=$(READELF) CPPFILT=$(CPPFILT) $(PYTHON) $(top_srcdir)/contrib/devtools/symbol-check.py < $(bin_PROGRAMS) endif check-security: $(bin_PROGRAMS) if HARDEN @echo "Checking binary security..." - $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS) + $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(PYTHON) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS) endif From 368f5f0c9fceee077626f284f972c3e5b236399a Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 20 Mar 2019 20:11:14 +0100 Subject: [PATCH 11/27] Merge #15626: Docs: Update ACK description in CONTRIBUTING.md 0d9d2b385b8c32ab422964128d10b99cfcad2612 Doc: update ACK description in CONTRIBUTING.md (Jon Atack) Pull request description: as per https://github.com/bitcoin/bitcoin/pull/15617#issuecomment-474773043. Edit: as per https://github.com/bitcoin/bitcoin/pull/15617#issuecomment-474773043 and https://github.com/bitcoin/bitcoin/pull/15626#discussion_r267286564. Tree-SHA512: 12df420d20338270bca310873c73d2f38b631c05cf8b3e5b2c1380f95936cb122687ba66b71de53348222efd5fed6d21e67f535a6ada689bf294dceec184a631 --- CONTRIBUTING.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fcb36e2c6d..a5e43615d6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -212,7 +212,10 @@ consensus to merge a pull request (remember that discussions may have been spread out over GitHub, mailing list and IRC discussions). The following language is used within pull-request comments: - - ACK means "I have tested the code and I agree it should be merged"; + - (t)ACK means "I have tested the code and I agree it should be merged", involving + change-specific manual testing in addition to running the unit and functional + tests, and in case it is not obvious how the manual testing was done, it should + be described; - NACK means "I disagree this should be merged", and must be accompanied by sound technical justification (or in certain cases of copyright/patent/licensing issues, legal justification). NACKs without accompanying reasoning may be From 407b5039185a4543852b25697f27680c825e5b42 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 25 Mar 2019 18:26:37 -0400 Subject: [PATCH 12/27] Merge #15603: docs: Add more tips to productivity.md 5801dd628d docs: Add more tips to productivity.md (gwillen) Pull request description: Add advice to productivity.md on: - Using ccache to optimal effect - The with-incompatible-bdb configure option - Building less than the entire set of targets ACKs for commit 5801dd: promag: utACK 5801dd6. MarcoFalke: utACK 5801dd6 Tree-SHA512: 2138acd4bf5a27ecaa9a02fb2141903d01ee199ba85ccf6a5ad6a0a4dabf4447d043108cdd86998801b0282e899f70892f9337b0b6dc59c6d1f0fccf61adb4e4 --- doc/productivity.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/doc/productivity.md b/doc/productivity.md index e0df558944..a93228ebdb 100644 --- a/doc/productivity.md +++ b/doc/productivity.md @@ -8,6 +8,7 @@ Table of Contents * [Cache compilations with `ccache`](#cache-compilations-with-ccache) * [Disable features with `./configure`](#disable-features-with-configure) * [Make use of your threads with `make -j`](#make-use-of-your-threads-with-make--j) + * [Only build what you need](#only-build-what-you-need) * [Multiple working directories with `git worktrees`](#multiple-working-directories-with-git-worktrees) * [Writing code](#writing-code) * [Format C/C++/Protobuf diffs with `clang-format-diff.py`](#format-ccprotobuf-diffs-with-clang-format-diffpy) @@ -32,6 +33,17 @@ Install `ccache` through your distribution's package manager, and run `./configu To use ccache for all your C/C++ projects, follow the symlinks method [here](https://ccache.samba.org/manual/latest.html#_run_modes) to set it up. +To get the most out of ccache, put something like this in `~/.ccache/ccache.conf`: + +``` +max_size = 50.0G # or whatever cache size you prefer; default is 5G; 0 means unlimited +base_dir = /home/yourname # or wherever you keep your source files +``` + +Note: base_dir is required for ccache to share cached compiles of the same file across different repositories / paths; it will only do this for paths under base_dir. So this option is required for effective use of ccache with git worktrees (described below). + +You _must not_ set base_dir to "/", or anywhere that contains system headers (according to the ccache docs). + ### Disable features with `./configure` After running `./autogen.sh`, which generates the `./configure` file, use `./configure --help` to identify features that you can disable to save on compilation time. A few common flags: @@ -43,6 +55,8 @@ After running `./autogen.sh`, which generates the `./configure` file, use `./con --without-gui ``` +If you do need the wallet enabled, it is common for devs to add `--with-incompatible-bdb`. This uses your system bdb version for the wallet, so you don't have to find a copy of bdb 4.8. Wallets from such a build will be incompatible with any release binary (and vice versa), so use with caution on mainnet. + ### Make use of your threads with `make -j` If you have multiple threads on your machine, you can tell `make` to utilize all of them with: @@ -51,6 +65,20 @@ If you have multiple threads on your machine, you can tell `make` to utilize all make -j"$(($(nproc)+1))" ``` +### Only build what you need + +When rebuilding during development, note that running `make`, without giving a target, will do a lot of work you probably don't need. It will build the GUI (unless you've disabled it) and all the tests (which take much longer to build than the app does). + +Obviously, it is important to build and run the tests at appropriate times -- but when you just want a quick compile to check your work, consider picking one or a set of build targets relevant to what you're working on, e.g.: + +```sh +make src/bitcoind src/bitcoin-cli +make src/qt/bitcoin-qt +make -C src bitcoin_bench +``` + +(You can and should combine this with `-j`, as above, for a parallel build.) + ### Multiple working directories with `git worktrees` If you work with multiple branches or multiple copies of the repository, you should try `git worktrees`. From b90273662118964180e3228051e33f3fbc3c7760 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Fri, 29 Mar 2019 10:22:06 +0100 Subject: [PATCH 13/27] Merge #15663: crypto: Remove unused AES-128 code f6ee177f7 Remove unused AES-128 code (practicalswift) Pull request description: Remove unused AES-128 code. As far as I can tell this AES-128 code has never been in use in the project (outside of testing/benchmarking). The AES-256 code is used in `CCrypter::Encrypt`/`CCrypter::Decrypt` (`src/wallet/crypter.cpp`). Trivia: 0.15% of the project's C++ LOC count (excluding dependencies) is trimmed off: ``` $ LOC_BEFORE=$(git grep -I "" HEAD~1 -- "*.cpp" "*.h" ":(exclude)src/leveldb/" ":(exclude)src/secp256k1/" ":(exclude)src/univalue/" | wc -l) $ LOC_AFTER=$(git grep -I "" -- "*.cpp" "*.h" ":(exclude)src/leveldb/" ":(exclude)src/secp256k1/" ":(exclude)src/univalue/" | wc -l) $ bc <<< "scale=4; ${LOC_AFTER}/${LOC_BEFORE}" .9985 ``` :-) Tree-SHA512: 9588a3cd795a89ef658b8ee7323865f57723cb4ed9560c21de793f82d35e2835059e7d6d0705e99e3d16bf6b2a444b4bf19568d50174ff3776caf8a3168f5c85 --- src/crypto/aes.cpp | 62 ---------------------------- src/crypto/aes.h | 51 ----------------------- src/test/crypto_tests.cpp | 87 --------------------------------------- 3 files changed, 200 deletions(-) diff --git a/src/crypto/aes.cpp b/src/crypto/aes.cpp index baba8bcad0..2f26630a2a 100644 --- a/src/crypto/aes.cpp +++ b/src/crypto/aes.cpp @@ -12,36 +12,6 @@ extern "C" { #include } -AES128Encrypt::AES128Encrypt(const unsigned char key[16]) -{ - AES128_init(&ctx, key); -} - -AES128Encrypt::~AES128Encrypt() -{ - memset(&ctx, 0, sizeof(ctx)); -} - -void AES128Encrypt::Encrypt(unsigned char ciphertext[16], const unsigned char plaintext[16]) const -{ - AES128_encrypt(&ctx, 1, ciphertext, plaintext); -} - -AES128Decrypt::AES128Decrypt(const unsigned char key[16]) -{ - AES128_init(&ctx, key); -} - -AES128Decrypt::~AES128Decrypt() -{ - memset(&ctx, 0, sizeof(ctx)); -} - -void AES128Decrypt::Decrypt(unsigned char plaintext[16], const unsigned char ciphertext[16]) const -{ - AES128_decrypt(&ctx, 1, plaintext, ciphertext); -} - AES256Encrypt::AES256Encrypt(const unsigned char key[32]) { AES256_init(&ctx, key); @@ -182,35 +152,3 @@ AES256CBCDecrypt::~AES256CBCDecrypt() { memset(iv, 0, sizeof(iv)); } - -AES128CBCEncrypt::AES128CBCEncrypt(const unsigned char key[AES128_KEYSIZE], const unsigned char ivIn[AES_BLOCKSIZE], bool padIn) - : enc(key), pad(padIn) -{ - memcpy(iv, ivIn, AES_BLOCKSIZE); -} - -AES128CBCEncrypt::~AES128CBCEncrypt() -{ - memset(iv, 0, AES_BLOCKSIZE); -} - -int AES128CBCEncrypt::Encrypt(const unsigned char* data, int size, unsigned char* out) const -{ - return CBCEncrypt(enc, iv, data, size, pad, out); -} - -AES128CBCDecrypt::AES128CBCDecrypt(const unsigned char key[AES128_KEYSIZE], const unsigned char ivIn[AES_BLOCKSIZE], bool padIn) - : dec(key), pad(padIn) -{ - memcpy(iv, ivIn, AES_BLOCKSIZE); -} - -AES128CBCDecrypt::~AES128CBCDecrypt() -{ - memset(iv, 0, AES_BLOCKSIZE); -} - -int AES128CBCDecrypt::Decrypt(const unsigned char* data, int size, unsigned char* out) const -{ - return CBCDecrypt(dec, iv, data, size, pad, out); -} diff --git a/src/crypto/aes.h b/src/crypto/aes.h index 0184969e4c..8b88b5ef2c 100644 --- a/src/crypto/aes.h +++ b/src/crypto/aes.h @@ -12,33 +12,8 @@ extern "C" { } static const int AES_BLOCKSIZE = 16; -static const int AES128_KEYSIZE = 16; static const int AES256_KEYSIZE = 32; -/** An encryption class for AES-128. */ -class AES128Encrypt -{ -private: - AES128_ctx ctx; - -public: - explicit AES128Encrypt(const unsigned char key[16]); - ~AES128Encrypt(); - void Encrypt(unsigned char ciphertext[16], const unsigned char plaintext[16]) const; -}; - -/** A decryption class for AES-128. */ -class AES128Decrypt -{ -private: - AES128_ctx ctx; - -public: - explicit AES128Decrypt(const unsigned char key[16]); - ~AES128Decrypt(); - void Decrypt(unsigned char plaintext[16], const unsigned char ciphertext[16]) const; -}; - /** An encryption class for AES-256. */ class AES256Encrypt { @@ -89,30 +64,4 @@ private: unsigned char iv[AES_BLOCKSIZE]; }; -class AES128CBCEncrypt -{ -public: - AES128CBCEncrypt(const unsigned char key[AES128_KEYSIZE], const unsigned char ivIn[AES_BLOCKSIZE], bool padIn); - ~AES128CBCEncrypt(); - int Encrypt(const unsigned char* data, int size, unsigned char* out) const; - -private: - const AES128Encrypt enc; - const bool pad; - unsigned char iv[AES_BLOCKSIZE]; -}; - -class AES128CBCDecrypt -{ -public: - AES128CBCDecrypt(const unsigned char key[AES128_KEYSIZE], const unsigned char ivIn[AES_BLOCKSIZE], bool padIn); - ~AES128CBCDecrypt(); - int Decrypt(const unsigned char* data, int size, unsigned char* out) const; - -private: - const AES128Decrypt dec; - const bool pad; - unsigned char iv[AES_BLOCKSIZE]; -}; - #endif // BITCOIN_CRYPTO_AES_H diff --git a/src/test/crypto_tests.cpp b/src/test/crypto_tests.cpp index 8350226ce8..5161c94e54 100644 --- a/src/test/crypto_tests.cpp +++ b/src/test/crypto_tests.cpp @@ -69,26 +69,6 @@ static void TestHMACSHA512(const std::string &hexkey, const std::string &hexin, TestVector(CHMAC_SHA512(key.data(), key.size()), ParseHex(hexin), ParseHex(hexout)); } -static void TestAES128(const std::string &hexkey, const std::string &hexin, const std::string &hexout) -{ - std::vector key = ParseHex(hexkey); - std::vector in = ParseHex(hexin); - std::vector correctout = ParseHex(hexout); - std::vector buf, buf2; - - assert(key.size() == 16); - assert(in.size() == 16); - assert(correctout.size() == 16); - AES128Encrypt enc(key.data()); - buf.resize(correctout.size()); - buf2.resize(correctout.size()); - enc.Encrypt(buf.data(), in.data()); - BOOST_CHECK_EQUAL(HexStr(buf), HexStr(correctout)); - AES128Decrypt dec(key.data()); - dec.Decrypt(buf2.data(), buf.data()); - BOOST_CHECK_EQUAL(HexStr(buf2), HexStr(in)); -} - static void TestAES256(const std::string &hexkey, const std::string &hexin, const std::string &hexout) { std::vector key = ParseHex(hexkey); @@ -108,47 +88,6 @@ static void TestAES256(const std::string &hexkey, const std::string &hexin, cons BOOST_CHECK(buf == in); } -static void TestAES128CBC(const std::string &hexkey, const std::string &hexiv, bool pad, const std::string &hexin, const std::string &hexout) -{ - std::vector key = ParseHex(hexkey); - std::vector iv = ParseHex(hexiv); - std::vector in = ParseHex(hexin); - std::vector correctout = ParseHex(hexout); - std::vector realout(in.size() + AES_BLOCKSIZE); - - // Encrypt the plaintext and verify that it equals the cipher - AES128CBCEncrypt enc(key.data(), iv.data(), pad); - int size = enc.Encrypt(in.data(), in.size(), realout.data()); - realout.resize(size); - BOOST_CHECK(realout.size() == correctout.size()); - BOOST_CHECK_MESSAGE(realout == correctout, HexStr(realout) + std::string(" != ") + hexout); - - // Decrypt the cipher and verify that it equals the plaintext - std::vector decrypted(correctout.size()); - AES128CBCDecrypt dec(key.data(), iv.data(), pad); - size = dec.Decrypt(correctout.data(), correctout.size(), decrypted.data()); - decrypted.resize(size); - BOOST_CHECK(decrypted.size() == in.size()); - BOOST_CHECK_MESSAGE(decrypted == in, HexStr(decrypted) + std::string(" != ") + hexin); - - // Encrypt and re-decrypt substrings of the plaintext and verify that they equal each-other - for(std::vector::iterator i(in.begin()); i != in.end(); ++i) - { - std::vector sub(i, in.end()); - std::vector subout(sub.size() + AES_BLOCKSIZE); - int _size = enc.Encrypt(sub.data(), sub.size(), subout.data()); - if (_size != 0) - { - subout.resize(_size); - std::vector subdecrypted(subout.size()); - _size = dec.Decrypt(subout.data(), subout.size(), subdecrypted.data()); - subdecrypted.resize(_size); - BOOST_CHECK(decrypted.size() == in.size()); - BOOST_CHECK_MESSAGE(subdecrypted == sub, HexStr(subdecrypted) + std::string(" != ") + HexStr(sub)); - } - } -} - static void TestAES256CBC(const std::string &hexkey, const std::string &hexiv, bool pad, const std::string &hexin, const std::string &hexout) { std::vector key = ParseHex(hexkey); @@ -461,14 +400,9 @@ BOOST_AUTO_TEST_CASE(hmac_sha512_testvectors) { BOOST_AUTO_TEST_CASE(aes_testvectors) { // AES test vectors from FIPS 197. - TestAES128("000102030405060708090a0b0c0d0e0f", "00112233445566778899aabbccddeeff", "69c4e0d86a7b0430d8cdb78070b4c55a"); TestAES256("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f", "00112233445566778899aabbccddeeff", "8ea2b7ca516745bfeafc49904b496089"); // AES-ECB test vectors from NIST sp800-38a. - TestAES128("2b7e151628aed2a6abf7158809cf4f3c", "6bc1bee22e409f96e93d7e117393172a", "3ad77bb40d7a3660a89ecaf32466ef97"); - TestAES128("2b7e151628aed2a6abf7158809cf4f3c", "ae2d8a571e03ac9c9eb76fac45af8e51", "f5d3d58503b9699de785895a96fdbaaf"); - TestAES128("2b7e151628aed2a6abf7158809cf4f3c", "30c81c46a35ce411e5fbc1191a0a52ef", "43b1cd7f598ece23881b00e3ed030688"); - TestAES128("2b7e151628aed2a6abf7158809cf4f3c", "f69f2445df4f9b17ad2b417be66c3710", "7b0c785e27e8ad3f8223207104725dd4"); TestAES256("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4", "6bc1bee22e409f96e93d7e117393172a", "f3eed1bdb5d2a03c064b5a7e3db181f8"); TestAES256("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4", "ae2d8a571e03ac9c9eb76fac45af8e51", "591ccb10d410ed26dc5ba74a31362870"); TestAES256("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4", "30c81c46a35ce411e5fbc1191a0a52ef", "b6ed21b99ca6f4f9f153e7b1beafed1d"); @@ -476,27 +410,6 @@ BOOST_AUTO_TEST_CASE(aes_testvectors) { } BOOST_AUTO_TEST_CASE(aes_cbc_testvectors) { - - // NIST AES CBC 128-bit encryption test-vectors - TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "000102030405060708090A0B0C0D0E0F", false, \ - "6bc1bee22e409f96e93d7e117393172a", "7649abac8119b246cee98e9b12e9197d"); - TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "7649ABAC8119B246CEE98E9B12E9197D", false, \ - "ae2d8a571e03ac9c9eb76fac45af8e51", "5086cb9b507219ee95db113a917678b2"); - TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "5086cb9b507219ee95db113a917678b2", false, \ - "30c81c46a35ce411e5fbc1191a0a52ef", "73bed6b8e3c1743b7116e69e22229516"); - TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "73bed6b8e3c1743b7116e69e22229516", false, \ - "f69f2445df4f9b17ad2b417be66c3710", "3ff1caa1681fac09120eca307586e1a7"); - - // The same vectors with padding enabled - TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "000102030405060708090A0B0C0D0E0F", true, \ - "6bc1bee22e409f96e93d7e117393172a", "7649abac8119b246cee98e9b12e9197d8964e0b149c10b7b682e6e39aaeb731c"); - TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "7649ABAC8119B246CEE98E9B12E9197D", true, \ - "ae2d8a571e03ac9c9eb76fac45af8e51", "5086cb9b507219ee95db113a917678b255e21d7100b988ffec32feeafaf23538"); - TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "5086cb9b507219ee95db113a917678b2", true, \ - "30c81c46a35ce411e5fbc1191a0a52ef", "73bed6b8e3c1743b7116e69e22229516f6eccda327bf8e5ec43718b0039adceb"); - TestAES128CBC("2b7e151628aed2a6abf7158809cf4f3c", "73bed6b8e3c1743b7116e69e22229516", true, \ - "f69f2445df4f9b17ad2b417be66c3710", "3ff1caa1681fac09120eca307586e1a78cb82807230e1321d3fae00d18cc2012"); - // NIST AES CBC 256-bit encryption test-vectors TestAES256CBC("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4", \ "000102030405060708090A0B0C0D0E0F", false, "6bc1bee22e409f96e93d7e117393172a", \ From dc25ff629408acf8beb82693ddc3f4338d308391 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 29 Mar 2019 18:23:49 -0400 Subject: [PATCH 14/27] Merge #15533: test: .style.yapf: Set column_limit=160 1111f0718a test: .style.yapf: Set column_limit=160 (MarcoFalke) Pull request description: The current style is pep8, as suggested in https://github.com/bitcoin/bitcoin/blob/master/test/functional/README.md#style-guidelines. generated with ``` $ yapf --version yapf 0.24.0 $ yapf --style-help --style=pep8 > .style.yapf ``` However, we don't use the column_limit of 79 right now. Practically it is somewhere between 120-240. Some stats: ``` column_limit=120: 115 files changed, 2423 insertions(+), 1408 deletions(-) column_limit=160: 108 files changed, 1563 insertions(+), 1247 deletions(-) column_limit=200: 104 files changed, 1255 insertions(+), 1178 deletions(-) ACKs for commit 1111f0: practicalswift: utACK 1111f0718acea42954600a4dbd553ac40aae797f agree with @ryanofsky ryanofsky: utACK 1111f0718acea42954600a4dbd553ac40aae797f Tree-SHA512: 1ce0da83b917496f4ea7d1af31b624517a78998a10091b6ba611737f2c819fa3cda1786307f15d20131a00fd95232818e3d1108950dd12b60c4674eaa447839f --- .style.yapf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.style.yapf b/.style.yapf index fe6227baf6..69d8c6aee4 100644 --- a/.style.yapf +++ b/.style.yapf @@ -55,7 +55,7 @@ blank_line_before_nested_class_or_def=False coalesce_brackets=False # The column limit. -column_limit=79 +column_limit=160 # The style for continuation alignment. Possible values are: # From c9d1944b6f2a601ef8647b4a7e90561b14550966 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 8 Apr 2019 10:18:01 -0400 Subject: [PATCH 15/27] Merge #15446: Improve depends debuggability 6d44c5ebf9 depends: Add commands for each package for each stage (Carl Dong) 80f0e05b70 depends: Preprocessing doesn't care about deps (Carl Dong) Pull request description: Adds make targets for each package for each stage, e.g. ```sh make zeromq_configured ``` ACKs for commit 6d44c5: MarcoFalke: ACK 6d44c5ebf97af4b357079fe4bc2130f98e1d0fd2 (Haven't looked at the code changes, but adding this feature makes sense) ryanofsky: ACK 6d44c5ebf97af4b357079fe4bc2130f98e1d0fd2 Tree-SHA512: f1ac0aecfd2372aed09ca63603e2634552cb3f6ff9d610f958e2a66952d7d9e870b4c32b7d996886879e6d3016532272e8b1a10c13ed7b31009c6c96f786db9f --- depends/Makefile | 2 ++ depends/funcs.mk | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/depends/Makefile b/depends/Makefile index c7d3dd5f72..01715afb24 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -183,4 +183,6 @@ download-win: @$(MAKE) -s HOST=x86_64-w64-mingw32 download-one download: download-osx download-linux download-win +$(foreach package,$(all_packages),$(eval $(call ext_add_stages,$(package)))) + .PHONY: install cached clean clean-all download-one download-osx download-linux download-win download check-packages check-sources diff --git a/depends/funcs.mk b/depends/funcs.mk index 03934db0d5..472234287b 100644 --- a/depends/funcs.mk +++ b/depends/funcs.mk @@ -173,13 +173,13 @@ $($(1)_extracted): | $($(1)_fetched) $(AT)mkdir -p $$(@D) $(AT)cd $$(@D); $(call $(1)_extract_cmds,$(1)) $(AT)touch $$@ -$($(1)_preprocessed): | $($(1)_dependencies) $($(1)_extracted) +$($(1)_preprocessed): | $($(1)_extracted) $(AT)echo Preprocessing $(1)... $(AT)mkdir -p $$(@D) $($(1)_patch_dir) $(AT)$(foreach patch,$($(1)_patches),cd $(PATCHES_PATH)/$(1); cp $(patch) $($(1)_patch_dir) ;) $(AT)cd $$(@D); $(call $(1)_preprocess_cmds, $(1)) $(AT)touch $$@ -$($(1)_configured): | $($(1)_preprocessed) +$($(1)_configured): | $($(1)_dependencies) $($(1)_preprocessed) $(AT)echo Configuring $(1)... $(AT)rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar --no-same-owner -xf $($(package)_cached); ) $(AT)mkdir -p $$(@D) @@ -216,6 +216,14 @@ $(1): | $($(1)_cached_checksum) endef +stages = fetched extracted preprocessed configured built staged postprocessed cached cached_checksum + +define ext_add_stages +$(foreach stage,$(stages), + $(1)_$(stage): $($(1)_$(stage)) + .PHONY: $(1)_$(stage)) +endef + # These functions create the build targets for each package. They must be # broken down into small steps so that each part is done for all packages # before moving on to the next step. Otherwise, a package's info From 6c424bf4da14a9f7b1541262de2305f1fd1adfe3 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 9 Apr 2019 08:57:45 -0400 Subject: [PATCH 16/27] Merge #15772: test: Properly log named args in authproxy fa078984c9 test: Properly log named args in authproxy (MarcoFalke) Pull request description: ACKs for commit fa0789: promag: ACK fa07898, for instance: practicalswift: utACK fa078984c9cc706dc7b510a8ada26c3026713647 Tree-SHA512: 3a2564c9b8392c2ef13657138fa0ba4a521015e2d53331156d2a07ccc9497fb268f21e8d93b065c5734d25e4aea8f5cf67f07e6ab93b0ec2987d66a136f94bb8 --- test/functional/test_framework/authproxy.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/functional/test_framework/authproxy.py b/test/functional/test_framework/authproxy.py index ca4f5a25a4..cc6788bd9f 100644 --- a/test/functional/test_framework/authproxy.py +++ b/test/functional/test_framework/authproxy.py @@ -122,8 +122,11 @@ class AuthServiceProxy(): def get_request(self, *args, **argsn): AuthServiceProxy.__id_count += 1 - log.debug("-%s-> %s %s" % (AuthServiceProxy.__id_count, self._service_name, - json.dumps(args, default=EncodeDecimal, ensure_ascii=self.ensure_ascii))) + log.debug("-{}-> {} {}".format( + AuthServiceProxy.__id_count, + self._service_name, + json.dumps(args or argsn, default=EncodeDecimal, ensure_ascii=self.ensure_ascii), + )) if args and argsn: raise ValueError('Cannot handle both named and positional arguments') return {'version': '1.1', From 3ba32a111676acf974efdc3d097ed817ff2edc03 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 26 Apr 2019 18:31:40 -0400 Subject: [PATCH 17/27] Merge #15887: docs: Align code example style with clang-format 201393f932 Align code example with clang-format (Hennadii Stepanov) Pull request description: With this PR running [clang-format-diff.py](https://github.com/bitcoin/bitcoin/blob/master/contrib/devtools/clang-format-diff.py) on the code example will not fire a format adjustment. ACKs for commit 201393: MarcoFalke: trivial ACK 201393f93268f6775d1b5d54119a7210628b333d Tree-SHA512: 825c5e8cfba1bc140c2dfc38b82c5eec268b82b528af4301f25dfacc1f4f0788e268e72e8512f7ce001be665a8b07964a0af832fd9a1c6bd1c27d252f93619bc --- doc/developer-notes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/developer-notes.md b/doc/developer-notes.md index 00a4257bdf..392895517e 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -593,8 +593,8 @@ class AddressBookPage Mode m_mode; } -AddressBookPage::AddressBookPage(Mode _mode) : - m_mode(_mode) +AddressBookPage::AddressBookPage(Mode _mode) + : m_mode(_mode) ... ``` From 0199129fdc56a2915f8d13f8ee183d47a00a26b5 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Thu, 2 May 2019 08:43:54 -0400 Subject: [PATCH 18/27] Merge #15650: Handle the result of posix_fallocate system call 5d35ae3326 Handle the result of posix_fallocate system call (Luca Venturini) Pull request description: The system call `posix_fallocate` is not supported on some filesystems. - catches the result of posix_allocate and fall back to the default behaviour if the return value is different from 0 (success) Fixes #15624 ACKs for commit 5d35ae: MarcoFalke: utACK 5d35ae3326624da3fe5dcb4047c9a7cec6665cab sipa: utACK 5d35ae3326624da3fe5dcb4047c9a7cec6665cab, though the Yoda condition is an uncommon style in this project. hebasto: utACK 5d35ae3326624da3fe5dcb4047c9a7cec6665cab practicalswift: utACK 5d35ae3326624da3fe5dcb4047c9a7cec6665cab Tree-SHA512: 7ab3b35fb633926f28a58b2b07ffde8e31bb997c80a716b1b45ee716fe9ff4ddcef0a05810bd4423530e220cfc62f8925517d27a8b92b05a524272063e43f746 --- src/util/system.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/util/system.cpp b/src/util/system.cpp index 1b78107dca..5d0f4aeba4 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -1164,11 +1164,12 @@ void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length) { fcntl(fileno(file), F_PREALLOCATE, &fst); } ftruncate(fileno(file), fst.fst_length); -#elif defined(__linux__) +#else + #if defined(__linux__) // Version using posix_fallocate off_t nEndPos = (off_t)offset + length; - posix_fallocate(fileno(file), 0, nEndPos); -#else + if (0 == posix_fallocate(fileno(file), 0, nEndPos)) return; + #endif // Fallback version // TODO: just write one byte per block static const char buf[65536] = {}; From 698ca44c98b74d3905aa0d3880793c083da9dde0 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 6 May 2019 15:32:01 -0400 Subject: [PATCH 19/27] Merge #14266: refactor: Lift prevector default vals to the member declaration d2eee87928 Lift prevector default vals to the member declaration (Ben Woosley) Pull request description: I overlooked this possibility in #14028 ACKs for commit d2eee8: promag: utACK d2eee87, change looks good because members are always initialized. 251Labs: utACK d2eee87 nice one. ken2812221: utACK d2eee87928781ab3082d4279aa6f19641a45e801 practicalswift: utACK d2eee87928781ab3082d4279aa6f19641a45e801 scravy: utACK d2eee87928781ab3082d4279aa6f19641a45e801 Tree-SHA512: f2726bae1cf892fd680cf8571027bcdc2e42ba567eaa901fb5fb5423b4d11b29e745e0163d82cb513d8c81399cc85933a16ed66d4a30829382d4721ffc41dc97 --- src/prevector.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/prevector.h b/src/prevector.h index 1f00576030..e3ecb2c9b2 100644 --- a/src/prevector.h +++ b/src/prevector.h @@ -148,14 +148,14 @@ public: }; private: - size_type _size; + size_type _size = 0; union direct_or_indirect { char direct[sizeof(T) * N]; struct { size_type capacity; char* indirect; }; - } _union; + } _union = {}; T* direct_ptr(difference_type pos) { return reinterpret_cast(_union.direct) + pos; } const T* direct_ptr(difference_type pos) const { return reinterpret_cast(_union.direct) + pos; } @@ -263,34 +263,34 @@ public: fill(item_ptr(0), first, last); } - prevector() : _size(0), _union{{}} {} + prevector() {} - explicit prevector(size_type n) : prevector() { + explicit prevector(size_type n) { resize(n); } - explicit prevector(size_type n, const T& val) : prevector() { + explicit prevector(size_type n, const T& val) { change_capacity(n); _size += n; fill(item_ptr(0), n, val); } template - prevector(InputIterator first, InputIterator last) : prevector() { + prevector(InputIterator first, InputIterator last) { size_type n = last - first; change_capacity(n); _size += n; fill(item_ptr(0), first, last); } - prevector(const prevector& other) : prevector() { + prevector(const prevector& other) { size_type n = other.size(); change_capacity(n); _size += n; fill(item_ptr(0), other.begin(), other.end()); } - prevector(prevector&& other) : prevector() { + prevector(prevector&& other) { swap(other); } From 037830d21fb35ffdbf2b1247e6995d0c7cac0a7b Mon Sep 17 00:00:00 2001 From: MeshCollider Date: Thu, 9 May 2019 00:00:39 +1200 Subject: [PATCH 20/27] Merge #15880: utils and libraries: Replace deprecated Boost Filesystem functions a0a222eec Replace deprecated Boost Filesystem function (Hennadii Stepanov) 4f65af97b Remove dead code for walletFile check (Hennadii Stepanov) Pull request description: Boost Filesystem `basename()` and `extension()` functions are [deprecated since v1.36.0](https://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/reference.html#Convenience-functions). See more: https://lists.boost.org/Archives/boost/2010/01/160905.php Also this PR prevents further use of deprecated Boost Filesystem functions. Ref: https://www.boost.org/doc/libs/1_64_0/libs/filesystem/doc/index.htm#Coding-guidelines Note: On my Linux system Boost 1.65.1 header `/usr/include/boost/filesystem/convenience.hpp` contains: ```c++ # ifndef BOOST_FILESYSTEM_NO_DEPRECATED inline std::string extension(const path & p) { return p.extension().string(); } inline std::string basename(const path & p) { return p.stem().string(); } inline path change_extension( const path & p, const path & new_extension ) { path new_p( p ); new_p.replace_extension( new_extension ); return new_p; } # endif ``` UPDATE: Also removed unused code as [noted](https://github.com/bitcoin/bitcoin/pull/15880#discussion_r279386614) by **ryanofsky**. ACKs for commit a0a222: Empact: utACK https://github.com/bitcoin/bitcoin/pull/15880/commits/a0a222eec0b7f615a756e5e0dcec9b02296f999c practicalswift: utACK a0a222eec0b7f615a756e5e0dcec9b02296f999c fanquake: utACK a0a222e ryanofsky: utACK a0a222eec0b7f615a756e5e0dcec9b02296f999c. Only change is dropping assert and squashing first two commits. Tree-SHA512: bc54355441c49957507eb8d3a5782b92d65674504d69779bc16b1b997b2e7424d5665eb6bfb6e10b430a6cacd2aca70af2f94e5f7f10bea24624202834ad35c7 --- src/dbwrapper.cpp | 2 +- src/fs.h | 1 + src/wallet/db.cpp | 7 ------- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index 8e757839a6..abfc3a496d 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -115,7 +115,7 @@ static leveldb::Options GetOptions(size_t nCacheSize) } CDBWrapper::CDBWrapper(const fs::path& path, size_t nCacheSize, bool fMemory, bool fWipe, bool obfuscate) - : m_name(fs::basename(path)) + : m_name{path.stem().string()} { penv = nullptr; readoptions.verify_checksums = true; diff --git a/src/fs.h b/src/fs.h index d478846a6e..8d6f9528b5 100644 --- a/src/fs.h +++ b/src/fs.h @@ -11,6 +11,7 @@ #include #endif +#define BOOST_FILESYSTEM_NO_DEPRECATED #include #include #include diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index 31c954f200..382cee9c2e 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -341,13 +341,6 @@ bool BerkeleyBatch::VerifyEnvironment(const fs::path& file_path, std::string& er LogPrintf("Using BerkeleyDB version %s\n", BerkeleyDatabaseVersion()); LogPrintf("Using wallet %s\n", walletFile); - // Wallet file must be a plain filename without a directory - if (walletFile != fs::basename(walletFile) + fs::extension(walletFile)) - { - errorStr = strprintf(_("Wallet %s resides outside wallet directory %s"), walletFile, walletDir.string()); - return false; - } - if (!env->Open(true /* retry */)) { errorStr = strprintf(_("Error initializing wallet database environment %s!"), walletDir); return false; From e32f1e0b2b4c501b88d6d74693031c5c06efc85b Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 9 May 2019 18:04:03 +0200 Subject: [PATCH 21/27] Merge #15794: docs: Clarify PR guidelines w/re documentation f4a230b627bf9ff53e14719609849ee05b022480 docs: Clarify PR guidelines w/re documentation (Carl Dong) Pull request description: PRs should change documentation accordingly when the behaviour of code changes. ACKs for commit f4a230: practicalswift: ACK f4a230b627bf9ff53e14719609849ee05b022480 fanquake: utACK f4a230b Tree-SHA512: 6d9d65d7f0f9bc8f324ee16f03169df28fb512c58bb71093128cf16797b25533cdc992bc8757034a99d6fa6423a3129ca7cf2ab2da857535f409a683486fd4ab --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a5e43615d6..aa3c1e082a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -193,6 +193,7 @@ In general, all pull requests must: - Not break the existing test suite; - Where bugs are fixed, where possible, there should be unit tests demonstrating the bug and also proving the fix. This helps prevent regression. + - Change relevant comments and documentation when behaviour of code changes. Patches that change Dash consensus rules are considerably more involved than normal because they affect the entire ecosystem and so must be preceded by From 7dee7786b7889f4ad44d51c194981257395da5a7 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 13 May 2019 12:45:59 -0400 Subject: [PATCH 22/27] Merge #14364: doc: Clarify -blocksdir usage ccc27bdcd2 doc: Clarify -blocksdir usage (Daniel McNally) Pull request description: This PR attempts to clarify and correct the `-blocksdir` argument description and default value. `-blocksdir` does not refer to the full path to the actual `blocks` directory, but rather the root/parent directory which contains the `blocks` directory. Accordingly, the default value is `` and not `/blocks` - this behavior of defaulting to the datadir can also be seen in init.cpp: ```cpp if (gArgs.IsArgSet("-blocksdir")) { path = fs::system_complete(gArgs.GetArg("-blocksdir", "")); if (!fs::is_directory(path)) { path = ""; return path; } } else { path = GetDataDir(false); } ``` It also attempts to clarify that only the `.dat` files containing block data are impacted by `-blocksdir`, not the index files. I believe this would close #12828. ACKs for commit ccc27b: hebasto: utACK ccc27bdcd2d91fe2c023ad004019d5b970f21dbf Tree-SHA512: 7b65f66b0579fd56e8c8cd4f9f22d6af56181817762a68deccd7fca51820ad82d9a0c48f5f1f012e746c67bcdae7af4555fad867cb620a9ca538d465c9d86c2b --- src/init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init.cpp b/src/init.cpp index ceba1ed3d4..5b921de129 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -488,7 +488,7 @@ void SetupServerArgs() gArgs.AddArg("-?", "Print this help message and exit", false, OptionsCategory::OPTIONS); gArgs.AddArg("-alertnotify=", "Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)", false, OptionsCategory::OPTIONS); gArgs.AddArg("-assumevalid=", strprintf("If this block is in the chain assume that it and its ancestors are valid and potentially skip their script verification (0 to verify all, default: %s, testnet: %s)", defaultChainParams->GetConsensus().defaultAssumeValid.GetHex(), testnetChainParams->GetConsensus().defaultAssumeValid.GetHex()), false, OptionsCategory::OPTIONS); - gArgs.AddArg("-blocksdir=", "Specify blocks directory (default: /blocks)", false, OptionsCategory::OPTIONS); + gArgs.AddArg("-blocksdir=", "Specify directory to hold blocks subdirectory for *.dat files (default: )", false, OptionsCategory::OPTIONS); gArgs.AddArg("-blocknotify=", "Execute command when the best block changes (%s in cmd is replaced by block hash)", false, OptionsCategory::OPTIONS); gArgs.AddArg("-blockreconstructionextratxn=", strprintf("Extra transactions to keep in memory for compact block reconstructions (default: %u)", DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN), false, OptionsCategory::OPTIONS); gArgs.AddArg("-blocksonly", strprintf("Whether to operate in a blocks only mode (default: %u)", DEFAULT_BLOCKSONLY), true, OptionsCategory::OPTIONS); From 7c690ead6b2381ba815ba6a7d675cf5fc0db446d Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Thu, 16 May 2019 07:43:55 -0400 Subject: [PATCH 23/27] Merge #15983: build with -fstack-reuse=none faf38bc056 build with -fstack-reuse=none (MarcoFalke) Pull request description: All versions of gcc that we commonly use for building are subject to bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348. To work around that, set `-fstack-reuse=none` for all builds. See https://github.com/bitcoin/bitcoin/pull/15959#issuecomment-490423900 This option does not exist for clang https://clang.llvm.org/docs/ClangCommandLineReference.html#target-independent-compilation-options, but it does for gcc https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html ACKs for commit faf38b: Tree-SHA512: f5597583402d31ea7b89ac358a6f4a537bbb82a1dde2bd41bac65ee0fd88c7af75ee4c24c6b8eed6b139bf4dbf07ab2987f8fc30fb3eab179cd2d753a8a2a47d --- configure.ac | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure.ac b/configure.ac index b75f1b1af2..ef14b38aaa 100644 --- a/configure.ac +++ b/configure.ac @@ -786,6 +786,10 @@ if test x$TARGET_OS != xwindows; then AX_CHECK_COMPILE_FLAG([-fPIC],[PIC_FLAGS="-fPIC"]) fi +# All versions of gcc that we commonly use for building are subject to bug +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348. To work around that, set +# -fstack-reuse=none for all gcc builds. (Only gcc understands this flag) +AX_CHECK_COMPILE_FLAG([-fstack-reuse=none],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-reuse=none"]) if test x$use_hardening != xno; then use_hardening=yes AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"]) From 55c35078a5bbf5d64d4c38017142e7473fc80a7a Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 16 May 2019 16:23:12 +0200 Subject: [PATCH 24/27] Merge #15950: Do not construct out-of-bound pointers in SHA2 code c01c065b9ded3399a6a480f15543827dd5e8eb4d Do not construct out-of-bound pointers in SHA512/SHA1/RIPEMD160 code (Pieter Wuille) Pull request description: This looks like an issue in the current SHA256/512 code, where a pointer outside of the area pointed to may be constructed (this is UB in theory, though in practice every supported platform treats pointers as integers). I discovered this while investigating #14580. Sadly, it does not fix it. ACKs for commit c01c06: practicalswift: utACK c01c065b9ded3399a6a480f15543827dd5e8eb4d Tree-SHA512: 47660e00f164f38c36a1ab46e52dd91cd33cfda6a6048d67541c2f8e73c050d4d9d81b5c149bfad281212d52f204f57bebf5b19879dc7a6a5f48aa823fbc2c02 --- src/crypto/ripemd160.cpp | 2 +- src/crypto/sha1.cpp | 2 +- src/crypto/sha512.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/crypto/ripemd160.cpp b/src/crypto/ripemd160.cpp index 4afa9abd1e..ffb5ec5b14 100644 --- a/src/crypto/ripemd160.cpp +++ b/src/crypto/ripemd160.cpp @@ -256,7 +256,7 @@ CRIPEMD160& CRIPEMD160::Write(const unsigned char* data, size_t len) ripemd160::Transform(s, buf); bufsize = 0; } - while (end >= data + 64) { + while (end - data >= 64) { // Process full chunks directly from the source. ripemd160::Transform(s, data); bytes += 64; diff --git a/src/crypto/sha1.cpp b/src/crypto/sha1.cpp index 8ccc5e112a..be15cce134 100644 --- a/src/crypto/sha1.cpp +++ b/src/crypto/sha1.cpp @@ -163,7 +163,7 @@ CSHA1& CSHA1::Write(const unsigned char* data, size_t len) sha1::Transform(s, buf); bufsize = 0; } - while (end >= data + 64) { + while (end - data >= 64) { // Process full chunks directly from the source. sha1::Transform(s, data); bytes += 64; diff --git a/src/crypto/sha512.cpp b/src/crypto/sha512.cpp index aa46e7ba86..de8d51e112 100644 --- a/src/crypto/sha512.cpp +++ b/src/crypto/sha512.cpp @@ -168,7 +168,7 @@ CSHA512& CSHA512::Write(const unsigned char* data, size_t len) sha512::Transform(s, buf); bufsize = 0; } - while (end >= data + 128) { + while (end - data >= 128) { // Process full chunks directly from the source. sha512::Transform(s, data); data += 128; From 038997ff45b285b3144604a7fda82685ad462b7c Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Thu, 16 May 2019 11:02:11 -0400 Subject: [PATCH 25/27] Merge #16036: travis: Run all lint scripts even if one fails f3b90f2e05 Run all lint scripts (Julian Fleischer) Pull request description: The description reads: ``` # This script runs all contrib/devtools/lint-*.sh files, and fails if any exit # with a non-zero status code. ``` This runs all scripts and returns with a non-zero exit code if any failed. ACKs for commit f3b90f: Tree-SHA512: 4f1f6435855dd5074a38c5887be6f096ec66f4dbe8712bdfd5fed0c510f1b2c083b7318cf3bfbdcc85982429fb7b4309e57ce48cc11736c86376658ec7ffea8f --- test/lint/lint-all.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/lint/lint-all.sh b/test/lint/lint-all.sh index 7c4f96cb3b..fabc24c91b 100755 --- a/test/lint/lint-all.sh +++ b/test/lint/lint-all.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Copyright (c) 2017 The Bitcoin Core developers +# Copyright (c) 2017-2019 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # @@ -16,11 +16,15 @@ set -u SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}") LINTALL=$(basename "${BASH_SOURCE[0]}") +EXIT_CODE=0 + for f in "${SCRIPTDIR}"/lint-*.sh; do if [ "$(basename "$f")" != "$LINTALL" ]; then if ! "$f"; then echo "^---- failure generated from $f" - exit 1 + EXIT_CODE=1 fi fi done + +exit ${EXIT_CODE} From 26d618df99600a4ff46f6635239f97e80c849e63 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Thu, 16 May 2019 13:44:47 -0400 Subject: [PATCH 26/27] Merge #15820: docs: Add productivity notes for dummy rebases 01971da9bd docs: Add productivity notes for "dummy rebases" (Carl Dong) Pull request description: When rebasing, we often want to do a "dummy rebase" whereby we are not rebasing over an updated master. This is because rebases can be confusing enough already, and we don't want to resolve upstream conflicts together with our local rebase conflicts due to fixup commits, commit rearrangements, and such. This productivity section details how to do such "dummy rebase"s. ACKs for commit 01971d: Tree-SHA512: 241a451cec01dc9a01a2286bdee1441cac6d28007f5b173345744d2abf436da916c3f2553ff0d1c5b3687055107b37872dda9529288645e4bae7b3cb46923b7e --- doc/productivity.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/productivity.md b/doc/productivity.md index a93228ebdb..b25ddc94e5 100644 --- a/doc/productivity.md +++ b/doc/productivity.md @@ -10,6 +10,7 @@ Table of Contents * [Make use of your threads with `make -j`](#make-use-of-your-threads-with-make--j) * [Only build what you need](#only-build-what-you-need) * [Multiple working directories with `git worktrees`](#multiple-working-directories-with-git-worktrees) + * [Interactive "dummy rebases" for fixups and execs with `git merge-base`](#interactive-dummy-rebases-for-fixups-and-execs-with-git-merge-base) * [Writing code](#writing-code) * [Format C/C++/Protobuf diffs with `clang-format-diff.py`](#format-ccprotobuf-diffs-with-clang-format-diffpy) * [Format Python diffs with `yapf-diff.py`](#format-python-diffs-with-yapf-diffpy) @@ -93,6 +94,21 @@ To simply check out a commit-ish under a new working directory without disruptin git worktree add --checkout ../where-my-checkout-commit-ish-will-live my-checkout-commit-ish ``` +### Interactive "dummy rebases" for fixups and execs with `git merge-base` + +When rebasing, we often want to do a "dummy rebase," whereby we are not rebasing over an updated master but rather over the last common commit with master. This might be useful for rearranging commits, `rebase --autosquash`ing, or `rebase --exec`ing without introducing conflicts that arise from an updated master. In these situations, we can use `git merge-base` to identify the last common commit with master, and rebase off of that. + +To squash in `git commit --fixup` commits without rebasing over an updated master, we can do the following: + +```sh +git rebase -i --autosquash "$(git merge-base master HEAD)" +``` + +To execute `make check` on every commit since last diverged from master, but without rebasing over an updated master, we can do the following: +```sh +git rebase -i --exec "make check" "$(git merge-base master HEAD)" +``` + ----- This synergizes well with [`ccache`](#cache-compilations-with-ccache) as objects resulting from unchanged code will most likely hit the cache and won't need to be recompiled. From ff2388005316d608fdf91a216a6622cdd8aece41 Mon Sep 17 00:00:00 2001 From: pasta Date: Sat, 10 Jul 2021 12:10:07 -0500 Subject: [PATCH 27/27] dashify productivity.md Signed-off-by: pasta --- doc/productivity.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/productivity.md b/doc/productivity.md index b25ddc94e5..39f3cdf194 100644 --- a/doc/productivity.md +++ b/doc/productivity.md @@ -73,9 +73,9 @@ When rebuilding during development, note that running `make`, without giving a t Obviously, it is important to build and run the tests at appropriate times -- but when you just want a quick compile to check your work, consider picking one or a set of build targets relevant to what you're working on, e.g.: ```sh -make src/bitcoind src/bitcoin-cli -make src/qt/bitcoin-qt -make -C src bitcoin_bench +make src/dashd src/dash-cli +make src/qt/dash-qt +make -C src dash_bench ``` (You can and should combine this with `-j`, as above, for a parallel build.) @@ -173,7 +173,7 @@ When looking at other's pull requests, it may make sense to add the following se ``` [remote "upstream-pull"] fetch = +refs/pull/*:refs/remotes/upstream-pull/* - url = git@github.com:bitcoin/bitcoin.git + url = git@github.com:dashpay/dash.git ``` This will add an `upstream-pull` remote to your git repository, which can be fetched using `git fetch --all` or `git fetch upstream-pull`. Afterwards, you can use `upstream-pull/NUMBER/head` in arguments to `git show`, `git checkout` and anywhere a commit id would be acceptable to see the changes from pull request NUMBER.