Commit graph

27184 commits

Author SHA1 Message Date
Wladimir J. van der Laan
7b975639ef
Merge #19937: signet mining utility
595a34dbea contrib/signet: Document miner script in README.md (Anthony Towns)
ff7dbdc08a contrib/signet: Add script for generating a signet chain (Anthony Towns)
13762bcc96 Add bitcoin-util command line utility (Anthony Towns)
95d5d5e625 rpc: allow getblocktemplate for test chains when unconnected or in IBD (Anthony Towns)
81c54dec20 rpc: update getblocktemplate with signet rule, include signet_challenge (Anthony Towns)

Pull request description:

  Adds `contrib/signet/miner` for mining signet blocks.

  Adds `bitcoin-util` cli utility, with the idea being it can provide bitcoin related functionality that does not rely on the ability to access a running node. Only subcommand currently is "grind" which takes a hex-encoded header and grinds its nonce until its nBits is satisfied.

  Updates `getblocktemplate` to include `signet_challenge` field, and makes `getblocktemplate` require the signet rule when invoked on the signet change. Removes connectivity and IBD checks from `getblocktemplate` when applied to a test chain (regtest, testnet, signet).

ACKs for top commit:
  laanwj:
    code review ACK 595a34dbea

Tree-SHA512: 8d43297710fdc1edc58acd9b53e1bd1671e5724f7097b40ab73653715dc8becc70534c4496cbba9290f4dd6538a7a3d5830eb85f83391ea31a3bb5b9d3378cc3
2021-01-12 12:53:45 +01:00
fanquake
18017152c2
Merge #20619: guix: Quality of life improvements
570e43fe72 guix: Print build params inside/outside of container (Carl Dong)
2f9d1fdde6 guix: Move DISTSRC determination to guix-build.sh (Carl Dong)
0b7cd07bb5 guix: Move OUTDIR determination+creation to guix-build.sh (Carl Dong)
d27ff8b86a guix: Add more sanity checks to guix-build.sh (Carl Dong)
57f9533146 guix: Add section headings to guix-build.sh (Carl Dong)
38b7b2ed72 genbuild: Specify rev-parse length (Carl Dong)
036dc740da docs: Point to contrib/guix/README.md in doc/guix.md (Carl Dong)
34f0fda2d3 guix: Small updates to README wording (Carl Dong)
402e3a5b1e guix: Update HOSTS README entry for new architectures (Carl Dong)
cfa7ceb21b guix: Remove README development environment section (Carl Dong)
93b6a8544a guix: Add ADDITIONAL_GUIX_{COMMON,TIMEMACHINE}_FLAGS options (Carl Dong)
0f31e24703 guix: Add SUBSTITUTE_URLS option (Carl Dong)
444fcfca90 guix: Make guix honor MAX_JOBS setting (Carl Dong)

Pull request description:

  After live-demo-ing a Guix build (which completed successfully!) on achow101's stream, I realized there were a few quality of life improvements which can be made to improve the user experience of our Guix build process. Here are a few of them.

  Notable changes:
  1. When `MAX_JOBS` is specified, both `guix time-machine` and `guix environment` will now build up to `MAX_JOBS` packages at a time when creating the build environment
  2. The instructions for using substitutes were incorrect, and has now been replaced with a `SUBSTITUTE_URLS` environment variable, which works well with shell's IFS splitting rules
  3. New `ADDITIONAL_GUIX_{COMMON,TIMEMACHINE}_FLAGS` options, for more granular customization of the build process.
  4. README cleanup

ACKs for top commit:
  fanquake:
    ACK 570e43fe72 - lets move this forward.

