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

philo-he pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new 1893345814 [VL] Fix GCC 11 compilation of S3 bucket config parsing 
(#13664)
1893345814 is described below

commit 1893345814fb901d5365935860138db42e155709
Author: Felipe Pessoto <[email protected]>
AuthorDate: Fri Nov 20 02:19:21 2026 -0800

    [VL] Fix GCC 11 compilation of S3 bucket config parsing (#13664)
---
 cpp/velox/tests/GlutenS3FileSystemTest.cc | 13 +++++++++----
 cpp/velox/utils/ConfigExtractor.cc        |  3 ++-
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/cpp/velox/tests/GlutenS3FileSystemTest.cc 
b/cpp/velox/tests/GlutenS3FileSystemTest.cc
index a09729c25c..329463f75e 100644
--- a/cpp/velox/tests/GlutenS3FileSystemTest.cc
+++ b/cpp/velox/tests/GlutenS3FileSystemTest.cc
@@ -71,22 +71,27 @@ TEST(GlutenS3FileSystemTest, extractsAsyncUploadConfigs) {
 TEST(GlutenS3FileSystemTest, extractsPerBucketConfigs) {
   using Keys = filesystems::S3Config::Keys;
   auto config = 
std::make_shared<velox::config::ConfigBase>(std::unordered_map<std::string, 
std::string>{
+      {"spark.hadoop.fs.s3a.bucket.a.endpoint", "http://single:9000"},
       {"spark.hadoop.fs.s3a.bucket.plain-bucket.endpoint", 
"http://plain:9000"},
       {"spark.hadoop.fs.s3a.bucket.my.data.bucket.endpoint", 
"http://dotted:9000"},
       {"spark.hadoop.fs.s3a.bucket.my.data.bucket.access.key", 
"dotted-access"},
       {"spark.hadoop.fs.s3a.bucket.my.data.bucket.endpoint.region", 
"us-west-2"},
       {"spark.hadoop.fs.s3a.bucket.my.data.bucket.iam.role.session.name", 
"dotted-session"},
       {"spark.hadoop.fs.s3a.bucket.my.data.bucket.unknown.option", "ignored"},
-      // Malformed keys are ignored too: no bucket name, empty bucket name, no 
dot before the option.
+      // Malformed keys and near matches are ignored too.
       {"spark.hadoop.fs.s3a.bucket.endpoint", "ignored"},
       {"spark.hadoop.fs.s3a.bucket..endpoint", "ignored"},
-      {"spark.hadoop.fs.s3a.bucket.myendpoint", "ignored"}});
+      {"spark.hadoop.fs.s3a.bucket.myendpoint", "ignored"},
+      {"spark.hadoop.fs.s3a.bucket.my.data.bucket.endpoins", "ignored"},
+      {"spark.hadoop.fs.s3a.bucket.my.data.bucket.endpoint.", "ignored"},
+      {"spark.hadoop.fs.s3a.bucket.my.data.bucket.endpoint.extra", 
"ignored"}});
 
   const auto hiveConfig = createHiveConnectorConfig(config, 
FileSystemType::kS3);
 
   auto bucketValue = [&](Keys key, std::string_view bucket) {
     return 
hiveConfig->get<std::string>(filesystems::S3Config::bucketConfigKey(key, 
bucket));
   };
+  EXPECT_EQ(bucketValue(Keys::kEndpoint, "a"), "http://single:9000";);
   EXPECT_EQ(bucketValue(Keys::kEndpoint, "plain-bucket"), "http://plain:9000";);
   EXPECT_EQ(bucketValue(Keys::kEndpoint, "my.data.bucket"), 
"http://dotted:9000";);
   EXPECT_EQ(bucketValue(Keys::kAccessKey, "my.data.bucket"), "dotted-access");
@@ -96,14 +101,14 @@ TEST(GlutenS3FileSystemTest, extractsPerBucketConfigs) {
   // Nothing is registered under a bucket name truncated at the first dot.
   EXPECT_FALSE(bucketValue(Keys::kEndpoint, "my").has_value());
 
-  // Only the five recognized options above produce per-bucket Velox configs.
+  // Only the six recognized options above produce per-bucket Velox configs.
   size_t numBucketConfigs = 0;
   for (const auto& [key, value] : hiveConfig->rawConfigs()) {
     if (key.rfind(filesystems::S3Config::kS3BucketPrefix, 0) == 0) {
       ++numBucketConfigs;
     }
   }
-  EXPECT_EQ(numBucketConfigs, 5);
+  EXPECT_EQ(numBucketConfigs, 6);
 }
 
 } // namespace
diff --git a/cpp/velox/utils/ConfigExtractor.cc 
b/cpp/velox/utils/ConfigExtractor.cc
index 1f87ac8848..34e732fbb0 100644
--- a/cpp/velox/utils/ConfigExtractor.cc
+++ b/cpp/velox/utils/ConfigExtractor.cc
@@ -97,7 +97,8 @@ void getS3HiveConfig(
         continue;
       }
       const auto dotPos = bucketAndSuffix.size() - suffix.size() - 1;
-      if (bucketAndSuffix[dotPos] == '.' && bucketAndSuffix.substr(dotPos + 1) 
== suffix) {
+      // Explicitly bound the suffix view for GCC 11's stringop-overread 
analysis.
+      if (bucketAndSuffix[dotPos] == '.' && bucketAndSuffix.substr(dotPos + 1, 
suffix.size()) == suffix) {
         result = std::make_pair(key, bucketAndSuffix.substr(0, dotPos));
         matchedSuffixSize = suffix.size();
       }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to