argsman: Prevent duplicate option registration across categories #35470

pull pablomartin4btc wants to merge 1 commits into bitcoin:master from pablomartin4btc:argsman-prevent-option-duplication-acroos-categories changing 1 files +5 −0
  1. pablomartin4btc commented at 8:40 PM on June 5, 2026: member

    Follow-up to #28802

    This PR enforces the invariant that option names are unique across categories.

    -<ins>Rationale</ins>:

    • While adapting the argsman_tests.cpp cases introduced in #28802 for the GNU-style parsing changes proposed in #33540, I noticed that the same option name can currently be registered in multiple categories.

    • At present in master, this ambiguity is largely masked by the existing command-line parsing behaviour. However, it relies on assumptions about how options are interpreted based on their position. Future changes to option parsing, such as the GNU-style parsing proposed in #33540, may expose this ambiguity and lead to unexpected option resolution.

    • To avoid ambiguous option resolution and make the distinction between global and command-specific options explicit, this PR adds validation in AddArg() preventing the same option name from being registered across different categories.

  2. argsman: Prevent duplicate option registration across categories
    Added a validation in AddArg() preventing the same option name from
    being registered across different categories, avoiding ambiguous option
    resolution and make the distinction between global and command-specific
    options explicit.
    568afb4390
  3. DrahtBot commented at 8:40 PM on June 5, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK sedited

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. sedited commented at 7:37 AM on June 6, 2026: contributor

    Concept ACK

  5. sedited requested review from ryanofsky on Jun 9, 2026

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: 2026-06-11 04:50 UTC

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