Tree-SHA512: 4e8ab560522ade5efb5e8736aec0fb1a3f19ae9deb586c1ab87020816876f3f466a950b3f8c04d9fa1d072ae5ee780038c5c9063577049bdd9db17978e11c328
2021-01-12 18:53:35 +08:00
Anthony Towns
595a34dbea contrib/signet: Document miner script in README.md 2021-01-12 18:34:29 +10:00
Anthony Towns
ff7dbdc08a contrib/signet: Add script for generating a signet chain 2021-01-12 18:34:29 +10:00
Anthony Towns
13762bcc96 Add bitcoin-util command line utility 2021-01-12 18:34:25 +10:00
fanquake
7838db141b
Merge #20495: sync: Use decltype(auto) return type for WITH_LOCK
3eb94ec81b sync: Use decltype(auto) return type for WITH_LOCK (Carl Dong)

Pull request description:

  > Now that we're using C++17, we can use the decltype(auto) return type
  > for functions and lambda expressions.
  >
  > As demonstrated in this commit, this can simplify cases where previously
  > the compiler failed to deduce the correct return type.
  >
  > Just for reference, for the "assign to ref" cases fixed here, there are
  > 3 possible solutions:
  >
  > - Return a pointer and immediately deref as used before this commit
  > - Make sure the function/lambda returns declspec(auto) as used after
  >   this commit
  > - Class& i = WITH_LOCK(..., return std::ref(...));
  >
  > -----
  >
  > References:
  > 1. https://en.cppreference.com/w/cpp/language/function#Return_type_deduction
  > 2. https://en.cppreference.com/w/cpp/language/template_argument_deduction#Other_contexts
  > 3. https://en.cppreference.com/w/cpp/language/auto
  > 4. https://en.cppreference.com/w/cpp/language/decltype
  >
  > Explanations:
  > 1. https://stackoverflow.com/a/21369192
  > 2. https://stackoverflow.com/a/21369170

  Thanks to sipa and ryanofsky for helping me understand this

ACKs for top commit:
  jnewbery:
    utACK 3eb94ec81b
  hebasto:
    ACK 3eb94ec81b, I have reviewed the code and it looks OK, I agree it can be merged. I have verified possible warnings:
  ryanofsky:
    Code review ACK 3eb94ec81b

Tree-SHA512: 5f55c7722aeca8ea70e5c1a8db93e93ba0e356e8967e7f607ada38003df4b153d73c29bd2cea8d7ec1344720d37d857ea7dbfd2a88da1d92e0e9cbb9abd287df
2021-01-12 15:56:19 +08:00
MarcoFalke
6af013792f
Merge #19315: [tests] Allow outbound & block-relay-only connections in functional tests.
b4dd2ef800 [test] Test the add_outbound_p2p_connection functionality (Amiti Uttarwar)
602e69e427 [test] P2PBlocksOnly - Test block-relay-only connections. (Amiti Uttarwar)
8bb6beacb1 [test/refactor] P2PBlocksOnly - Extract transaction violation test into helper. (Amiti Uttarwar)
99791e7560 [test/refactor] P2PBlocksOnly - simplify transaction creation using blocktool helper. (Amiti Uttarwar)
3997ab9154 [test] Add test framework support to create outbound connections. (Amiti Uttarwar)
5bc04e8837 [rpc/net] Introduce addconnection to test outbounds & blockrelay (Amiti Uttarwar)

