#17493 util: Forbid ambiguous multiple assignments in config file
| Reviewability | Reviews | Agreement | Size | ||||
|---|---|---|---|---|---|---|---|
| #17493 util: Forbid ambiguous multiple assignments in config file | Review #16545 first | 0 -1 | Mild | 389 + 808 tests | |||
|
|
|
|
| |||
Reviewability: ReadyStalePaused Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs. Size: lines added or modified outside tests, then in tests; greener = smaller. | |||||||
Goal
Makes ArgsManager report a fatal startup error when a non-list configuration option is assigned multiple times in the same section of a configuration file. Options flagged with ALLOW_LIST remain repeatable.
Problem: When a single-value option is assigned multiple times in the same config file section, Bitcoin Core silently discards one of the values according to counterintuitive precedence rules. Node operators may unknowingly run with discarded settings, and supporting this behavior requires complex reverse-precedence code in settings merging.
Evidence of importance:
- PR description: 'Instead of silently ignoring settings, this change makes it an error to provide an ambiguous config file that provides assigns multiple values to a single-value setting.'
- PR description: 'Part of the motivation for this change is to improve usability and prevent settings that look valid from being silently ignored. Another motivation is to be able to remove confusing "reverse precedence" logic in #17581'
Scope: This PR sits on top of #16545 and #17580. Only the top two commits (c578547bcf5 and 08548ef76c0) are unique to this pull request; the rest belong to the underlying stack.
Risk of a mistake: medium (other). Stricter configuration validation will cause nodes with existing duplicate config entries to fail on startup instead of booting.
Changed since the previous assessment: Rebased onto updated base PRs #16545 and #17580 with intermediate review fixes and documentation adjustments; the PR's own commits remain functionally identical.
Reviewability
Ready · Review #16545 first
Stacked on #16545; the base PR's changes are included in this diff.
Waiting on (from the thread read):
Agreement
Mild
NACK from ajtowns not withdrawn (plausibly existing configs in the wild will cause bitcoin nodes to fail to restart on upgrade)
Thread notes: c:572736951 was edited to append rebase notes against base PR #17580; existing claims and support are unchanged.
Objections, suggestions, and questions:
| Reviewer | Type | Harm, request, or question | Status | Must be | Author replied | Quote |
|---|---|---|---|---|---|---|
| JeremyRubin (contributor) | suggestion, approach | only error if duplicate setting specifies a differing value | answered · author was open to it; ajtowns suggested waiting to see real-world demand before adding special cases | answered | yes | 2019-11-18: 'Perhaps only err if the value differs?' Status from: 2020-01-09: ryanofsky: 'It'd be pretty easy to tweak the PR to avoid triggering errors in these cases.' |
| ajtowns (member) | objection, approach | plausibly existing configs in the wild will cause bitcoin nodes to fail to restart on upgrade | accepted · ajtowns agreed a warning would be missed and that release notes address upgrade caution | changed | yes | 2020-01-09: 'Weak concept NACK on this... this change has the potential to cause systems to not restart correctly... Maybe having a warning rather than an error for a release would be better?' Status from: 2020-01-23: ajtowns: 'I agree a warning everyone will miss isn't that helpful, and there aren't any better approaches coming to mind; really t' |
Support:
- JeremyRubin (contributor) (Concept ACK, 2019-11-18) [read]: worth it, as anything which could be intentionally repeated gets the new flag
Participants:
- JeremyRubin (contributor, support, 2 statements 2019-11-18 to 2019-11-18): Concept ACK; suggested allowing identical duplicate values
- Khailand69 (none, neutral, 1 statements 2019-11-27 to 2019-11-27): approval without rationale or project history
- ajtowns (member, objection, 2 statements 2020-01-09 to 2020-01-23): raised weak concept NACK over systems failing to restart on upgrade, later withdrew it
- fanquake (member, neutral, 1 statements 2023-02-08 to 2023-02-08): moved PR to draft because prerequisite PRs are not yet merged
Dependencies
Files
895 lines under test/bench/ci.
- src/test/argsman_tests.cpp +689/-71
- src/common/args.cpp +157/-31
- src/common/args.h +162/-18
- src/init.cpp +45/-36
- src/test/getarg_tests.cpp +61/-3
- src/test/fuzz/system.cpp +47/-7
- src/chainparamsbase.cpp +6/-5
- doc/release-notes-17493.md +8/-0
- src/common/config.cpp +7/-1
- src/init/common.cpp +3/-3
- src/test/logging_tests.cpp +3/-3
- test/lint/check-doc.py +3/-2
- src/test/util/common.h +4/-0
- src/wallet/init.cpp +1/-1
- test/functional/feature_config_args.py +1/-1
Card
The short text the ranking pass compares across PRs.
Bitcoin Core currently ignores duplicate assignments of single-value options within the same section of a configuration file, which can silently discard intended settings under obscure precedence rules. This PR makes multiple assignments of non-list settings in the same config section a startup error, alerting operators to ambiguous configurations. It also unblocks #17581 to remove reverse-precedence logic in config merging. The PR is stacked on top of open PRs #16545 and #17580.
Data
thread read through 2023-02-08 (7 statements), head 08548ef76c
labels: Refactoring, Utils/log/libs · draft
Categories
Utilities (logging, arguments, libraries)
P2 · bug fix (ranking pass: Kept P2 but ordered after its base #17580 so the stacked args chain is reviewed in dependency order.)
Prevents subtle operator misconfigurations by failing fast on duplicate non-list configuration settings instead of silently discarding them. As described in the PR, this removes confusing reverse-precedence logic and ensures 'settings that look valid' are not silently ignored at startup, also enabling downstream settings cleanup in #17581.
Membership: Carries the Utils/log/libs label and modifies core argument and settings parsing in src/common/args.{cpp,h} and src/init.cpp.
Factors: security/stability 1, bug 1, performance 0, user value 2, leverage 1