Skip to content

Check required interfaces before generating manpages - #33828

Closed
151henry151 wants to merge 1 commit into
bitcoin:masterfrom
151henry151:gen-manpages-checks
Closed

151henry151 wants to merge 1 commit into
bitcoin:masterfrom
151henry151:gen-manpages-checks

Conversation

@151henry151

@151henry151 151henry151 commented Nov 8, 2025 •

Copy link
Copy Markdown
Contributor

Guard manpage generation by reading bitcoin-build-config.h and exiting if HAVE_SYSTEM, ENABLE_WALLET, or WITH_ZMQ are off, and provide a short hint so contributors rebuild with the right flags instead of committing incomplete manpages.

Fixes #17506

Override by using the SKIP_BUILD_OPTIONS_CHECK environment variable if you really need a custom-fit manpage (see #29457 (comment)).

@DrahtBot

DrahtBot commented Nov 8, 2025 •

Copy link
Copy Markdown
Contributor

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

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33828.

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
Concept ACK sedited
Stale ACK maflcko

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

No conflicts as of last run.

@151henry151
151henry151 force-pushed the gen-manpages-checks branch 2 times, most recently from abda94f to a212ec6 Compare November 8, 2025 22:35
@fanquake

Copy link
Copy Markdown
Member

This duplicates #33085. If the author doesn't follow up there shortly, we could reopen here.

@fanquake fanquake closed this Nov 10, 2025
@151henry151

151henry151 commented Nov 11, 2025 •

Copy link
Copy Markdown
Contributor Author

Thanks for taking a look, fanquake.

I noticed #33085 had gone quiet for a little over three weeks with the review concerns still open, so I put this together.

In #33085 the script pulls component flags from test/config.ini (adding checks for CLI, chainstate, fuzz, USDT tracepoints, etc.), but that file only exists when tests are configured and most of those toggles don’t affect the manpages. This branch reads CMakeCache.txt, the authoritative record of the configuration, and only verifies the interfaces that actually change the generated help text.

#33085 adds a new --skip-build-options-check flag, whereas this keeps using the existing SKIP_BUILD_OPTIONS_CHECK environment override so the command-line surface stays the same. The error messaging here points directly at the missing CMake options and explains how to bypass the guard, which lines up with the release-process docs, and the helper functions make the new logic reusable instead of nesting more ad-hoc parsing in the main flow.

I appreciate the work Brandon already put in to #33085 and I looked his code over thoroughly before tackling this, but I thought this solution was more elegant and would be preferred. Wanting to follow proper etiquette, perhaps I should have commented my suggestions on his PR instead of opening my own?

@151henry151

Copy link
Copy Markdown
Contributor Author

This duplicates #33085. If the author doesn't follow up there shortly, we could reopen here.

It's been a few weeks, would it be appropriate to reopen here? I did try to reach out to @BrandonOdiwuor on the comments of #33085 and haven't heard back from him yet.

@151henry151

Copy link
Copy Markdown
Contributor Author

Hi @fanquake, checking in on the status of #33085. If it's no longer moving forward, would it be possible to reopen this PR? Happy to adjust anything if needed. Thanks!

@fanquake

Copy link
Copy Markdown
Member

I've closed #33085 given the lack of followup.

@fanquake fanquake reopened this Jan 11, 2026
Comment thread contrib/devtools/gen-manpages.py Resolved
@fanquake fanquake mentioned this pull request Jan 13, 2026
Closed
@151henry151
151henry151 requested a review from maflcko January 15, 2026 17:22
Comment thread contrib/devtools/gen-manpages.py Resolved
Comment thread contrib/devtools/gen-manpages.py Resolved
@151henry151

Copy link
Copy Markdown
Contributor Author

@maflcko you said --ignore-warnings, but I used --skip-build-options-check since we're skipping checks, not ignoring warnings. Should I change it to --ignore-warnings?

I switched HAVE_SYSTEM and ENABLE_WALLET to read from bitcoin-build-config.h. WITH_ZMQ isn't in the header, so I'm still parsing CMakeCache.txt for it. Is that expected?

@maflcko

maflcko commented Jan 20, 2026

Copy link
Copy Markdown
Member

WITH_ZMQ isn't in the header, so I'm still parsing CMakeCache.txt for it. Is that expected?

It is called ENABLE_ZMQ. You can read the header, to see the contents of it.

@DrahtBot

Copy link
Copy Markdown
Contributor

🚧 At least one of the CI tasks failed.
Task lint: https://github.com/bitcoin/bitcoin/actions/runs/21181549467/job/60924930617
LLM reason (✨ experimental): Python linting failed (ruff) due to trailing/blank-line whitespace issues and other fixable ruff errors in the Python code.

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly 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.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

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

@151henry151

Copy link
Copy Markdown
Contributor Author

Thanks for the review and feedback @maflcko , I think I've implemented your suggested changes correctly.

@maflcko

maflcko commented Jan 20, 2026

Copy link
Copy Markdown
Member

WITH_ZMQ isn't in the header, so I'm still parsing CMakeCache.txt for it. Is that expected?

It is called ENABLE_ZMQ. You can read the header, to see the contents of it.

Sorry, i was wrong. This is actually a compile definition. So I guess either the cmake parsing is required, or it has to be made a define in the build header.

@151henry151

151henry151 commented Jan 20, 2026 •

Copy link
Copy Markdown
Contributor Author

... either the cmake parsing is required, or it has to be made a define in the build header.

So either we need to keep parsing CMakeCache.txt for WITH_ZMQ, or ENABLE_ZMQ needs to be added to the build header. Do you have a preference between these two approaches? I would lean towards adding it to the build header, since it's simpler and more direct than parsing the CMake cache format. I've implemented that in f9ad5f0

@maflcko

maflcko commented Jan 20, 2026

Copy link
Copy Markdown
Member

i am not a build system expert, but i don't think compile definitions and build header defines should be mixed for the same symbol.

@maflcko

maflcko commented Jan 20, 2026 •

Copy link
Copy Markdown
Member

Also, this doesn't compile (please test locally before pushing)

Edit: As for a preference, I'd say it is probably easiest in this context to just read the cmake cache file.

@151henry151

Copy link
Copy Markdown
Contributor Author

I believe the current commit 442346a follows your suggestions, using header checks for HAVE_SYSTEM and ENABLE_WALLET, and still checking CMakeCache.txt for WITH_ZMQ.

Frankly, I prefer the code of 2a226ae which intentionally used the existing SKIP_BUILD_OPTIONS_CHECK env var to keep the CLI unchanged, and checked all three interfaces against CMakeCache.txt as the single source of truth. It just seems more elegant to me.

Can you clarify the suggestion to use a single argument like --ignore-warnings? I don't see an existing --ignore-warnings option in the script. I added the argument --skip-build-options-check, but wasn't sure if maybe the --ignore-warnings option exists elsewhere and should also skip build options checks?
Thanks again for all the feedback.

@maflcko

maflcko commented Jan 21, 2026

Copy link
Copy Markdown
Member

Yeah, it seems better to just read one file instead of two. I haven't tested this, but the initial code looks plausible

lgtm ACK 2a226ae02c1556a8626da823ccde3ba3c89e9a73

@maflcko

maflcko commented Jan 22, 2026

Copy link
Copy Markdown
Member

You'll have to push that commit, though

@maflcko

maflcko commented Jan 22, 2026

Copy link
Copy Markdown
Member

lgtm ACK 19453292cff54e768b5138236bfffb5706f54f36

I haven't tested this, but the initial code looks plausible

@fanquake

Copy link
Copy Markdown
Member

HAVE_SYSTEM is never present in CMakeCache.txt, so I don't see how this could work. Can you at least test your changes locally before pushing them to GitHub.

@maflcko

maflcko commented Jan 23, 2026

Copy link
Copy Markdown
Member

@151henry151 Is this LLM generated?

There is little value in doing that, because it is just adding extra hops and wastes time.

At least for this software project, the pull request author is expected to have a rock solid understanding of their own changes they are proposing. Failure of the pull request author to understand their own changes will lead to subtle missed bugs, or tedious review cycles to uncover and fix them.

For example, when I asked if the ZMQ build option can be parsed from the header (#33828 (comment)), you should have replied that it isn't present in the header, and thus the check will fail. Ideally with exact steps to reproduce, or the failure output.

Given that HAVE_SYSTEM is never in the cmake cache, no version of the code ever pushed here will pass.

This means you never even tried to run any of this yourself, to confirm that it works?

This looks like purely LLM generated ai slop to me, just like #33254 (comment) and #33926 (review)

@151henry151

151henry151 commented Jan 23, 2026 •

Copy link
Copy Markdown
Contributor Author

I think I understand why my local testing failed to catch this; I was explicitly setting HAVE_SYSTEM=1 and HAVE_SYSTEM=0 at the command line which puts them in the cmake cache.

When I'm back at my laptop I'll take a closer look at this. I would guess that it's going to be preferable to read the header file, but we'll have to add the ZMQ define to the build header. [edit: if we want to avoid reading two separate files and have a single source of information for this check]

And yes, I wrote and understand the code of this pull request and it was not LLM generated. I can understand your questioning that in the context of my misunderstandings and mistakes here, but would appreciate it if you will continue to take the time to review my work; I'm learning.

Thanks

@151henry151

151henry151 commented Jan 23, 2026 •

Copy link
Copy Markdown
Contributor Author

I'm on lunch break from work now, so have a moment at my computer to share for reference how I was testing this locally:


BUILDDIR="${BUILDDIR:-build}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"

echo "Test 1: All features ON"
cd "$BUILDDIR"
cmake .. -DHAVE_SYSTEM=1 -DWITH_ZMQ=ON -DENABLE_WALLET=ON >/dev/null 2>&1
cd "$SCRIPT_DIR"

output=$(python3 contrib/devtools/gen-manpages.py 2>&1) || true
if echo "$output" | grep -q "ERROR"; then
    echo "FAIL: Script failed with features ON"
    echo "$output" | grep -A5 "ERROR"
    exit 1
fi
echo "PASS: Script passed with all features ON"

echo ""
echo "Test 2: All features OFF"
cd "$BUILDDIR"
cmake .. -DHAVE_SYSTEM=0 -DWITH_ZMQ=OFF -DENABLE_WALLET=OFF >/dev/null 2>&1
cd "$SCRIPT_DIR"

output=$(python3 contrib/devtools/gen-manpages.py 2>&1) || true
if echo "$output" | grep -q "HAVE_SYSTEM\|ENABLE_WALLET\|WITH_ZMQ"; then
    echo "PASS: Script detected missing features"
else
    echo "FAIL: Script should have detected missing features"
    exit 1
fi

echo ""
echo "All tests passed" 

I will continue working on this when I get home this evening. Thanks again for your time and effort, I know reviewing slop is taking up a lot of time for bitcoin maintainers and I want to be of value to the project, not a drag on it.

@151henry151

Copy link
Copy Markdown
Contributor Author

@maflcko @fanquake I believe bd7c049 addresses the issue. The script now reads all three features (HAVE_SYSTEM, ENABLE_WALLET, and WITH_ZMQ) from bitcoin-build-config.h as the single source of truth, which resolves the problem that HAVE_SYSTEM is not typically present in CMakeCache.txt. I added #cmakedefine WITH_ZMQ 1 to the header template, which references the existing CMake option WITH_ZMQ (defined in CMakeLists.txt) and conditionally generates #define WITH_ZMQ 1 in the output header when ZMQ is enabled. I've tested locally across all combinations of these three features enabled/disabled, and the script correctly detects missing features in each case.

Thanks for any time you might take to review my work.

@151henry151

Copy link
Copy Markdown
Contributor Author

@maflcko

This looks like purely LLM generated ai slop to me, just like #33254 (comment) and #33926 (review)

Regarding #33254, that was my very first attempt at contributing to Bitcoin and I acknowledge it was not of any value.

Regarding #33926, I think that the most recent commit warrants reopening the pull request and that it is ready for review. Neither of them were "purely LLM generated", and I think that if you look more closely at the current state of #33926 you may even consider reopening it. I did use AI to help me comprehend the issue and to help me research how to go about resolving the issue, and to debug when I made errors, but I take full responsibility for the code as it stands and it is my work, not purely LLM generated ai slop.

Thanks for any consideration.

#cmakedefine ENABLE_WALLET 1

/* Define to 1 to enable ZMQ notifications. */
#cmakedefine WITH_ZMQ 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

#33828 (comment):

i am not a build system expert, but i don't think compile definitions and build header defines should be mixed for the same symbol.

This makes it triply confusing

@151henry151 151henry151 Jan 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@maflcko
The header define WITH_ZMQ uses the same name as the CMake option WITH_ZMQ that users configure (e.g., via -DWITH_ZMQ=ON).

Using a different name would require adding a mapping line like set(HAVE_ZMQ ${WITH_ZMQ}) in CMakeLists.txt.

Using the existing WITH_ZMQ name requires no additional mapping code—the #cmakedefine directive can check the existing CMake variable directly.

Using ENABLE_ZMQ won't work because it's already a compile definition, as you pointed out earlier.

I think this solution is the most elegant, but if you think a different name like HAVE_ZMQ would make things clearer, I'm happy to adjust the code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@maflcko it's been some time and I haven't heard back from you on this. Could I trouble you to take another look and share your thoughts?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am not too familiar with the build system best practises, so I can't comment here, but it looks like there is some proposal in #35072 that touches this topic.

@151henry151 151henry151 May 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks maflcko. @fanquake (or @hebasto) — would either of you be willing to weigh in on the naming convention here? Specifically, whether reusing the CMake option name WITH_ZMQ directly in the #cmakedefine is preferable to introducing a separate HAVE_ZMQ define that would require an explicit mapping in CMakeLists.txt

@sedited

sedited commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

There is a stale ACK here, can you take another look @maflcko?

@sedited

sedited commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

This is still not getting review. Will leave it open for a bit more, but we have a lot of other pull requests open and this just might not be a priority.

@sedited

sedited commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Closing for now due to lack of interest. Given the large number of other pull requests open, this just doesn't seem like a priority for reviewers.

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.

gen-manpages output depends on build options, so needs to check them

5 participants