Pull request description:

  The existing functional test framework uses the `addnode` RPC to spin up manual connections between bitcoind nodes. This limits our ability to add integration tests for our networking code, which often executes different code paths for different connection types.

  **This PR enables creating `outbound` & `block-relay-only` P2P connections in the functional tests.** This allows us to increase our p2p test coverage, since we can now verify expectations around these connection types.

  This builds out the [prototype](https://github.com/bitcoin/bitcoin/issues/14210#issuecomment-527421978) proposed by ajtowns in #14210. 🙌🏽

  An overview of this branch:
  - introduces a new test-only RPC function `addconnection` which initiates opening an `outbound` or `block-relay-only` connection. (conceptually similar to `addnode` but for different connection types & restricted to regtest)
  - adds `test_framework` support so a mininode can open an `outbound`/`block-relay-only` connection to a `P2PInterface`/`P2PConnection`.
  - updates `p2p_blocksonly` tests to create a `block-relay-only` connection & verify expectations around transaction relay.
  - introduces `p2p_add_connections` test that checks the behaviors of the newly introduced `add_outbound_p2p_connection` test framework function.

  With these changes, there are many more behaviors that we can add integration tests for. The blocksonly updates is just one example.

  Huge props to ajtowns for conceiving the approach & providing me feedback as I've built out this branch. Also thank you to jnewbery for lots of thoughtful input along the way.

ACKs for top commit:
  troygiorshev:
    reACK b4dd2ef800
  jnewbery:
    utACK b4dd2ef800
  MarcoFalke:
    Approach ACK b4dd2ef800 🍢

Tree-SHA512: d1cba768c19c9c80e6a38b1c340cc86a90701b14772c4a0791c458f9097f6a4574b4a4acc7d13d6790c7b1f1f197e2c3d87996270f177402145f084ef8519a6b
2021-01-11 21:06:57 +01:00
fanquake
6d81d7aa87
Merge #20787: Use C++17 std::array deduction for OUTPUT_TYPES, ALL_FEE_ESTIMATE_HORIZONS
aaaa987840 refactor: Use C++17 std::array deduction for ALL_FEE_ESTIMATE_HORIZONS (MarcoFalke)
fa39cdd072 refactor: Use C++17 std::array deduction for OUTPUT_TYPES (MarcoFalke)

Pull request description:

  With the new C++17 array deduction rules, an array encompassing all values in an enum can be specified in the same header file that specifies the enum. This is useful to avoid having to repeatedly enumerate all enum values in the code. E.g. the RPC code, but also the fuzz code.

ACKs for top commit:
  theStack:
    cr ACK aaaa987840 ⚙️
  fanquake:
    ACK aaaa987840

Tree-SHA512: b71bd98f3ca07ddfec385735538ce89a4952e418b52dc990fb160187ccef1fc7ebc139d42988b6f7b48df24823af61f803b83d47fb7a3b82475f0c0b109bffb7
2021-01-11 21:46:09 +08:00
MarcoFalke
5cce607105
Merge #20373: refactor, net: Increase CNode data member encapsulation
3642b2ed34 refactor, net: Increase CNode data member encapsulation (Hennadii Stepanov)
acebb79d3f refactor, move-only: Relocate CNode private members (Hennadii Stepanov)

Pull request description:

  All protected `CNode` data members could be private.

ACKs for top commit:
  jnewbery:
    utACK 3642b2ed34
  MarcoFalke:
    review ACK 3642b2ed34 🏛

Tree-SHA512: 8435e3c43c3b7a3107d58cb809b8b5e1a1c0068677e249bdf0fc6ed24140ac4fc4efe2a280a1ee86df180d738c0c9e10772308690607954db6713000cf6e728d
2021-01-11 13:19:43 +01:00
Wladimir J. van der Laan
675af2a515
Merge #20852: net: allow CSubNet of non-IP networks
39b43298d9 test: add test for banning of non-IP addresses (Vasil Dimov)
94d335da7f net: allow CSubNet of non-IP networks (Vasil Dimov)

Pull request description:

  Allow creation of valid `CSubNet` objects of non-IP networks and only
  match the single address they were created from (like /32 for IPv4 or
  /128 for IPv6).

  This fixes a deficiency in `CConnman::DisconnectNode(const CNetAddr& addr)`
  and in `BanMan` which assume that creating a subnet from any address
  using the `CSubNet(CNetAddr)` constructor would later match that address
  only. Before this change a non-IP subnet would be invalid and would not
  match any address.

ACKs for top commit:
  jonatack:
    Code review re-ACK 39b43298d9 per `git diff 5e95ce6 39b4329`; only change since last review is improvements to the functional test; verified the test fails on master @ 616eace0 where expected (`assert(self.is_banned(node, tor_addr))` fails and unban unfails)
  laanwj:
    code review ACK 39b43298d9

Tree-SHA512: 3239b26d0f2fa2d1388b4fdbc1d05ce4ac1980be699c6ec46049409baefcb2006b1e72b889871e2210e897f6725c48e873f68457eea7e6e4958ab4f959d20297
2021-01-11 11:27:47 +01:00
Jonas Schnelli
616eace02a
Merge bitcoin-core/gui#161: Add PeerTableModel::StatsRole to prevent data layer violation
b3e9bcaac8 qt, refactor: Drop no longer used PeerTableModel::getNodeStats function (Hennadii Stepanov)
49c604077c qt: Use PeerTableModel::StatsRole (Hennadii Stepanov)
35007edf9c qt: Add PeerTableModel::StatsRole (Hennadii Stepanov)

Pull request description:

  This PR allows to access to the `CNodeCombinedStats` instance directly from any view object.

  The `PeerTableModel::getNodeStats` member function removed as a kind of layer violation.

  No behavior changes.

  Also other pulls (bugfixes) are based on this one: #18 and #164.

ACKs for top commit:
  jonatack:
    Tested re-ACK b3e9bcaac8 per `git range-diff ae8f797 4c05fe0 b3e9bca`
  promag:
    Code review ACK b3e9bcaac8.
  jonasschnelli:
    utACK b3e9bcaac8

Tree-SHA512: 6ba50d5dd2c0373655d491ce8b130c47d598da2db5ff4b00633f447404c7e70f8562ead53ddf166e851384d9632ff9146a770c99845c2cdd3ff7250677e4c130
2021-01-11 09:06:21 +01:00
MarcoFalke
9c0b76c709
Merge #20876: test: Replace getmempoolentry with testmempoolaccept in MiniWallet
faabc26a61 test: Replace getmempoolentry with testmempoolaccept in MiniWallet (MarcoFalke)

Pull request description:

  This is a refactor to not use the return value of `sendrawtransaction` and `getmempoolentry` with the goal that submitting the tx to the mempool will become optional.

ACKs for top commit:
  mjdietzx:
    ACK faabc26a61

Tree-SHA512: 4260a59e65fed1c807530dad23f1996ba6e881bcce91995f5b498a0be6001f67b3e0251507c8801750fe105410147c68bb2f393ebe678c6a3a4d045e5d72fc19
2021-01-11 08:57:28 +01:00
fanquake
bd6af53e1f
Merge #20480: Replace boost::variant with std::variant
faa8f68943 Replace boost::variant with std::variant (MarcoFalke)

Pull request description:

  Now that we can use std::variant from the vanilla standard library, drop the third-party boost variant dependency

ACKs for top commit:
  fjahr:
    Code review ACK faa8f68943
  fanquake:
    ACK faa8f68943

Tree-SHA512: 6e3aecd33b00c2e31a763f999247944d5b2ce5e3018f1965c516c1000cd08ff6703a8d50fb0be64883153da2925ae72986b8a6b96586db74057bd05d6f4986e6
2021-01-11 12:05:46 +08:00
fanquake
c4458cc3a1
Merge #18819: net: Replace cs_feeFilter with simple std::atomic
fad1f0fd33 net: Remove unused cs_feeFilter (MarcoFalke)

Pull request description:

  A `RecursiveMutex` is overkill for setting or reading a plain integer. Even a `Mutex` is overkill, when a plain `std::atomic` can be used.

  This removes 11 lines of code. Also, it is cutting down on the number of locks put on the stack at the same time, which complicates review looking out for potential lock contention.

ACKs for top commit:
  jnewbery:
    utACK fad1f0fd33
  practicalswift:
    cr ACK fad1f0fd33: patch looks correct

Tree-SHA512: 647f9b954fbf52e138d3e710937eb9131b390fef0deae03fd6a162d5a18b9f194010800bbddc8f89208d91be2802dff11c3884d04b3dd233865abd12aa3cde06
2021-01-11 10:14:11 +08:00
Vasil Dimov
39b43298d9
test: add test for banning of non-IP addresses
Co-authored-by: Jon Atack <jon@atack.com>
2021-01-10 15:51:25 +01:00
Vasil Dimov
94d335da7f
net: allow CSubNet of non-IP networks
Allow creation of valid `CSubNet` objects of non-IP networks and only
match the single address they were created from (like /32 for IPv4 or
/128 for IPv6).

This fixes a deficiency in `CConnman::DisconnectNode(const CNetAddr& addr)`
and in `BanMan` which assume that creating a subnet from any address
using the `CSubNet(CNetAddr)` constructor would later match that address
only. Before this change a non-IP subnet would be invalid and would not
match any address.
2021-01-10 15:51:15 +01:00
Hennadii Stepanov
3642b2ed34
refactor, net: Increase CNode data member encapsulation
All protected CNode data members could be private.
2021-01-10 12:00:46 +02:00
Hennadii Stepanov
acebb79d3f
refactor, move-only: Relocate CNode private members 2021-01-10 12:00:44 +02:00
MarcoFalke
0944024309
Merge bitcoin-core/gui#163: Peer details: replace Direction with Connection Type
06ba9b3008 rpc: move getpeerinfo connection_type help to correct place (Jon Atack)
c95fe6e38f gui: improve connection type tooltip (Hennadii Stepanov)
2c19ba2e1d gui: replace Direction with Connection Type in peer details (Jon Atack)
7e2beab2d2 gui: create GUIUtil::ConnectionTypeToQString utility function (Jon Atack)

Pull request description:

  ![Screenshot from 2021-01-09 11-23-17](https://user-images.githubusercontent.com/2415484/104089297-c5e18d80-5265-11eb-9251-49afcfdb562b.png)

  Closes #159.

ACKs for top commit:
  hebasto:
    re-ACK 06ba9b3008, the tooltip content is organized as unordered list.
  jarolrod:
    re-ACK 06ba9b3008

Tree-SHA512: 24f46494ceb42ed308e4a4f2a543dbc4f4e6409a6f738c145a9f16e175bf69d411cbc944a4fd969f1829d57644dfbc194182fa8d4e9e6bce82acbeca8c673748
2021-01-10 10:42:50 +01:00
MarcoFalke
555fc0789d
Merge #20881: fuzz: net permission flags in net processing
fad327ca65 fuzz: net permission flags in net processing (MarcoFalke)

Pull request description:

  to increase coverage

ACKs for top commit:
  Crypt-iQ:
    cr ACK fad327c
  practicalswift:
    ACK fad327ca65

Tree-SHA512: f8643d1774ff13524ab97ab228ad070489e080435e5742af26e6e325fd002e4c1fd78b9887e11622e79d6fe0c4daaddce5e033e6cd4b32e50fd68b434aab7333
2021-01-10 10:33:57 +01:00
fanquake
708ef4424a
Merge #20890: doc: Add explicit macdeployqtplus dependencies install step
3e61b8c800 doc: Add explicit macdeployqtplus dependencies install step (Hennadii Stepanov)

Pull request description:

  This PR adds to macOS docs an explicit step to install `macdeployqtplus` script dependencies that are not part of the [Python Standard Library](https://docs.python.org/3/library/index.html):
  - https://pypi.org/project/ds-store/
  - https://pypi.org/project/mac-alias/

  This change is required on macOS 11 Big Sur:

  -  #20371
  - #20878

  Close #20878.

ACKs for top commit:
  fanquake:
    ACK 3e61b8c800

Tree-SHA512: d177139ee142d47cb27ad878d721cafcd03403ef861965ff532d712da461416380ec5878f70accf223a552a1f1e65eedb1e0ad72cb7a96791f8a55536ce28645
2021-01-10 15:03:05 +08:00
Jon Atack
06ba9b3008
rpc: move getpeerinfo connection_type help to correct place
per review feedback
2021-01-09 13:50:00 +01:00
Hennadii Stepanov
c95fe6e38f
gui: improve connection type tooltip
- remove RPC and option names from the translatable string
- use non-breaking hyphens
2021-01-09 13:49:51 +01:00
Jon Atack
2c19ba2e1d
gui: replace Direction with Connection Type in peer details 2021-01-09 13:49:20 +01:00
Wladimir J. van der Laan
5574e48963
Merge #20741: doc: Update 'Secure string handling'
7117d7503f Update 'Secure string handling' (Prayank)

Pull request description:

  - Add information about possible path traversal attack
  - [wallet_name](https://bitcoincore.org/en/doc/0.20.0/rpc/wallet/createwallet/) (string): _The name for the new wallet. If this is a 'path', the wallet will be created at the 'path' location._

  Fixes https://github.com/bitcoin/bitcoin/issues/20128 (Not really fixing it but workaround)

  This PR is an alternative to https://github.com/bitcoin/bitcoin/pull/20393

ACKs for top commit:
  michaelfolkson:
    ACK 7117d7503f
  RiccardoMasutti:
    ACK 7117d7503f
  benthecarman:
    ACK 7117d7503f

Tree-SHA512: 0d6c4f8db5feba848bbb583e87a99e6c4b655deaa2b566164e2632acc1aabf470d4626d2dc4b82c4997effc30d9b474d860d0e0d3e896648c5cc9bfdb623da6d
2021-01-09 09:00:23 +01:00
Hennadii Stepanov
3e61b8c800
doc: Add explicit macdeployqtplus dependencies install step
This change is required on macOS 11 Big Sur.
2021-01-09 09:37:12 +02:00
Carl Dong
570e43fe72 guix: Print build params inside/outside of container 2021-01-08 11:40:02 -05:00
Carl Dong
2f9d1fdde6 guix: Move DISTSRC determination to guix-build.sh 2021-01-08 11:40:01 -05:00
Carl Dong
0b7cd07bb5 guix: Move OUTDIR determination+creation to guix-build.sh 2021-01-08 11:40:01 -05:00
Carl Dong
d27ff8b86a guix: Add more sanity checks to guix-build.sh 2021-01-08 11:40:01 -05:00
Carl Dong
57f9533146 guix: Add section headings to guix-build.sh 2021-01-08 11:40:01 -05:00
Carl Dong
38b7b2ed72 genbuild: Specify rev-parse length 2021-01-08 11:40:01 -05:00
Carl Dong
036dc740da docs: Point to contrib/guix/README.md in doc/guix.md 2021-01-08 11:40:01 -05:00
Carl Dong
34f0fda2d3 guix: Small updates to README wording 2021-01-08 11:40:01 -05:00
Carl Dong
402e3a5b1e guix: Update HOSTS README entry for new architectures 2021-01-08 11:40:01 -05:00
Carl Dong
cfa7ceb21b guix: Remove README development environment section 2021-01-08 11:40:01 -05:00
Carl Dong
93b6a8544a guix: Add ADDITIONAL_GUIX_{COMMON,TIMEMACHINE}_FLAGS options 2021-01-08 11:40:01 -05:00
Carl Dong
0f31e24703 guix: Add SUBSTITUTE_URLS option 2021-01-08 11:40:01 -05:00
Carl Dong
444fcfca90 guix: Make guix honor MAX_JOBS setting 2021-01-08 11:40:01 -05:00
Jon Atack
7e2beab2d2
gui: create GUIUtil::ConnectionTypeToQString utility function 2021-01-08 15:24:31 +01:00
MarcoFalke
9158d6f341
Merge #20786: net: [refactor] Prefer integral types in CNodeStats
faecb74562 Expose integral m_conn_type in CNodeStats, remove m_conn_type_string (Jon Atack)

Pull request description:

  Currently, strings are stored for what are actually integral (strong) enum types. This is fine, because the strings are only used as-is for the debug log and RPC. However, it complicates using them in the GUI. User facing strings in the GUI should be translated and only string literals can be picked up for translation, not runtime `std::string`s.

  Fix that by removing the `std::string` members and replace them by strong enum integral types.

ACKs for top commit:
  jonatack:
    Code review ACK faecb74562
  theStack:
    Code review ACK faecb74562 🌲

Tree-SHA512: 24df2bd0645432060e393eb44b8abaf20fe296457d07a867b0e735c3e2e75af7b03fc6bfeca734ec33ab816a7c8e1f8591a5ec342f3afe3098a4e41f5c2cfebb
2021-01-08 15:14:53 +01:00
MarcoFalke
1e078f17b5
Merge #20882: fuzz: Add missing muhash registration
fa44417fcb fuzz: Add missing muhash registration (MarcoFalke)

Pull request description:

  otherwise it is not possible to run the target

ACKs for top commit:
  laanwj:
    Code review ACK fa44417fcb

Tree-SHA512: b6495b84890a778d3569deddfc5703d1bed95d7d5c1eb0766fd5bd9afe86a3a0ccf4726aa16cba4a5fd182d23bfb7e815f3af4eb635915397c90805585b5699e
2021-01-08 14:00:17 +01:00
MarcoFalke
fa44417fcb
fuzz: Add missing muhash registration 2021-01-08 09:40:50 +01:00
MarcoFalke
faabc26a61
test: Replace getmempoolentry with testmempoolaccept in MiniWallet 2021-01-08 09:07:33 +01:00
MarcoFalke
5082324225
Merge #20688: test: run mempool_compatibility.py even with wallet disabled
a7599c80eb test: run mempool_compatibility.py even with wallet disabled (Michael Dietz)

Pull request description:

  Another functional test rewritten as proposed in https://github.com/bitcoin/bitcoin/issues/20078

ACKs for top commit:
  MarcoFalke:
    review ACK a7599c80eb didn't test

Tree-SHA512: cc7a617e5489ed27bbdbdee85a82fa08525375061f7f4524577a6b8ecb340396adac88419b51f513be22ca53edd0a3bd5d572d9f43ffc2c18550b0ef9069d238
2021-01-08 08:35:01 +01:00
Wladimir J. van der Laan
76b45d5fd7
Merge #19683: depends: Pin clang search paths for darwin host
196b727649 depends: Add comment about cache invalidation (Carl Dong)
949c480e52 depends: Fully determine path for darwin cctools (Carl Dong)
880660acfa depends: Fully determine path for darwin_{CC,CXX} (Carl Dong)
8033110741 depends: Quote to prevent word splitting in config.site (Carl Dong)
77b1ef89a0 depends: Remove -fuse-ld line (Carl Dong)
3007339218 depends: Pin clang search paths for darwin host (Carl Dong)
107f33d434 depends: Delay expansion of per-package vars (Carl Dong)

Pull request description:

  > Hello clang/lib/frontend,
  > I search your headers once again.
  > Because it's time for some housekeeping,
  > Within the code I was tweaking,
  > And the targets I was making with my build,
  > Are unfulfilled,
  > It's just language compliance.
  >
  > In reference works I scroll alone
  > Pages cribbed from holy tomes
  > In the details of a template
  > My code's behaviour has now found its fate
  > When my hopes were dashed as a note left it as described:
  > As undefined
  > It's not in compliance
  >
  > And from the standard text I saw
  > Ten thousand errors, maybe more
  > Threading used without locking
  > Pointers referenced after freeing
  > Linters writing warnings that coders will never fix
  > But still they tick
  > The box that claims compliance
  >
  > "Fools," said I, "you do not know"
  > Errors, like a cancer, grow
  > Hear my words that I might reach you
  > Use -Wall and it might teach you
  > But my words and compiler errors fade.
  > Schedules forbade compliance.
  >
  > And the people bowed and prayed
  > With static checking torn and frayed
  > The markets flashed out their warning
  > In the words that they were forming
  > As recruiters said "The search for more profits leads to writing stuff in CSS,
  > And node.js.
  > Without a need for compliance"

  Many thanks to ajtowns for the above contribution!

  -----

  This PR is ready for review!

  When cross-compiling for macOS, the SDK gives us the entire context/sysroot on which we should base the build. This means that we can be extremely specific w/re our search path ordering in order to avoid build problems that arise out of a user's specific environment/system setup and improve the robustness of our macOS toolchain. This PR does 2 things to this end:

  1. Unset environment variables which are known to alter search paths.
  1. Makes us (in the case of macOS builds) explicitly specify the list of system include search paths and its ordering, rather than rely on `clang`'s unreliable autodetection routine. Here is the [rabbit-hole gist](https://gist.github.com/dongcarl/5cdc6990b7599e8a5bf6d2a9c70e82f9).

      See the added comments in `depends/hosts/darwin.mk` for more details:

      8b8296dc70/depends/hosts/darwin.mk (L37-L60)

  We can be this specific _only_ because macOS builds are neatly contained in an SDK, **and** we are cross-compiling. Native toolchains should rely on the environment/distro/user to know how best to build for the running system.

  Note: Although the `-u` flag of `env` is not a POSIX standard flag, it seems like it is useful enough to be implemented in [coreutils](https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html), [busybox](https://busybox.net/downloads/BusyBox.html#env), [FreeBSD](https://www.freebsd.org/cgi/man.cgi?env).

ACKs for top commit:
  laanwj:
    code review ACK 196b727649

Tree-SHA512: 406442df16d9aa0aef62f9fa94f72d7e48374301f3d826bf32f183e1610942aa44a4adfac7bead1f14aded0044fac400e1328fcd933b2337e55a024f034b5013
2021-01-08 06:10:24 +01:00
Wladimir J. van der Laan
86a8b35f32
Merge #14501: Fix possible data race when committing block files
ef712298c3 util: Check for file being NULL in DirectoryCommit (Luke Dashjr)
4574904038 Fix possible data race when committing block files (Evan Klitzke)
220bb16cbe util: Introduce DirectoryCommit commit function to sync a directory (Evan Klitzke)
ce5cbaea63 util.h: Document FileCommit function (Evan Klitzke)
844d650eea util: Prefer Mac-specific F_FULLSYNC over fdatasync in FileCommit (Evan Klitzke)
f6cec0bcaf util: Refactor FileCommit from an #if sequence nested in #else, to a sequence of #elif (Evan Klitzke)

Pull request description:

  Reviving #12696

ACKs for top commit:
  laanwj:
    Code review ACK ef712298c3

Tree-SHA512: 07d650990ef4c18d645dee3f9a199a940683ad17557d79d93979a76c4e710d8d70e6eae01d1a5991494a24a7654eb7db868be0c34a31e70b2509945d95bc9cce
2021-01-07 22:07:33 +01:00
Carl Dong
196b727649 depends: Add comment about cache invalidation 2021-01-07 14:24:06 -05:00
Carl Dong
949c480e52 depends: Fully determine path for darwin cctools
See previous commit for description.
2021-01-07 14:24:06 -05:00
Carl Dong
880660acfa depends: Fully determine path for darwin_{CC,CXX}
Instead of doing the awkward /bin path prepending at config.site
creation time, set darwin_{CC,CXX} in a way that fully determines the
program's path (clang/clang++) similar to how AC_PATH_{TOOL,PROG} would
do.

Also see the added comment block in depends/Makefile for more context on
determining $PATH for our config.site.
2021-01-07 14:22:36 -05:00