From 8a08ae19993a45b79a9eaa17e2bcc9981fc0248f Mon Sep 17 00:00:00 2001 From: bobhan1 Date: Thu, 15 Oct 2026 11:04:32 +0800 Subject: [PATCH] [fix](be) Scope filesystem error-code imports to their functions ### What problem does this PR solve? Issue Number: None Related PR: #67292, #67612, #67579 Problem Summary: With PCH disabled, the IO unity translation unit includes err_utils.cpp before file_meta_cache.cpp. The namespace-scope ErrorCode using-directive leaks into the generated protobuf headers and makes LIMIT_REACH ambiguous. Scope the import to the two localfs_error overloads that use it, preserving the existing error-code mappings. This synchronizes the fix already present in #67579 into the infrastructure and full feature branches. ### Release note None ### Check List (For Author) - Test: Manual compiler check. Reproduced the original LIMIT_REACH error in IO unity_2 with PCH imports removed; the same ASAN/UBSAN, coverage and -Werror syntax-only check passes after the fix. Repository clang-format 16, format check, build-hygiene check and git diff --check pass. No full BE build or runtime tests were rerun for this scope-only change. - Behavior changed: No - Does this need documentation: No --- be/src/io/fs/err_utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/be/src/io/fs/err_utils.cpp b/be/src/io/fs/err_utils.cpp index 4eaaaa5babf..760d6736055 100644 --- a/be/src/io/fs/err_utils.cpp +++ b/be/src/io/fs/err_utils.cpp @@ -28,8 +28,6 @@ #include "io/fs/hdfs.h" namespace doris { -using namespace ErrorCode; - namespace io { namespace { @@ -86,6 +84,7 @@ std::string glob_err_to_str(int code) { } Status localfs_error(const std::error_code& ec, std::string_view msg) { + using namespace ErrorCode; auto message = fmt::format("{}: {}", msg, ec.message()); if (ec == std::errc::io_error) { return Status::Error(message); @@ -105,6 +104,7 @@ Status localfs_error(const std::error_code& ec, std::string_view msg) { } Status localfs_error(int posix_errno, std::string_view msg) { + using namespace ErrorCode; auto message = fmt::format("{}: {}", msg, errno_message(posix_errno)); switch (posix_errno) { case EIO: