Skip to content

fix BOOST_PROCESS_V2_DISABLE_SIGNALSET for the signal handle - #569

Open
kislinsk wants to merge 1 commit into
boostorg:developfrom
kislinsk:fix-disable-signalset
Open

kislinsk wants to merge 1 commit into
boostorg:developfrom
kislinsk:fix-disable-signalset

Conversation

@kislinsk

Copy link
Copy Markdown

Fixes #568.

With BOOST_PROCESS_V2_DISABLE_SIGNALSET, the #else branch of async_wait_op_ in process_handle_signal.hpp now has the same members as the signal set branch and completes through operator()(Self&&, error_code) with operation_not_supported, as process_handle_fd_or_signal.hpp does. wait(), running() and terminate() keep working through waitpid.

New test test/v2/disable_signalset.cpp: wait() returns the exit code, and async_wait() completes with operation_not_supported on the signal handle and normally on all other handles. On Linux it also runs with BOOST_PROCESS_V2_DISABLE_PIDFD_OPEN, which selects the signal handle, so Linux CI covers it.

Tested with b2 in a Boost 1.92.0 tree with this branch as libs/process:

  • Ubuntu 26.04, GCC 15: disable_signalset, disable_signalset_no_pidfd and process pass. Without the fix, disable_signalset_no_pidfd fails to compile.
  • macOS 15, Apple clang 17, C++11: disable_signalset and process pass.

The CMake registration follows boost_process_v2_test_with_target, which links boost_process_v2_test_impl, a target removed in 01c9a5b. So on develop the CMake test build fails for every test with a target, this one included. That is not addressed here.

Since 31d6b5c ("process_handle.async_wait accepts ref to exit_code"),
basic_process_handle_signal::async_wait() initializes async_wait_op_
with {signal_set_, pid_, exit_code}, and the operation completes through
operator()(Self&&, error_code). The #else branch for
BOOST_PROCESS_V2_DISABLE_SIGNALSET was not adapted: it still has two
members and dispatches the old (exit_code, ec) completion. Because the
initializer appears in the trailing return type of async_wait(), every
use of basic_process with the signal handle fails to compile, e.g.

  error: too many initializers for '...::async_wait_op_'

This affects macOS, the BSDs without pdfork, and Linux with
BOOST_PROCESS_V2_DISABLE_PIDFD_OPEN, in every release that has the
option (1.89 to 1.92).

The branch now has the same members as the signal set branch and
completes with operation_not_supported, as intended when the option
was added and as basic_process_handle_fd_or_signal does.

The new test disable_signalset builds with the option. On Linux it
also runs with BOOST_PROCESS_V2_DISABLE_PIDFD_OPEN, which selects the
signal handle, so CI covers it.

Closes boostorg#568.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v2: BOOST_PROCESS_V2_DISABLE_SIGNALSET does not compile with the signal-based process handle

1 participant