This is an automated email from the ASF dual-hosted git repository.
csun5285 pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.1 by this push:
new e5ae5ab9d04 [enhancement](thirdparty) fix arrow build bug and clear
dangerous env (#67523)
e5ae5ab9d04 is described below
commit e5ae5ab9d040d020e0473248de84b53d4ad75d53
Author: yiguolei <[email protected]>
AuthorDate: Fri Sep 4 19:05:38 2026 +0800
[enhancement](thirdparty) fix arrow build bug and clear dangerous env
(#67523)
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
---
.../service/http/action/be_thread_stack_action.cpp | 2 +
thirdparty/AGENTS.md | 67 ++++++++++++++++++++++
thirdparty/build-thirdparty.sh | 35 ++++++++++-
thirdparty/patches/apache-arrow-24.0.0-lzo.patch | 17 ++++++
4 files changed, 118 insertions(+), 3 deletions(-)
diff --git a/be/src/service/http/action/be_thread_stack_action.cpp
b/be/src/service/http/action/be_thread_stack_action.cpp
index a7d89d743f3..8b474fe311b 100644
--- a/be/src/service/http/action/be_thread_stack_action.cpp
+++ b/be/src/service/http/action/be_thread_stack_action.cpp
@@ -133,12 +133,14 @@ pid_t get_current_tid() {
return static_cast<pid_t>(syscall(SYS_gettid));
}
+#if defined(USE_UNWIND) && USE_UNWIND && defined(__x86_64__)
void append_frame(SignalContextCapture* capture, uintptr_t pc) {
if (pc == 0 || capture->size >= capture->frame_pointers.size()) {
return;
}
capture->frame_pointers[capture->size++] = reinterpret_cast<void*>(pc);
}
+#endif
void capture_signal_context_unwind(const ucontext_t* context,
SignalContextCapture* capture) {
*capture = SignalContextCapture {};
diff --git a/thirdparty/AGENTS.md b/thirdparty/AGENTS.md
new file mode 100644
index 00000000000..0af2d37f810
--- /dev/null
+++ b/thirdparty/AGENTS.md
@@ -0,0 +1,67 @@
+# Third-Party Dependency Lookup Guide
+
+This file applies to all changes under `thirdparty/`, including patches
applied to vendored
+projects.
+
+## Keep dependency lookup inside Doris third-party
+
+When locating a header, library, or CMake package provided by the Doris
third-party build, search
+only inside the Doris third-party install directory. Do not allow CMake to
fall back to system
+directories, user-installed packages, environment-provided prefixes, or
another checkout.
+
+The third-party build sets `CMAKE_INSTALL_PREFIX` to `${TP_INSTALL_DIR}`.
Prefer that existing
+value instead of introducing another variable for the same directory.
+
+For `find_path` and `find_library`:
+
+- Provide explicit `PATHS` below `${CMAKE_INSTALL_PREFIX}`.
+- Always specify `NO_DEFAULT_PATH`.
+- Use `NO_CACHE` and a Doris-specific result variable when supported, so a
stale CMake cache cannot
+ select a path outside the Doris third-party directory.
+- Use `REQUIRED` unless absence is an explicitly supported configuration.
+
+Example:
+
+```cmake
+find_path(DORIS_FOO_INCLUDE_DIR
+ NAMES foo/foo.h
+ PATHS "${CMAKE_INSTALL_PREFIX}/include"
+ NO_DEFAULT_PATH
+ NO_CACHE
+ REQUIRED)
+find_library(DORIS_FOO_LIBRARY
+ NAMES foo
+ PATHS "${CMAKE_INSTALL_PREFIX}/lib"
"${CMAKE_INSTALL_PREFIX}/lib64"
+ NO_DEFAULT_PATH
+ NO_CACHE
+ REQUIRED)
+```
+
+Apply the same rule to `find_package`: provide only package paths rooted under
+`${CMAKE_INSTALL_PREFIX}`, use `NO_DEFAULT_PATH`, and ensure a cached
`<Package>_DIR` cannot point
+outside that directory.
+
+Do not rely on an unconstrained `find_path`, `find_library`, `find_package`,
`CMAKE_PREFIX_PATH`,
+the host `PATH`, or platform default search paths for a Doris-managed
dependency. A dependency
+missing from the Doris third-party directory must fail configuration instead
of silently linking a
+different installation.
+
+System toolchain components and dependencies intentionally supplied by the
operating system are
+outside this rule, but that intent must be explicit in the surrounding build
configuration.
+
+## Preserve environment sanitization
+
+`build-thirdparty.sh` clears ambient CMake code-injection, vcpkg, and Conda
variables immediately
+after loading `env.sh`. Keep this sanitization before any third-party download
or build command,
+and add newly supported package-manager or CMake injection variables when they
could redirect
+dependency resolution outside the Doris third-party directory.
+
+Never `source` or use `.` to execute a script from an extracted third-party
source tree. Invoke
+upstream scripts as executables or through `bash`/`sh` so they run in a child
process. Keep each
+`build_<package>` function invocation inside its package subshell in the main
build loop. This
+boundary prevents exports, shell options, traps, functions, and
working-directory changes made by
+one package from leaking into later package builds, including if an upstream
script is accidentally
+sourced in the future.
+
+Only repository-owned initialization files such as `env.sh` and
`thirdparty/vars.sh` may be sourced,
+and they must be sourced before package builds begin.
diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh
index 09221d02d4c..081985c03c1 100755
--- a/thirdparty/build-thirdparty.sh
+++ b/thirdparty/build-thirdparty.sh
@@ -45,6 +45,17 @@ if [[ -f "${DORIS_HOME}/env.sh" ]]; then
export DO_NOT_CHECK_JAVA_ENV=
fi
+# Do not let ambient CMake injection hooks or package-manager environments
+# alter third-party dependency resolution. Keep this after env.sh so custom
+# environment setup cannot reintroduce these values.
+unset CMAKE_TOOLCHAIN_FILE \
+ CMAKE_PROJECT_INCLUDE \
+ CMAKE_PROJECT_INCLUDE_BEFORE \
+ CMAKE_PROJECT_TOP_LEVEL_INCLUDES \
+ VCPKG_ROOT \
+ VCPKG_DEFAULT_TRIPLET \
+ CONDA_PREFIX
+
# Check args
usage() {
echo "
@@ -2093,8 +2104,22 @@ build_lance_c() {
echo "failed to get cargo version for lance-c. Install Rust
${required_rust_version} or set LANCE_C_CARGO/RUSTUP_TOOLCHAIN."
exit 1
fi
- if [[ "${cargo_version}" != "${required_rust_version}" ]]; then
- echo "lance-c requires Rust/Cargo ${required_rust_version}, but found
${cargo_version}."
+ # Rust 1.91.0 is the minimum supported version. Allow newer toolchains when
+ # callers explicitly select one or rustup is unavailable on the system.
+ if ! awk -v required="${required_rust_version}" -v
actual="${cargo_version}" 'BEGIN {
+ split(required, r, ".");
+ split(actual, a, ".");
+ for (i = 1; i <= 3; i++) {
+ if ((a[i] + 0) > (r[i] + 0)) {
+ exit 0;
+ }
+ if ((a[i] + 0) < (r[i] + 0)) {
+ exit 1;
+ }
+ }
+ exit 0;
+ }'; then
+ echo "lance-c requires Rust/Cargo ${required_rust_version} or newer,
but found ${cargo_version}."
echo "Install Rust ${required_rust_version} or set
LANCE_C_CARGO/RUSTUP_TOOLCHAIN."
exit 1
fi
@@ -2326,7 +2351,11 @@ for package in "${packages[@]}"; do
fi
if [[ "${CONTINUE}" -eq 0 ]] || [[ "${PACKAGE_FOUND}" -eq 1 ]]; then
command="build_${package}"
- ${command}
+ # Isolate each package from environment and working-directory changes
+ # made by its build function or by a sourced upstream script.
+ (
+ "${command}"
+ )
cd "${TP_DIR}"
cleanup_package_source "${package}"
echo "debug after clean: ${package}"
diff --git a/thirdparty/patches/apache-arrow-24.0.0-lzo.patch
b/thirdparty/patches/apache-arrow-24.0.0-lzo.patch
index d7076509756..fc5d2654fb2 100644
--- a/thirdparty/patches/apache-arrow-24.0.0-lzo.patch
+++ b/thirdparty/patches/apache-arrow-24.0.0-lzo.patch
@@ -1,3 +1,20 @@
+--- a/cpp/src/parquet/CMakeLists.txt
++++ b/cpp/src/parquet/CMakeLists.txt
+@@ -118,0 +119,14 @@
++find_path(DORIS_LZO_INCLUDE_DIR
++ NAMES lzo/lzo1x.h
++ PATHS "${CMAKE_INSTALL_PREFIX}/include"
++ NO_DEFAULT_PATH
++ NO_CACHE
++ REQUIRED)
++find_library(DORIS_LZO_LIBRARY
++ NAMES lzo2
++ PATHS "${CMAKE_INSTALL_PREFIX}/lib"
"${CMAKE_INSTALL_PREFIX}/lib64"
++ NO_DEFAULT_PATH
++ NO_CACHE
++ REQUIRED)
++include_directories(SYSTEM "${DORIS_LZO_INCLUDE_DIR}")
++link_libraries("${DORIS_LZO_LIBRARY}")
--- a/cpp/src/parquet/column_reader.cc
+++ b/cpp/src/parquet/column_reader.cc
@@ -29,6 +29,8 @@
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]