This is an automated email from the ASF dual-hosted git repository.
zclll pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 490ade94225 [Fix](startup) Skip wrong file when loading tzdata (#57061)
490ade94225 is described below
commit 490ade942259604f4436ad4f4bd1b4a6d72631d0
Author: zclllyybb <[email protected]>
AuthorDate: Fri Oct 17 10:38:14 2025 +0800
[Fix](startup) Skip wrong file when loading tzdata (#57061)
If we traverse to some symbolic links that are not valid (pointing to
non-existent files, etc.), `read_symlink` will throw a filesystem_error,
and we did not catch it before, which caused a coredump. now we fixed
it.
---
be/src/util/timezone_utils.cpp | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/be/src/util/timezone_utils.cpp b/be/src/util/timezone_utils.cpp
index d7d8c8f4aeb..4a9f5790ce4 100644
--- a/be/src/util/timezone_utils.cpp
+++ b/be/src/util/timezone_utils.cpp
@@ -92,14 +92,21 @@ void TimezoneUtils::load_timezones_to_cache() {
for (fs::recursive_directory_iterator it {base_str}; it != end(it); it++) {
const auto& dir_entry = *it;
- if (dir_entry.is_regular_file() ||
- (dir_entry.is_symlink() &&
is_regular_file(read_symlink(dir_entry)))) {
- auto tz_name = dir_entry.path().string().substr(base_str.length());
- if (!parse_save_name_tz(tz_name)) {
- LOG(WARNING) << "Meet illegal tzdata file: " << tz_name << ".
skipped";
+ try {
+ if (dir_entry.is_regular_file() ||
+ (dir_entry.is_symlink() &&
is_regular_file(read_symlink(dir_entry)))) {
+ auto tz_name =
dir_entry.path().string().substr(base_str.length());
+ if (!parse_save_name_tz(tz_name)) {
+ LOG(WARNING) << "Meet illegal tzdata file: " << tz_name <<
". skipped";
+ }
+ } else if (dir_entry.is_directory() &&
+ ignore_paths.contains(dir_entry.path().filename())) {
+ it.disable_recursion_pending();
}
- } else if (dir_entry.is_directory() &&
ignore_paths.contains(dir_entry.path().filename())) {
- it.disable_recursion_pending();
+ } catch (const fs::filesystem_error& e) {
+ // maybe symlink loop or to nowhere...
+ LOG(WARNING) << "filesystem error when loading timezone file from
" << dir_entry.path()
+ << ": " << e.what();
}
}
// some special cases. Z = Zulu. CST = Asia/Shanghai
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]