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
Replace Boost.Process with cpp-subprocess #28981
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
Concept ACK |
10d8cd4
to
7d3770b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the compile error is due to subprocess requiring C++17 and not allowing C++20 (or later)?
test/lint/lint-spelling.py
Outdated
@@ -12,7 +12,7 @@ | |||
from subprocess import check_output, STDOUT, CalledProcessError | |||
|
|||
IGNORE_WORDS_FILE = 'test/lint/spelling.ignore-words.txt' | |||
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"] | |||
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"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Could split this into one-per-line to avoid overly long lines, diffs and reduce merge conflicts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably easier to just fix the typos, then add more things for linters to exclude? No new ones should be introduced.
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?) |
7d3770b
to
5d75b4a
Compare
Concept ACK, thanks for picking this up. |
I haven't consider it yet.
CI jobs that uses C++20 are passing so far. |
If at all possible, I'd prefer for it to be subtreed, so that updating to newer upstream versions is easy. |
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. |
Note that the last version from upstream was nearly 4 years ago: https://github.com/arun11299/cpp-subprocess/releases/tag/v2.0. |
Maybe a subtree from our own fork? (to avoid bringing testing stuff to the main repo) |
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. |
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), |
5d75b4a
to
8f34186
Compare
I switched to the @theStack Here are the Windows functional tests -- https://github.com/hebasto/bitcoin/actions/runs/7072075125/job/19250502576 |
8f34186
to
afacd92
Compare
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 |
To support the string-based approach, let's consider
and reproducing it using Python's subprocess module, which interface is mimicked in cpp-subprocess: >>> import subprocess
>>> subprocess.run("cmd.exe /c echo {\"success\": true}")
{"success": true}
CompletedProcess(args='cmd.exe /c echo {"success": true}', returncode=0) It becomes intricate when using a list of strings: >>> subprocess.run(["cmd.exe", "/c", "echo", "{\"success\": true}"])
"{\"success\": true}" or >>> subprocess.run(["cmd.exe", "/c", "echo", "{\"success\":", "true}"])
{\"success\": true} or >>> subprocess.run(['cmd.exe', '/c', 'echo', '{"success":', 'true}'])
{\"success\": true} |
Upstream repo: https://github.com/arun11299/cpp-subprocess Commit: 4025693decacaceb9420efedbf4967a04cb028e7 The "Convenience Functions" section is unused in our codebase, so it has been removed.
This primarily affects the `RunCommandParseJSON` utility function.
86e1f24
to
d5a7155
Compare
reACK d5a7155 Checked diff is just for resolving rebase conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Light re-ACK d5a7155
(as per git range-diff 86e1f24...d5a7155
)
As Boost::Process has been replaced by cpp-subprocess (PR bitcoin#28981), this patch touches an unused code part and is hence not needed anymore.
re-tACK d5a7155 Tested display address from the GUI on a Trezor on Ubuntu. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK d5a7155 - 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 ?
As Boost::Process has been replaced by cpp-subprocess (PR bitcoin#28981), this patch touches an unused code part and is hence not needed anymore.
95c594f depends: remove no longer needed patch for Boost::Process (Sebastian Falbesoner) Pull request description: As Boost::Process has been replaced by cpp-subprocess (PR #28981), this patch touches an unused code part and is hence not needed anymore. ACKs for top commit: hebasto: ACK 95c594f, I have reviewed the code and it looks OK. fanquake: ACK 95c594f Tree-SHA512: 0309b826f8c260e4180624f17302e51329fc4bd7a5431997d6d27d468dd5f7dbcd9db6a742efaba33ba30dbe361830eb1446fdbec927505ccf42412f9211934e
13f5391 Fix typos in `subprocess.hpp` (Hennadii Stepanov) Pull request description: Resolves one item in the #28981 (review): > - Remove linter exclusions and fix all issues. Based on upstream arun11299/cpp-subprocess#101. ACKs for top commit: fanquake: ACK 13f5391 Tree-SHA512: 2ee27a5b7d1ba6f47a5148add155c918eadaaffb94a4b5dd3edea00e63440b87291c559361bf25a8db1567debff78cf7e9466dc34f14331ca1d426994837df93
# Conflicts: # test/lint/lint-includes.py # test/lint/lint-spelling.py
Backport changes from bitcoin#28981.
Backport changes from bitcoin#28981.
See:
The work has been started in #29865. |
b8fd285 fixup! cmake: Add external signer support (Hennadii Stepanov) Pull request description: This PR ports changes from bitcoin#28981. ACKs for top commit: laanwj: Code review ACK b8fd285 Tree-SHA512: 338f0c8b4c94e2c706658c6b2f1306de8b6d9836dcebcefe7b81cd79d5dabf471b03afc597047a42351fda72b6c9ec2828b02c177f03df0011d3b801addda1bf
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.