Replace Boost.Process with cpp-subprocess #28981

pull hebasto wants to merge 3 commits into bitcoin:master from hebasto:231130-replace-bp changing 8 files +2017 −82
  1. hebasto commented at 2:05 am on December 1, 2023: member

    Closes #24907.

    This PR is based on theStack’s work.

    The subprocess.hpp header has been sourced from the upstream repo with the only modification being the removal of convenience functions, which are not utilized in our codebase.

    Windows-related changes will be addressed in subsequent follow-ups.

  2. DrahtBot commented at 2:05 am on December 1, 2023: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK achow101, theStack, Sjors, fanquake
    Concept ACK TheCharlatan, dergoegge

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #29744 (lint: Refactor lint checks to reuse exclusion logic; Support running individual lint checks in lint runner by davidgumberg)
    • #22417 (util/system: Close non-std fds when execing slave processes by luke-jr)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  3. DrahtBot added the label CI failed on Dec 1, 2023
  4. TheCharlatan commented at 9:15 am on December 1, 2023: contributor
    Concept ACK
  5. hebasto force-pushed on Dec 1, 2023
  6. in test/lint/lint-spelling.py:15 in 7d3770b42d outdated
    11@@ -12,7 +12,7 @@
    12 from subprocess import check_output, STDOUT, CalledProcessError
    13 
    14 IGNORE_WORDS_FILE = 'test/lint/spelling.ignore-words.txt'
    15-FILES_ARGS = ['git', 'ls-files', '--', ":(exclude)build-aux/m4/", ":(exclude)contrib/seeds/*.txt", ":(exclude)depends/", ":(exclude)doc/release-notes/", ":(exclude)src/leveldb/", ":(exclude)src/crc32c/", ":(exclude)src/qt/locale/", ":(exclude)src/qt/*.qrc", ":(exclude)src/secp256k1/", ":(exclude)src/minisketch/", ":(exclude)contrib/guix/patches"]
    16+FILES_ARGS = ['git', 'ls-files', '--', ":(exclude)build-aux/m4/", ":(exclude)contrib/seeds/*.txt", ":(exclude)depends/", ":(exclude)doc/release-notes/", ":(exclude)src/leveldb/", ":(exclude)src/crc32c/", ":(exclude)src/qt/locale/", ":(exclude)src/qt/*.qrc", ":(exclude)src/secp256k1/", ":(exclude)src/minisketch/", ":(exclude)src/util/subprocess.hpp", ":(exclude)contrib/guix/patches"]
    


    maflcko commented at 12:36 pm on December 1, 2023:
    nit: Could split this into one-per-line to avoid overly long lines, diffs and reduce merge conflicts?

    fanquake commented at 1:33 pm on December 1, 2023:
    Probably easier to just fix the typos, then add more things for linters to exclude? No new ones should be introduced.
  7. maflcko commented at 12:38 pm on December 1, 2023: member
    I guess the compile error is due to subprocess requiring C++17 and not allowing C++20 (or later)?
  8. fanquake commented at 1:35 pm on December 1, 2023: member
    Concept ACK on removing Boost Process. Is the plan to also delete any unused code from this header? I don’t think copy-pasting dead/untested code into this repository is a good idea, and only serves to complicate review, and potentially cause issues in future (it maybe already doesn’t work with c++20?)
  9. hebasto force-pushed on Dec 1, 2023
  10. theStack commented at 2:24 pm on December 1, 2023: contributor
    Concept ACK, thanks for picking this up.
  11. hebasto commented at 3:44 pm on December 1, 2023: member

    Is the plan to also delete any unused code from this header?

    I haven’t consider it yet.

    it maybe already doesn’t work with c++20?

    CI jobs that uses C++20 are passing so far.

  12. sipa commented at 3:48 pm on December 1, 2023: member

    Is the plan to also delete any unused code from this header?

    If at all possible, I’d prefer for it to be subtreed, so that updating to newer upstream versions is easy.

  13. fanquake commented at 3:50 pm on December 1, 2023: member

    I was actually thinking the opposite. I think a subtree is overkill here, and, upstream isn’t exactly active (some random merges but no development), so I’m not sure if there will be many new versions.

    I’d rather take the small(er) portion of any code we need, and have something better integrated/reviewed. Hopefully that will help avoid randomly pulling code from upstream, that isn’t well developed or reviewed.

  14. fanquake commented at 3:53 pm on December 1, 2023: member
    Note that the last version from upstream was nearly 4 years ago: https://github.com/arun11299/cpp-subprocess/releases/tag/v2.0.
  15. hebasto commented at 3:53 pm on December 1, 2023: member

    I’d rather take the small(er) portion of any code we need, and have something better integrated/reviewed.

    Maybe a subtree from our own fork? (to avoid bringing testing stuff to the main repo)

  16. fanquake commented at 3:57 pm on December 1, 2023: member

    Maybe a subtree from our own fork?

    I think that would mostly just re-introduce the awkwardness we ended up with with univalue, for not much benefit, and for code that shouldn’t be critical (i.e compared to leveldb & libsecp256k1), this is for an optional feature, that is not used by a large proportion of the people running this software.

  17. TheCharlatan commented at 4:03 pm on December 1, 2023: contributor

    Re #28981 (comment)

    I’d rather take the small(er) portion of any code we need, and have something better integrated/reviewed.

    Looking at the coverage report of the header, there seems to be some potential for pruning out (89.2% function coverage and 67.4% line coverage),

  18. hebasto force-pushed on Dec 2, 2023
  19. hebasto commented at 7:49 pm on December 2, 2023: member

    I switched to the Popen constructor that accepts const std::string& instead of std::vector<std::string> to address quoting issues on Windows. @theStack Since you initially chose to use a vector, do you have any objections to this approach?


    Here are the Windows functional tests – https://github.com/hebasto/bitcoin/actions/runs/7072075125/job/19250502576

  20. hebasto force-pushed on Dec 2, 2023
  21. DrahtBot removed the label CI failed on Dec 2, 2023
  22. hebasto marked this as ready for review on Dec 2, 2023
  23. hebasto commented at 9:24 pm on December 2, 2023: member

    CI turned green. Undrafted.

    cc @achow101 @Sjors

  24. theStack commented at 1:11 am on December 3, 2023: contributor

    I switched to the Popen constructor that accepts const std::string& instead of std::vector<std::string> to address quoting issues on Windows.

    @theStack Since you initially chose to use a vector, do you have any objections to this approach?

    No objections at all. I would have expected that passing the arguments as a single string is more prone to quoting issues than if it’s done in a list, where quoting shouldn’t be needed at all, but if it works, all the better :) (Maybe that unverified assumption made me use the std::vector Popen ctor back then, but I honestly don’t really remember).

  25. hebasto commented at 10:02 am on December 3, 2023: member

    I switched to the Popen constructor that accepts const std::string& instead of std::vector<std::string> to address quoting issues on Windows. @theStack Since you initially chose to use a vector, do you have any objections to this approach?

    No objections at all. I would have expected that passing the arguments as a single string is more prone to quoting issues than if it’s done in a list, where quoting shouldn’t be needed at all, but if it works, all the better :) (Maybe that unverified assumption made me use the std::vector Popen ctor back then, but I honestly don’t really remember).

    To support the string-based approach, let’s consider echo-ing a JSON-parsable string on Windows:

    0>echo {"success": true}
    1{"success": true}
    

    and reproducing it using Python’s subprocess module, which interface is mimicked in cpp-subprocess:

    0>>> import subprocess
    1>>> subprocess.run("cmd.exe /c echo {\"success\": true}")
    2{"success": true}
    3CompletedProcess(args='cmd.exe /c echo {"success": true}', returncode=0)
    

    It becomes intricate when using a list of strings:

    0>>> subprocess.run(["cmd.exe", "/c", "echo", "{\"success\": true}"])
    1"{\"success\": true}"
    

    or

    0>>> subprocess.run(["cmd.exe", "/c", "echo", "{\"success\":", "true}"])
    1{\"success\": true}
    

    or

    0>>> subprocess.run(['cmd.exe', '/c', 'echo', '{"success":', 'true}'])
    1{\"success\": true}
    
  26. hebasto force-pushed on Dec 3, 2023
  27. hebasto commented at 7:05 pm on December 3, 2023: member
    Rebased on top of the #28989.
  28. hebasto renamed this:
    POC: Replace Boost.Process with cpp-subprocess
    Replace Boost.Process with cpp-subprocess
    on Dec 4, 2023
  29. dergoegge commented at 4:35 pm on December 4, 2023: member
    Concept ACK
  30. luke-jr changes_requested
  31. luke-jr commented at 3:25 am on December 5, 2023: member

    Maybe a subtree from our own fork?

    I think that would mostly just re-introduce the awkwardness we ended up with with univalue, for not much benefit, and for code that shouldn’t be critical (i.e compared to leveldb & libsecp256k1), this is for an optional feature, that is not used by a large proportion of the people running this software.

    Which means it should be an entirely external dependency we just check for in configure…

    The only thing worse than a subtree, is entirely vendoring it like this PR currently does.

  32. Sjors commented at 2:23 pm on December 5, 2023: member

    The code changes for external signing look pretty minimal, so that’s nice. I have no informed opinion on the difference between Boost Process and cpp-process. Except that the latter seems self contained.

    Which means it should be an entirely external dependency we just check for in configure…

    In theory that makes sense to me as well, e.g. a fork under the bitcoin-core project, with functionality (mostly) limited to what we need. However in practice it means having to package it and get into distros. Or force anyone* compiling Bitcoin to also clone and build this library from source themselves. The latter could be less of a problem, if we make it easier to build and use individual /depends packages. But that’s not going to be anytime soon.

    * = who either needs the feature or just doesn’t want to accidentally break it

  33. hebasto force-pushed on Dec 6, 2023
  34. hebasto commented at 8:17 pm on December 6, 2023: member
    Rebased on top of the merged #28989.
  35. DrahtBot added the label Needs rebase on Dec 12, 2023
  36. Sjors commented at 2:34 pm on December 13, 2023: member

    Tested on Ubuntu 23.10.

    This slightly changes the way strings are escaped, please use this:

     0--- a/src/external_signer.cpp
     1+++ b/src/external_signer.cpp
     2@@ -60,43 +60,43 @@ bool ExternalSigner::Enumerate(const std::string& command, std::vector<ExternalS
     3     return true;
     4 }
     5 
     6 UniValue ExternalSigner::DisplayAddress(const std::string& descriptor) const
     7 {
     8-    return RunCommandParseJSON(m_command + " --fingerprint " + m_fingerprint + NetworkArg() + " displayaddress --desc \"" + descriptor + "\"");
     9+    return RunCommandParseJSON(m_command + " --fingerprint " + m_fingerprint + NetworkArg() + " displayaddress --desc " + descriptor);
    10 }
    11
    12     const std::string command = m_command + " --stdin --fingerprint " + m_fingerprint + NetworkArg();
    13-    const std::string stdinStr = "signtx \"" + EncodeBase64(ssTx.str()) + "\"";
    14+    const std::string stdinStr = "signtx " + EncodeBase64(ssTx.str());
    

    That’s probably for the better, but it’s important to manually test the HWI address verify and PSBT sign feature.

    For anyone testing with HWI, consider also testing #24313.

  37. hebasto force-pushed on Dec 14, 2023
  38. hebasto commented at 10:57 am on December 14, 2023: member

    Rebased and implemented @Sjors’s suggestions.

    Thank you @Sjors for testing!

  39. hebasto commented at 11:12 am on December 14, 2023: member

    For anyone testing with HWI, consider also testing #24313.

    Here is the combined 231130-replace-bp+pr24313 branch.

  40. DrahtBot removed the label Needs rebase on Dec 14, 2023
  41. DrahtBot added the label CI failed on Jan 16, 2024
  42. in build_msvc/bitcoin_config.h.in:44 in b67b6ab3b6 outdated
    40@@ -41,6 +41,9 @@
    41 /* Define this symbol to enable ZMQ functions */
    42 #define ENABLE_ZMQ 1
    43 
    44+/* define if external signer support is enabled (requires Boost::Process) */
    


    Sjors commented at 10:22 am on February 20, 2024:
    b67b6ab3b69d45034b17f4704a1f3cedb07e9af6: It does not? (requires Boost::Process)

    hebasto commented at 9:12 am on February 28, 2024:
    Not relevant since the recent update.
  43. Sjors commented at 1:31 pm on February 20, 2024: member

    tACK b67b6ab3b69d45034b17f4704a1f3cedb07e9af6

    Tested on macOS 14.2.1, Windows 11 Home (using cross compiled Guix build) and Ubuntu 23.10.

    I didn’t test Windows native. It might be worth splitting off the last commit to get this merged faster. I’m assuming it’s more important to get rid of boost process than it is to support native Windows builds.

    Commit f6a3b5ef643d4993f0ae3faa0c5ff1ae62ad71d8 which switches the external signer code to use cpp-subprocess looks correct.

    I perused the cpp-subprocess implementation. It seems well structured and documented, but I didn’t study it in great detail.

    Guix hashes:

     0ed62c504b8ba300d0e360593542226d23a72f89f8ff001fbecad56ef86c1a225  guix-build-b67b6ab3b69d/output/aarch64-linux-gnu/SHA256SUMS.part
     1dcc6a5b947c8a8394bf20c8ed227181532e7b146317bf28c0e44d8fa1367d1a2  guix-build-b67b6ab3b69d/output/aarch64-linux-gnu/bitcoin-b67b6ab3b69d-aarch64-linux-gnu-debug.tar.gz
     2fba2a71b5075029b038b3047db382e4f353004b7b43de98f83ff6882e635b977  guix-build-b67b6ab3b69d/output/aarch64-linux-gnu/bitcoin-b67b6ab3b69d-aarch64-linux-gnu.tar.gz
     3d634f4eeb5d640fccfaaa3e773f43ba10557a71539183fb465af1d2d25e60982  guix-build-b67b6ab3b69d/output/arm-linux-gnueabihf/SHA256SUMS.part
     49e3d0d439913581884eee878b5bc8bb170564888de64b58963247139bdbf7c2c  guix-build-b67b6ab3b69d/output/arm-linux-gnueabihf/bitcoin-b67b6ab3b69d-arm-linux-gnueabihf-debug.tar.gz
     566343b988d3eb57f3c2d07050bd5331933256a4651b34ff460096fab665c537f  guix-build-b67b6ab3b69d/output/arm-linux-gnueabihf/bitcoin-b67b6ab3b69d-arm-linux-gnueabihf.tar.gz
     6e08ed79e9fc6cac757815b243a4ceef063ac341eee2429058c7c8fd405061286  guix-build-b67b6ab3b69d/output/arm64-apple-darwin/SHA256SUMS.part
     7df21ea533af06af18b1c4740714d03cda0eecfda27c390ac757cea92517a9690  guix-build-b67b6ab3b69d/output/arm64-apple-darwin/bitcoin-b67b6ab3b69d-arm64-apple-darwin-unsigned.tar.gz
     854d61884c4c6b719463ced19e9fa4e224b3655b4cc90d768f63f5a9ac6f27163  guix-build-b67b6ab3b69d/output/arm64-apple-darwin/bitcoin-b67b6ab3b69d-arm64-apple-darwin-unsigned.zip
     99aa8688e1ac55a6384e931e6217ec890a4b241abfa7ad67ba2bdd46c88b7f8c9  guix-build-b67b6ab3b69d/output/arm64-apple-darwin/bitcoin-b67b6ab3b69d-arm64-apple-darwin.tar.gz
    103e8d01ddad51524c3fa8a4e5ab1ae6aff1813064d97cce1920c23d16dfbb5769  guix-build-b67b6ab3b69d/output/dist-archive/bitcoin-b67b6ab3b69d.tar.gz
    119cf279f28118da5fc995c97c8f463273ade38a9da7ca9a2bfcab755e1c08ac46  guix-build-b67b6ab3b69d/output/powerpc64-linux-gnu/SHA256SUMS.part
    1246d7ef9595cba43a1ce4772b060f0b360bccb5eea16180aeed74d5e8f3f4801a  guix-build-b67b6ab3b69d/output/powerpc64-linux-gnu/bitcoin-b67b6ab3b69d-powerpc64-linux-gnu-debug.tar.gz
    13c25331d7919b78c8820f23ad47b142a334fbfc51bac0dac385305feb09c03272  guix-build-b67b6ab3b69d/output/powerpc64-linux-gnu/bitcoin-b67b6ab3b69d-powerpc64-linux-gnu.tar.gz
    14df0d7a7ccc5c8ae08958f3b2fba7aa3e59ac6402959b4eafbf333d3e4566aad2  guix-build-b67b6ab3b69d/output/powerpc64le-linux-gnu/SHA256SUMS.part
    157dbf5c8e10f5b80805b7962ac79bb67feabd2d5deaa15a028a61181fc5d3e5d9  guix-build-b67b6ab3b69d/output/powerpc64le-linux-gnu/bitcoin-b67b6ab3b69d-powerpc64le-linux-gnu-debug.tar.gz
    1654969541c8ea83279d55bd3e31b2929257266bf6e8e4f985e59a29a2f513c44c  guix-build-b67b6ab3b69d/output/powerpc64le-linux-gnu/bitcoin-b67b6ab3b69d-powerpc64le-linux-gnu.tar.gz
    17331854be69ed4374aeae930840286e5fc090bf1e4535022b6d8226aa52b6e815  guix-build-b67b6ab3b69d/output/riscv64-linux-gnu/SHA256SUMS.part
    18d16dbf428e6443ba542f0d031cbde863b7dbb12795ab88264832a0e368415ff3  guix-build-b67b6ab3b69d/output/riscv64-linux-gnu/bitcoin-b67b6ab3b69d-riscv64-linux-gnu-debug.tar.gz
    1922676d48bbd363a2cd2e6390f0182c8eb9181ee4c4bd3d11565a0cbecec827cf  guix-build-b67b6ab3b69d/output/riscv64-linux-gnu/bitcoin-b67b6ab3b69d-riscv64-linux-gnu.tar.gz
    20ae3a2eaabc84ed05603403d922e61d7339af1c0392141bb42181cd2fd2449971  guix-build-b67b6ab3b69d/output/x86_64-apple-darwin/SHA256SUMS.part
    218e4e1f5adb4a6883907f79c5864d24e39d590de736345d3d6422d0675d50e60a  guix-build-b67b6ab3b69d/output/x86_64-apple-darwin/bitcoin-b67b6ab3b69d-x86_64-apple-darwin-unsigned.tar.gz
    224463c30865215881b2a9a91d3a844577e57985160a6e8f0f1407853354891132  guix-build-b67b6ab3b69d/output/x86_64-apple-darwin/bitcoin-b67b6ab3b69d-x86_64-apple-darwin-unsigned.zip
    235061a82bdcd43d4cc82b2b004c4d415bb6146be083384d6ef7fc26c5717ff49f  guix-build-b67b6ab3b69d/output/x86_64-apple-darwin/bitcoin-b67b6ab3b69d-x86_64-apple-darwin.tar.gz
    24ed378935976c4faeb84b37d16eff95ccb42877911e1e5894b7dc5c7f3a5fc15d  guix-build-b67b6ab3b69d/output/x86_64-linux-gnu/SHA256SUMS.part
    25c47db6b7abfe300f5545d0e0db1e202bd72c0e27e213601267e25fbfacf9a29c  guix-build-b67b6ab3b69d/output/x86_64-linux-gnu/bitcoin-b67b6ab3b69d-x86_64-linux-gnu-debug.tar.gz
    26a4941c606ecad6e0131fdb7c2785014f4edfcca9f9848add9702209bbbf42895  guix-build-b67b6ab3b69d/output/x86_64-linux-gnu/bitcoin-b67b6ab3b69d-x86_64-linux-gnu.tar.gz
    27d5bdc32703c9c42ef179e14581881db261c2164c0674b6ee0b1a842ac57ba0ba  guix-build-b67b6ab3b69d/output/x86_64-w64-mingw32/SHA256SUMS.part
    28fbbd9e65fe60ae69bd523043eaedcad09b282dde180775f0248e8f14f1f1867a  guix-build-b67b6ab3b69d/output/x86_64-w64-mingw32/bitcoin-b67b6ab3b69d-win64-debug.zip
    29fdadf9a1fa10fc1269ca5bcd1550f32c194b86f086b9d7a10a84c71bfd1ed8e8  guix-build-b67b6ab3b69d/output/x86_64-w64-mingw32/bitcoin-b67b6ab3b69d-win64-setup-unsigned.exe
    30013e27014e44607b46d4db6defedbf7aac3f3d3ee8da861be6509291d134dd34  guix-build-b67b6ab3b69d/output/x86_64-w64-mingw32/bitcoin-b67b6ab3b69d-win64-unsigned.tar.gz
    3177621aa403995bd958d8c9560bf7fe4852e945de739dbe94d993b6207966f444  guix-build-b67b6ab3b69d/output/x86_64-w64-mingw32/bitcoin-b67b6ab3b69d-win64.zip
    
  44. DrahtBot requested review from dergoegge on Feb 20, 2024
  45. DrahtBot requested review from fanquake on Feb 20, 2024
  46. DrahtBot requested review from TheCharlatan on Feb 20, 2024
  47. DrahtBot requested review from theStack on Feb 20, 2024
  48. Sjors approved
  49. theStack commented at 2:01 pm on February 27, 2024: contributor

    Nit: if you have to retouch, could update the commit hash reference in the first commit body (the last upstream patch https://github.com/arun11299/cpp-subprocess/pull/98 was merged a few weeks ago). Regarding the TODO in the same message, are there any more changes included here which would make sense to upstream? Comparing cpp-subprocess master branch with the version included here still shows some small differences:

     0--- /home/thestack/bitcoin/cpp-subprocess/subprocess.hpp	Tue Feb 27 14:46:14 2024
     1+++ ./src/util/subprocess.hpp	Tue Feb 27 14:41:21 2024
     2@@ -61,7 +61,7 @@
     3 
     4 extern "C" {
     5 #ifdef __USING_WINDOWS__
     6-  #include <Windows.h>
     7+  #include <windows.h>
     8   #include <io.h>
     9   #include <cwchar>
    10 
    11@@ -155,7 +155,7 @@
    12 //--------------------------------------------------------------------
    13 
    14 //Environment Variable types
    15-#ifndef _MSC_VER
    16+#ifndef __USING_WINDOWS__
    17 	using env_string_t = std::string;
    18 	using env_char_t = char;
    19 #else
    20@@ -184,7 +184,7 @@
    21     //
    22 
    23     if (force == false && argument.empty() == false &&
    24-        argument.find_first_of(L" \t\n\v\"") == argument.npos) {
    25+        argument.find_first_of(L" \t\n\v") == argument.npos) {
    26       command_line.append(argument);
    27     }
    28     else {
    29@@ -1057,6 +1057,7 @@
    30 public:
    31   Communication(Streams* stream): stream_(stream)
    32   {}
    33+  Communication(const Communication&) = default;
    34   void operator=(const Communication&) = delete;
    35 public:
    36   int send(const char* msg, size_t length);
    37@@ -1094,6 +1095,7 @@
    38 {
    39 public:
    40   Streams():comm_(this) {}
    41+  Streams(const Streams&) = default;
    42   void operator=(const Streams&) = delete;
    43 
    44 public:
    45@@ -1426,6 +1428,10 @@
    46 
    47 inline int Popen::poll() noexcept(false)
    48 {
    49+#ifndef __USING_WINDOWS__
    50+  if (!child_created_) return -1; // TODO: ??
    51+#endif
    52+
    53 #ifdef __USING_WINDOWS__
    54   int ret = WaitForSingleObject(process_handle_, 0);
    55   if (ret != WAIT_OBJECT_0) return -1;
    56@@ -1439,8 +1445,6 @@
    57 
    58   return retcode_;
    59 #else
    60-  if (!child_created_) return -1; // TODO: ??
    61-
    62   int status;
    63 
    64   // Returns zero if child is still running
    
  50. DrahtBot requested review from theStack on Feb 27, 2024
  51. hebasto force-pushed on Feb 28, 2024
  52. hebasto commented at 9:11 am on February 28, 2024: member

    @Sjors

    I didn’t test Windows native. It might be worth splitting off the last commit to get this merged faster. I’m assuming it’s more important to get rid of boost process than it is to support native Windows builds.

    I’ve reworked this PR to remove all Windows-specific changes. Any remaining Windows-related modifications will be addressed in follow-ups. @theStack

    Nit: if you have to retouch, could update the commit hash reference in the first commit body (the last upstream patch arun11299/cpp-subprocess#98 was merged a few weeks ago). Regarding the TODO in the same message, are there any more changes included here which would make sense to upstream? Comparing cpp-subprocess master branch with the version included here still shows some small differences:

    I’ve reworked this PR to remove all Windows-specific changes. Therefore, diffs you mentioned are not needed in this PR. However, I’ll continue to work on submitting Windows-related fixes to the upstream. @fanquake

    Concept ACK on removing Boost Process. Is the plan to also delete any unused code from this header? I don’t think copy-pasting dead/untested code into this repository is a good idea, and only serves to complicate review, and potentially cause issues in future (it maybe already doesn’t work with c++20?)

    I’ve removed the entire “Convenience Functions” section. While other removals, such as unused API overloads, are still possible, I’ve opted to keep them for now to facilitate the reviewing process.


    This PR is based on #29489 now, so please review it first :)

  53. DrahtBot removed the label CI failed on Feb 28, 2024
  54. fanquake referenced this in commit dfbad09c60 on Feb 28, 2024
  55. Sjors commented at 9:05 am on February 29, 2024: member
    #29489 was merged, please rebase :-)
  56. hebasto force-pushed on Feb 29, 2024
  57. hebasto commented at 10:12 am on February 29, 2024: member

    #29489 was merged, please rebase :-)

    Rebased :)

  58. Sjors commented at 2:12 pm on March 5, 2024: member

    re-ACK 86e1f24f20335f9790db95f253c8f493a7f63983

    Mainly just drops windows support since my last review. I briefly re-tested on Ubuntu.

  59. theStack referenced this in commit cf78210018 on Mar 5, 2024
  60. theStack approved
  61. theStack commented at 6:19 pm on March 5, 2024: contributor

    Light ACK 86e1f24f20335f9790db95f253c8f493a7f63983

    Didn’t review any of the code in cpp-subprocess, but the library seems to do its job at least on POSIX systems (tested on OpenBSD 7.4 and Ubuntu 22.04.3 LTS).

    I checked for remaining boost::process leftovers/references via git grep -i boost.*process and found a depends patch that can likely also be removed: https://github.com/theStack/bitcoin/commit/cf78210018ad1ea83b5b035c15949045fc69c583 (it’s the only depends patch for boost)

  62. achow101 commented at 9:53 pm on March 21, 2024: member

    ACK 86e1f24f20335f9790db95f253c8f493a7f63983

    Briefly tested on Arch, and it works. The changes to our code are straightforward and just modifying to use the new API. I looked at cpp-subprocess itself, and there definitely is a lot of code that we don’t use that could be pruned in a followup. For unix systems, it indeed does the expected fork-exec. I did not look at the Windows specific code as that is currently unused. @TheCharlatan @fanquake @dergoegge Since you Concept ACK’d, would you mind also giving this a review?

  63. DrahtBot added the label Needs rebase on Mar 27, 2024
  64. Add `cpp-subprocess` header-only library
    Upstream repo: https://github.com/arun11299/cpp-subprocess
    Commit: 4025693decacaceb9420efedbf4967a04cb028e7
    
    The "Convenience Functions" section is unused in our codebase, so it has
    been removed.
    cc8b9875b1
  65. external_signer: replace boost::process with cpp-subprocess
    This primarily affects the `RunCommandParseJSON` utility function.
    70434b1c44
  66. build: remove boost::process dependency for building external signer support d5a715536e
  67. hebasto force-pushed on Mar 27, 2024
  68. hebasto commented at 2:19 pm on March 27, 2024: member
    Rebased due to the conflict with the merged #29479. @Sjors @theStack @achow101 sorry for invalidating your acks :)
  69. DrahtBot removed the label Needs rebase on Mar 27, 2024
  70. achow101 commented at 9:47 pm on March 27, 2024: member

    reACK d5a715536e497c160a2520f81334aab6c7490213

    Checked diff is just for resolving rebase conflicts.

  71. DrahtBot requested review from Sjors on Mar 27, 2024
  72. DrahtBot requested review from theStack on Mar 27, 2024
  73. theStack approved
  74. theStack commented at 0:02 am on March 28, 2024: contributor

    Light re-ACK d5a715536e497c160a2520f81334aab6c7490213

    (as per git range-diff 86e1f24...d5a7155)

  75. theStack referenced this in commit fa679c16dd on Mar 28, 2024
  76. Sjors commented at 10:30 am on April 2, 2024: member

    re-tACK d5a715536e497c160a2520f81334aab6c7490213

    Tested display address from the GUI on a Trezor on Ubuntu.

  77. fanquake approved
  78. fanquake commented at 9:57 am on April 10, 2024: member

    ACK d5a715536e497c160a2520f81334aab6c7490213 - with the expectation that this code is going to be maintained as our own. Next PRs should:

    • Remove linter exclusions and fix all issues.
    • Delete all unused code.
    • Rewrite in C++20.
    • hpp -> cpp ?
  79. fanquake merged this on Apr 10, 2024
  80. fanquake closed this on Apr 10, 2024

  81. theStack referenced this in commit 95c594f4e9 on Apr 10, 2024
  82. hebasto deleted the branch on Apr 10, 2024
  83. fanquake referenced this in commit 3f6a6da3b0 on Apr 10, 2024
  84. fanquake referenced this in commit 0de63b8b46 on Apr 11, 2024
  85. Pttn referenced this in commit 1c4f079760 on Apr 13, 2024
  86. hebasto referenced this in commit ea7e4a2e87 on Apr 18, 2024
  87. hebasto referenced this in commit b8fd28543e on Apr 18, 2024
  88. hebasto commented at 1:27 pm on April 23, 2024: member

    … with the expectation that this code is going to be maintained as our own. Next PRs should:

    • Remove linter exclusions and fix all issues.

    See:

    • Delete all unused code.

    The work has been started in #29865.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-16 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me