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

yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 505b920613c branch-4.0: [Fix](arrow flight) Fix arrow::Status inline 
static empty msg core (#63191) (#63266)
505b920613c is described below

commit 505b920613c20a8078f8faf238b59f1c2c6c6410
Author: linrrarity <[email protected]>
AuthorDate: Wed May 27 12:22:38 2026 +0800

    branch-4.0: [Fix](arrow flight) Fix arrow::Status inline static empty msg 
core (#63191) (#63266)
    
    pick: https://github.com/apache/doris/pull/63191
---
 thirdparty/download-thirdparty.sh                  | 13 +++++
 ...che-arrow-17.0.0-status-inline-static-fix.patch | 58 ++++++++++++++++++++++
 2 files changed, 71 insertions(+)

diff --git a/thirdparty/download-thirdparty.sh 
b/thirdparty/download-thirdparty.sh
index e639f511575..89040c09d6a 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -371,6 +371,19 @@ if [[ " ${TP_ARCHIVES[*]} " =~ " ARROW " ]]; then
         fi
         cd -
     fi
+    if [[ "${ARROW_SOURCE}" == "arrow-apache-arrow-17.0.0" ]]; then
+        cd "${TP_SOURCE_DIR}/${ARROW_SOURCE}"
+        if [[ ! -f "${PATCHED_MARK}" ]]; then
+            # apache-arrow-17.0.0-status-inline-static-fix.patch :
+            # Move Status::message()/detail() empty sentinels out of header
+            # inline function-local statics. Clang can place those weak inline
+            # std::string objects in RELRO, then crash while initializing them.
+            patch -p1 
<"${TP_PATCH_DIR}/apache-arrow-17.0.0-status-inline-static-fix.patch"
+
+            touch "${PATCHED_MARK}"
+        fi
+        cd -
+    fi
     echo "Finished patching ${ARROW_SOURCE}"
 fi
 
diff --git 
a/thirdparty/patches/apache-arrow-17.0.0-status-inline-static-fix.patch 
b/thirdparty/patches/apache-arrow-17.0.0-status-inline-static-fix.patch
new file mode 100644
index 00000000000..2a1ed534077
--- /dev/null
+++ b/thirdparty/patches/apache-arrow-17.0.0-status-inline-static-fix.patch
@@ -0,0 +1,58 @@
+diff --git a/cpp/src/arrow/status.cc b/cpp/src/arrow/status.cc
+index a9581cadc9..1b7ee7df62 100644
+--- a/cpp/src/arrow/status.cc
++++ b/cpp/src/arrow/status.cc
+@@ -17,6 +17,17 @@
+ 
+ namespace arrow {
+ 
++const std::string& Status::NoMessage() {
++  static const std::string* no_message = new std::string();
++  return *no_message;
++}
++
++const std::shared_ptr<StatusDetail>& Status::NoDetail() {
++  static const std::shared_ptr<StatusDetail>* no_detail =
++      new std::shared_ptr<StatusDetail>();
++  return *no_detail;
++}
++
+ Status::Status(StatusCode code, const std::string& msg)
+     : Status::Status(code, msg, nullptr) {}
+ 
+diff --git a/cpp/src/arrow/status.h b/cpp/src/arrow/status.h
+index 983b61629d..a49a982922 100644
+--- a/cpp/src/arrow/status.h
++++ b/cpp/src/arrow/status.h
+@@ -330,14 +330,18 @@ class ARROW_EXPORT [[nodiscard]] Status : public 
util::EqualityComparable<Status
+ 
+   /// \brief Return the specific error message attached to this status.
+   const std::string& message() const {
+-    static const std::string no_message = "";
+-    return ok() ? no_message : state_->msg;
++    if (ARROW_PREDICT_FALSE(state_ != NULLPTR)) {
++      return state_->msg;
++    }
++    return NoMessage();
+   }
+ 
+   /// \brief Return the status detail attached to this message.
+   const std::shared_ptr<StatusDetail>& detail() const {
+-    static std::shared_ptr<StatusDetail> no_detail = NULLPTR;
+-    return state_ ? state_->detail : no_detail;
++    if (ARROW_PREDICT_FALSE(state_ != NULLPTR)) {
++      return state_->detail;
++    }
++    return NoDetail();
+   }
+ 
+   const void* debug_state_addr() const { return state_; }
+@@ -396,6 +400,8 @@ class ARROW_EXPORT [[nodiscard]] Status : public 
util::EqualityComparable<Status
+     delete state_;
+     state_ = NULLPTR;
+   }
++  static const std::string& NoMessage();
++  static const std::shared_ptr<StatusDetail>& NoDetail();
+   void CopyFrom(const Status& s);
+   inline void MoveFrom(Status& s);
+ };


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

Reply via email to