fix(c/driver_manager): preserve quoted-key text in profile redefinition errors#4442
Merged
lidavidm merged 1 commit intoJun 24, 2026
Merged
Conversation
…on errors A duplicate quoted key in a connection profile (e.g. two "redshift.db_name" entries) produced a parse error that doubled the first two characters of the key name, reporting 'reredshift.db_name' instead of 'redshift.db_name'. The cause is in vendored toml++ (v3.4.0): parse_string() advances two characters to detect a multi-line delimiter and records them into the diagnostics recording buffer, but go_back(2u) rewinds the read cursor without trimming that buffer, so the lookahead characters are duplicated in redefinition error messages. This only affects quoted keys. Backport the upstream fix into both vendored copies (c/vendor and go/adbc/drivermgr/vendored) and add a regression test exercising a duplicate quoted key. Upstream issue: marzer/tomlplusplus#300 Upstream PR: marzer/tomlplusplus#302 Upstream commit: f22f035fe2d63e2be3d266d8f100e7812a9ab9bd
lidavidm
approved these changes
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A duplicate quoted key in a connection profile (for example, two
"redshift.db_name"entries) produced a confusing parse error thatdoubled the first two characters of the key name:
instead of naming
redshift.db_name.Root cause
The bug is in the vendored toml++ (v3.4.0).
parse_string()advances twocharacters to detect a
"""multi-line delimiter and appends them to theparser's diagnostics
recording_buffer. When the string turns out to besingle-line,
go_back(2u)rewinds the read cursor but does not trim thosetwo characters from
recording_buffer, so the lookahead bytes are duplicatedwhen a redefinition error renders the key via
to_sv(recording_buffer). Itonly affects quoted keys (the path through the basic/literal string parser);
bare dotted keys are unaffected.
Fix
Backport the upstream fix into both vendored copies
(
c/vendor/toml++/toml.hppandgo/adbc/drivermgr/vendored/toml++/toml.hpp).The fix snapshots
recording_buffer.length()before the lookahead and restoresit after
go_back(2u).f22f035fe2d63e2be3d266d8f100e7812a9ab9bdThe fix is not in any tagged toml++ release yet (latest is v3.4.0), so it is
backported here. It re-applies cleanly when the vendored copy is next updated.
Testing
Adds
ConnectionProfiles.DuplicateQuotedKeytoc/driver_manager/adbc_driver_manager_test.cc, which writes a profile with aduplicate quoted key and asserts the resulting error names
redshift.db_nameand not the doubled
reredshiftform. Passes locally(
--gtest_filter=ConnectionProfiles.DuplicateQuotedKey).