RFC including boost-process #15440

issue Sjors openend this issue on February 19, 2019
  1. Sjors commented at 12:55 pm on February 19, 2019: member

    #15382 and #15421 both need to execute commands, monitor their process and/or consume their stdout. At the moment they both add boost-process.

    There is also an alternative cpp-subprocess which has less code, but probably also less review and doesn’t work with Windows yet.

    We currently ship Boost 1.64 so the corresponding boost-process code is here.

    Usage wise it’s super simple.

    The code is spread over at least a hundred small files, which makes it hard to understand the whole, although I’m it makes sense to someone more familiar with Boost. Each component seems well documented. I’m not sure how to go about reviewing this.

    It includes the following other Boost components, outside of what we already directly include:

     0#include <boost/algorithm/string/case_conv.hpp>
     1#include <boost/algorithm/string/join.hpp>
     2#include <boost/algorithm/string/predicate.hpp>
     3#include <boost/algorithm/string/trim.hpp>
     4#include <boost/asio/async_result.hpp>
     5#include <boost/asio/buffer.hpp>
     6#include <boost/asio/dispatch.hpp>
     7#include <boost/asio/io_context.hpp>
     8#include <boost/asio/posix/stream_descriptor.hpp>
     9#include <boost/asio/post.hpp>
    10#include <boost/asio/read.hpp>
    11#include <boost/asio/signal_set.hpp>
    12#include <boost/asio/strand.hpp>
    13#include <boost/asio/streambuf.hpp>
    14#include <boost/asio/windows/object_handle.hpp>
    15#include <boost/asio/windows/stream_handle.hpp>
    16#include <boost/asio/write.hpp>
    17#include <boost/config.hpp>
    18#include <boost/core/ignore_unused.hpp>
    19#include <boost/filesystem/operations.hpp>
    20#include <boost/filesystem/path.hpp>
    21#include <boost/fusion/adapted/std_tuple.hpp>
    22#include <boost/fusion/algorithm/iteration/for_each.hpp>
    23#include <boost/fusion/algorithm/query/find_if.hpp>
    24#include <boost/fusion/algorithm/transformation/filter_if.hpp>
    25#include <boost/fusion/algorithm/transformation/transform.hpp>
    26#include <boost/fusion/container.hpp>
    27#include <boost/fusion/container/set/convert.hpp>
    28#include <boost/fusion/container/vector/convert.hpp>
    29#include <boost/fusion/iterator/deref.hpp>
    30#include <boost/fusion/sequence.hpp>
    31#include <boost/fusion/sequence/comparison/equal_to.hpp>
    32#include <boost/fusion/sequence/intrinsic/begin.hpp>
    33#include <boost/fusion/sequence/intrinsic/end.hpp>
    34#include <boost/fusion/sequence/intrinsic/has_key.hpp>
    35#include <boost/fusion/tuple.hpp>
    36#include <boost/fusion/view.hpp>
    37#include <boost/fusion/view/transform_view.hpp>
    38#include <boost/iterator/transform_iterator.hpp>
    39#include <boost/move/move.hpp>
    40#include <boost/none.hpp>
    41#include <boost/system/api_config.hpp>
    42#include <boost/system/error_code.hpp>
    43#include <boost/tokenizer.hpp>
    44#include <boost/type_index.hpp>
    45#include <boost/winapi/access_rights.hpp>
    46#include <boost/winapi/basic_types.hpp>
    47#include <boost/winapi/character_code_conversion.hpp>
    48#include <boost/winapi/config.hpp>
    49#include <boost/winapi/dll.hpp>
    50#include <boost/winapi/environment.hpp>
    51#include <boost/winapi/error_codes.hpp>
    52#include <boost/winapi/file_management.hpp>
    53#include <boost/winapi/get_current_process.hpp>
    54#include <boost/winapi/get_current_process_id.hpp>
    55#include <boost/winapi/get_last_error.hpp>
    56#include <boost/winapi/get_system_directory.hpp>
    57#include <boost/winapi/handle_info.hpp>
    58#include <boost/winapi/handles.hpp>
    59#include <boost/winapi/jobs.hpp>
    60#include <boost/winapi/overlapped.hpp>
    61#include <boost/winapi/pipes.hpp>
    62#include <boost/winapi/process.hpp>
    63#include <boost/winapi/shell.hpp>
    64#include <boost/winapi/show_window.hpp>
    65#include <boost/winapi/synchronization.hpp>
    66#include <boost/winapi/wait.hpp>
    

    I’m not sure which of those we’re already indirectly using.

    I found the following includes, outside of what we already directly include:

    0#include <features.h>
    1#include <initializer_list>
    2#include <io.h>
    3#include <iosfwd>
    4#include <istream>
    5#include <ostream>
    6#include <streambuf>
    7#include <system_error>
    

    The lists were composed with grep -rhw . -e '#include' --include=\*.{h,cpp,hpp} | sort | uniq and comm -23 boost bitcoin.

  2. fanquake added the label Brainstorming on Feb 19, 2019
  3. fanquake added the label Build system on Feb 19, 2019
  4. practicalswift commented at 8:10 pm on February 22, 2019: contributor

    @Sjors Assuming the need is limited to running a process, wait for it to complete and capture the output then the number of lines needed to implement a project local general function for that is likely less than the number of includes listed above? :-)

    I think such a function would be much easier to reason about and thus review than the alternatives :-)

  5. Sjors commented at 8:11 am on February 23, 2019: member

    @practicalswift you’d think so, right? :-)

    That’s indeed exactly what we need. Plus using std::in to pass in transactions that are too long to pass by argument. And it has to work on Windows.

  6. luke-jr commented at 12:21 pm on March 6, 2019: member
    As previously discussed, it should be an optional dependency initially, and a “second step” might be to use a bundled copy when the system boost is too old.
  7. promag commented at 1:08 am on March 13, 2019: member
  8. meshcollider referenced this in commit e4df534c60 on Aug 5, 2020
  9. sidhujag referenced this in commit 06bceb01d7 on Aug 5, 2020
  10. Sjors commented at 12:26 pm on January 6, 2021: member
    The has been done in #15382
  11. Sjors closed this on Jan 6, 2021

  12. DrahtBot locked this on Aug 18, 2022

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-09-29 01:12 UTC

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