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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 77fe6b8109d [opt](deps) patch re2 to add ignore_replace_escape option 
(#50124) (#50324)
77fe6b8109d is described below

commit 77fe6b8109d85b65056f11bbf638e447bf21d6cf
Author: Mingyu Chen (Rayner) <morning...@163.com>
AuthorDate: Wed Apr 23 18:23:54 2025 -0700

    [opt](deps) patch re2 to add ignore_replace_escape option (#50124) (#50324)
    
    bp #50124
---
 thirdparty/CHANGELOG.md                            |  4 ++
 thirdparty/download-thirdparty.sh                  | 15 ++++++
 .../patches/re2-2021-02-02-ignore-replace.patch    | 63 ++++++++++++++++++++++
 3 files changed, 82 insertions(+)

diff --git a/thirdparty/CHANGELOG.md b/thirdparty/CHANGELOG.md
index 3d4cdc0498d..5caba7e28bc 100644
--- a/thirdparty/CHANGELOG.md
+++ b/thirdparty/CHANGELOG.md
@@ -2,6 +2,10 @@
 
 This file contains version of the third-party dependency libraries in the 
build-env image. The docker build-env image is apache/doris, and the tag is 
`build-env-${version}`
 
+## 20250416
+
+- Mofified: patch re2 to set `ignore_replace_escape` option
+
 ## 20250408
 
 - Modified: jindofs 6.3.4 -> 6.8.2
diff --git a/thirdparty/download-thirdparty.sh 
b/thirdparty/download-thirdparty.sh
index 3a04789566c..5ca4eb44080 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -537,5 +537,20 @@ if [[ " ${TP_ARCHIVES[*]} " =~ " THRIFT " ]]; then
     echo "Finished patching ${THRIFT_SOURCE}"
 fi
 
+# patch re2
+if [[ " ${TP_ARCHIVES[*]} " =~ " RE2 " ]]; then
+    if [[ "${RE2_SOURCE}" == 're2-2021-02-02' ]]; then
+        cd "${TP_SOURCE_DIR}/${RE2_SOURCE}"
+        if [[ ! -f "${PATCHED_MARK}" ]]; then
+            for patch_file in "${TP_PATCH_DIR}"/re2-*; do
+                echo "patch ${patch_file}"
+                patch -p1 --ignore-whitespace <"${patch_file}"
+            done
+            touch "${PATCHED_MARK}"
+        fi
+        cd -
+    fi
+    echo "Finished patching ${RE2_SOURCE}"
+fi
 
 # vim: ts=4 sw=4 ts=4 tw=100:
diff --git a/thirdparty/patches/re2-2021-02-02-ignore-replace.patch 
b/thirdparty/patches/re2-2021-02-02-ignore-replace.patch
new file mode 100644
index 00000000000..aabf509b0dd
--- /dev/null
+++ b/thirdparty/patches/re2-2021-02-02-ignore-replace.patch
@@ -0,0 +1,63 @@
+diff --git a/re2/re2.cc b/re2/re2.cc
+index 85ba1f4..0f23c22 100644
+--- a/re2/re2.cc
++++ b/re2/re2.cc
+@@ -55,7 +55,8 @@ RE2::Options::Options(RE2::CannedOptions opt)
+     case_sensitive_(true),
+     perl_classes_(false),
+     word_boundary_(false),
+-    one_line_(false) {
++    one_line_(false),
++    ignore_replace_escape_(false) {
+ }
+ 
+ // static empty objects for use as const references.
+@@ -1030,9 +1031,13 @@ bool RE2::Rewrite(std::string* out,
+     } else if (c == '\\') {
+       out->push_back('\\');
+     } else {
+-      if (options_.log_errors())
+-        LOG(ERROR) << "invalid rewrite pattern: " << rewrite.data();
+-      return false;
++      if (options_.ignore_replace_escape()) {
++        out->push_back(*s);
++      } else {
++        if (options_.log_errors())
++          LOG(ERROR) << "invalid rewrite pattern: " << rewrite.data();
++        return false;
++      }
+     }
+   }
+   return true;
+diff --git a/re2/re2.h b/re2/re2.h
+index 09c1fbe..79fe995 100644
+--- a/re2/re2.h
++++ b/re2/re2.h
+@@ -665,7 +665,8 @@ class RE2 {
+       case_sensitive_(true),
+       perl_classes_(false),
+       word_boundary_(false),
+-      one_line_(false) {
++      one_line_(false),
++      ignore_replace_escape_(false) {
+     }
+ 
+     /*implicit*/ Options(CannedOptions);
+@@ -709,6 +710,9 @@ class RE2 {
+     bool one_line() const { return one_line_; }
+     void set_one_line(bool b) { one_line_ = b; }
+ 
++    bool ignore_replace_escape() const { return ignore_replace_escape_; }
++    void set_ignore_replace_escape(bool b) { ignore_replace_escape_ = b; }
++
+     void Copy(const Options& src) {
+       *this = src;
+     }
+@@ -729,6 +733,7 @@ class RE2 {
+     bool perl_classes_;
+     bool word_boundary_;
+     bool one_line_;
++    bool ignore_replace_escape_;
+   };
+ 
+   // Returns the options set in the constructor.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to