This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new dfe536806 fix(c/driver_manager): preserve quoted-key text in profile 
redefinition errors (#4442)
dfe536806 is described below

commit dfe5368065beac83666986c635d8e0f10b665ea8
Author: Matt Topol <[email protected]>
AuthorDate: Wed Jun 24 18:28:14 2026 -0400

    fix(c/driver_manager): preserve quoted-key text in profile redefinition 
errors (#4442)
    
    marzer/tomlplusplus@f22f035fe2d63e2be3d266d8f100e7812a9ab9bd
---
 c/driver_manager/adbc_driver_manager_test.cc | 28 ++++++++++++++++++++++++++++
 c/vendor/toml++/toml.hpp                     |  5 +++++
 go/adbc/drivermgr/vendored/toml++/toml.hpp   |  5 +++++
 3 files changed, 38 insertions(+)

diff --git a/c/driver_manager/adbc_driver_manager_test.cc 
b/c/driver_manager/adbc_driver_manager_test.cc
index 5a9c08950..823b862bb 100644
--- a/c/driver_manager/adbc_driver_manager_test.cc
+++ b/c/driver_manager/adbc_driver_manager_test.cc
@@ -1731,6 +1731,34 @@ TEST_F(ConnectionProfiles, DotSeparatedKey) {
   UnsetProfilePath();
 }
 
+TEST_F(ConnectionProfiles, DuplicateQuotedKey) {
+  // Regression: a duplicate *quoted* key must report the real key name, not a
+  // copy with its first two characters doubled (vendored toml++ bug, fixed
+  // upstream in marzer/tomlplusplus#300 / PR #302 / commit f22f035).
+  auto filepath = temp_dir / "profile.toml";
+  std::ofstream test_profile_file(filepath);
+  ASSERT_TRUE(test_profile_file.is_open());
+  test_profile_file << "profile_version = 1\n"
+                       "driver = \"adbc_driver_sqlite\"\n"
+                       "[Options]\n"
+                       "\"redshift.db_name\" = \"dev\"\n"
+                       "\"redshift.db_name\" = \"sample_datadev\"\n";
+  test_profile_file.close();
+
+  adbc_validation::Handle<struct AdbcDatabase> database;
+
+  // find profile by name using ADBC_PROFILE_PATH
+  SetProfilePath(temp_dir.string().c_str());
+  ASSERT_THAT(AdbcDatabaseNew(&database.value, &error), IsOkStatus(&error));
+  ASSERT_THAT(AdbcDatabaseSetOption(&database.value, "profile", "profile", 
&error),
+              IsOkStatus(&error));
+  ASSERT_THAT(AdbcDatabaseInit(&database.value, &error),
+              IsStatus(ADBC_STATUS_INVALID_ARGUMENT, &error));
+  ASSERT_THAT(error.message, ::testing::HasSubstr("redshift.db_name"));
+  ASSERT_THAT(error.message, 
::testing::Not(::testing::HasSubstr("reredshift")));
+  UnsetProfilePath();
+}
+
 TEST_F(ConnectionProfiles, UseEnvVar) {
   auto filepath = temp_dir / "profile.toml";
   toml::table profile = toml::parse(R"|(
diff --git a/c/vendor/toml++/toml.hpp b/c/vendor/toml++/toml.hpp
index cc188fb72..f8c21a8a7 100644
--- a/c/vendor/toml++/toml.hpp
+++ b/c/vendor/toml++/toml.hpp
@@ -14130,6 +14130,9 @@ TOML_IMPL_NAMESPACE_START
                        TOML_ASSERT_ASSUME(is_string_delimiter(*cp));
                        push_parse_scope("string"sv);
 
+                       // snapshot length so the recording buffer can be 
rewound alongside go_back(2u) below
+                       const auto recording_buffer_rollback_size = 
recording_buffer.length();
+
                        // get the first three characters to determine the 
string type
                        const auto first = cp->value;
                        advance_and_return_if_error_or_eof({});
@@ -14160,6 +14163,8 @@ TOML_IMPL_NAMESPACE_START
                                // step back two characters so that the current
                                // character is the string delimiter
                                go_back(2u);
+                               if (recording)
+                                       
recording_buffer.resize(recording_buffer_rollback_size);
 
                                return { first == U'\'' ? 
parse_literal_string(false) : parse_basic_string(false), false };
                        }
diff --git a/go/adbc/drivermgr/vendored/toml++/toml.hpp 
b/go/adbc/drivermgr/vendored/toml++/toml.hpp
index cc188fb72..f8c21a8a7 100644
--- a/go/adbc/drivermgr/vendored/toml++/toml.hpp
+++ b/go/adbc/drivermgr/vendored/toml++/toml.hpp
@@ -14130,6 +14130,9 @@ TOML_IMPL_NAMESPACE_START
                        TOML_ASSERT_ASSUME(is_string_delimiter(*cp));
                        push_parse_scope("string"sv);
 
+                       // snapshot length so the recording buffer can be 
rewound alongside go_back(2u) below
+                       const auto recording_buffer_rollback_size = 
recording_buffer.length();
+
                        // get the first three characters to determine the 
string type
                        const auto first = cp->value;
                        advance_and_return_if_error_or_eof({});
@@ -14160,6 +14163,8 @@ TOML_IMPL_NAMESPACE_START
                                // step back two characters so that the current
                                // character is the string delimiter
                                go_back(2u);
+                               if (recording)
+                                       
recording_buffer.resize(recording_buffer_rollback_size);
 
                                return { first == U'\'' ? 
parse_literal_string(false) : parse_basic_string(false), false };
                        }

Reply via email to