Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reintroduce external signer support for Windows #29868

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Apr 14, 2024

Based on upstream arun11299/cpp-subprocess#99.

Partially reverts:

After this PR, we can proceed to actually remove the unused code from src/util/subprocess.hpp.

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 14, 2024

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
Concept ACK theStack

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:

  • #30049 (build, test, doc: Temporarily remove Android-related stuff by hebasto)

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.

@fanquake
Copy link
Member

There are no conflicts with #29865.

Looks like there are now?

@hebasto
Copy link
Member Author

hebasto commented Apr 18, 2024

There are no conflicts with #29865.

Looks like there are now?

Well, there is a conflict in the code, which is being removed in #29865. It won't be a problem for either PR if the other one goes first.

@hebasto
Copy link
Member Author

hebasto commented Apr 23, 2024

Rebased.

@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the
documentation.

Possibly this is due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.

Leave a comment here, if you need help tracking down a confusing failure.

Debug: https://github.com/bitcoin/bitcoin/runs/24165845040

@hebasto
Copy link
Member Author

hebasto commented Apr 24, 2024

Rebased on top of the merged #29910.

@@ -1012,7 +1008,7 @@ class Popen
/*
~Popen()
{
#ifdef __USING_WINDOWS__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#29961 removes this, that's the only conflict I found.

@Sjors
Copy link
Member

Sjors commented Apr 26, 2024

Tested the Guix build on Windows 11.

Code changes look reasonable, but Windows stuff is not my expertise...

@hebasto
Copy link
Member Author

hebasto commented Apr 28, 2024

Rebased to resolve conflicts with the merged #29774.

@hebasto
Copy link
Member Author

hebasto commented Apr 28, 2024

cc @achow101 @theStack

Code changes look reasonable, but Windows stuff is not my expertise...

cc @sipsorcery :)

@theStack
Copy link
Contributor

Concept ACK

// https://www.winehq.org/pipermail/wine-devel/2008-September/069387.html
auto hntdll = GetModuleHandleA("ntdll.dll");
assert(hntdll);
const bool wine_runtime = GetProcAddress(hntdll, "wine_get_version");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check will fail on Windows. I'm guessing that's expected but just checking?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal is to detect that binaries, which are cross-compiled for Windows, are running in Wine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean this PR is intended to be a fix for Windows or for wine?

Copy link
Member Author

@hebasto hebasto May 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For both. Wine is used to run test suite on Linux after cross-compiling for Windows. This need roots from the fact that Wine and Windows runtimes produce different error messages:

const std::string expected{wine_runtime ? "File not found." : "File Not Found"};

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, the same behaviour was before #29489.

@hebasto
Copy link
Member Author

hebasto commented May 2, 2024

Rebased on top of the merged #29961.

@Sjors
Copy link
Member

Sjors commented May 6, 2024

Briefly retested 83c6332 which still works.

@hebasto
Copy link
Member Author

hebasto commented May 7, 2024

Rebased due to the conflict with merged #29494.

@DrahtBot
Copy link
Contributor

DrahtBot commented May 7, 2024

🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the
documentation.

Possibly this is due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.

Leave a comment here, if you need help tracking down a confusing failure.

Debug: https://github.com/bitcoin/bitcoin/runs/24699627882

@fanquake
Copy link
Member

fanquake commented May 8, 2024

https://github.com/bitcoin/bitcoin/pull/29868/checks?check_run_id=24699627882:

In file included from common/run_command.cpp:13:
./util/subprocess.h: In member function ‘int subprocess::Popen::wait()’:
./util/subprocess.h:1062:7: error: unused variable ‘ret’ [-Werror=unused-variable]
 1062 |   int ret = WaitForSingleObject(process_handle_, INFINITE);
      |       ^~~

@Sjors
Copy link
Member

Sjors commented May 9, 2024

I assume you added b69b9e8 because it no longer uses an external dependency?

Is there something you can remove from cpp-subprocess based on your comment? #29961 (comment)

@fanquake
Copy link
Member

fanquake commented May 9, 2024

I assume you added b69b9e8 because it no longer uses an external dependency?

It's there because setting something that is already on, to on, is pointless, and doesn't test anything. In either case, external signer is also not special, so it's not clear why, as a feature, it's being explcitly enabled in the global CI config.

@hebasto
Copy link
Member Author

hebasto commented May 9, 2024

@Sjors

Is there something you can remove from cpp-subprocess based on your comment? #29961 (comment)

Popen::poll() and Popen::pid() might go.

@hebasto
Copy link
Member Author

hebasto commented May 9, 2024

In either case, external signer is also not special...

At some point, we might want to get rid of the #ifdef ENABLE_EXTERNAL_SIGNER all together.

fanquake added a commit that referenced this pull request May 11, 2024
5a11d30 refactor, subprocess: Remove unused stream API calls (Hennadii Stepanov)
05b6f87 refactor, subprocess: Remove unused `Popen::child_created_` data member (Hennadii Stepanov)
9e1ccf5 refactor, subprocess: Remove unused `Popen::poll()` (Hennadii Stepanov)
24b53fc refactor, subprocess: Remove `Popen::pid()` (Hennadii Stepanov)

Pull request description:

  This PR continues #29961.

  Please note that `Popen::poll()` is not required for #29868 anymore.

ACKs for top commit:
  theuni:
    Easy code review ACK 5a11d30 since it's all removals :)
  theStack:
    Code-review ACK 5a11d30

Tree-SHA512: 11f984f8384c337782d058afa80011e88087a1b5a3ed6e4678d492e6c232b706a26312463c5dd8c529aa477497c8afca9f54574e0e36e3edd5675bd5d8424bbb
@hebasto
Copy link
Member Author

hebasto commented May 11, 2024

Rebased due to the conflict with merged #30081.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

7 participants