From b2a1722f0d7074b68e34768bd4f04b2cf48fd5c9 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Fri, 21 Nov 2025 13:55:20 +0900 Subject: [PATCH 1/4] test_in_tail: add test to read root's log file Signed-off-by: Shizuo Fujita --- test/plugin/test_in_tail.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/plugin/test_in_tail.rb b/test/plugin/test_in_tail.rb index ab1476842b..280e69f12e 100644 --- a/test/plugin/test_in_tail.rb +++ b/test/plugin/test_in_tail.rb @@ -2648,6 +2648,21 @@ def test_no_warn_with_directory_permission end end + def test_other_user_owned_files + omit "Cannot test with root user" if Process::UID.eid == 0 + omit "NTFS doesn't support UNIX like permissions" if Fluent.windows? + + config = config_element('', '', { + 'tag' => "tail", + 'path' => "/var/log/*.log", + 'format' => 'none', + "pos_file" => "#{@tmp_dir}/tail.pos", + }) + assert_nothing_raised do + d = create_driver(config, false) + end + end + def test_shutdown_timeout Fluent::FileWrapper.open("#{@tmp_dir}/tail.txt", "wb") do |f| # Should be large enough to take too long time to consume From f8f385c4b0dd826c6dc430ee3d7ee013c9920e7e Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Fri, 21 Nov 2025 14:13:59 +0900 Subject: [PATCH 2/4] in_tail: fix error when files without read permission are included in glob patterns Signed-off-by: Shizuo Fujita --- lib/fluent/plugin/in_tail.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fluent/plugin/in_tail.rb b/lib/fluent/plugin/in_tail.rb index c037dc457d..12df389969 100644 --- a/lib/fluent/plugin/in_tail.rb +++ b/lib/fluent/plugin/in_tail.rb @@ -59,6 +59,7 @@ def initialize @shutdown_start_time = nil @metrics = nil @startup = true + @capability = Fluent::Capability.new(:current_process) end desc 'The paths to read. Multiple paths can be specified, separated by comma.' @@ -195,7 +196,6 @@ def configure(conf) @dir_perm = system_config.dir_permission || Fluent::DEFAULT_DIR_PERMISSION # parser is already created by parser helper @parser = parser_create(usage: parser_config['usage'] || @parser_configs.first.usage) - @capability = Fluent::Capability.new(:current_process) if @read_bytes_limit_per_second > 0 if !@enable_watch_timer raise Fluent::ConfigError, "Need to enable watch timer when using log throttling feature" From 1d7abe5b44770b9720066dc7f7383414c0ecbfb5 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Sat, 22 Nov 2025 22:40:34 +0900 Subject: [PATCH 3/4] test_in_tail: add link to issue as comment Signed-off-by: Shizuo Fujita --- test/plugin/test_in_tail.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/plugin/test_in_tail.rb b/test/plugin/test_in_tail.rb index 280e69f12e..a2ea72a1f4 100644 --- a/test/plugin/test_in_tail.rb +++ b/test/plugin/test_in_tail.rb @@ -2649,6 +2649,7 @@ def test_no_warn_with_directory_permission end def test_other_user_owned_files + # https://github.com/fluent/fluentd/issues/5141 omit "Cannot test with root user" if Process::UID.eid == 0 omit "NTFS doesn't support UNIX like permissions" if Fluent.windows? From 0337ea9dcc7e6871826f1c5063de34be4a04ba74 Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Sat, 22 Nov 2025 22:41:14 +0900 Subject: [PATCH 4/4] test_in_tail: remove unused variable Signed-off-by: Shizuo Fujita --- test/plugin/test_in_tail.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugin/test_in_tail.rb b/test/plugin/test_in_tail.rb index a2ea72a1f4..d0d973e646 100644 --- a/test/plugin/test_in_tail.rb +++ b/test/plugin/test_in_tail.rb @@ -2660,7 +2660,7 @@ def test_other_user_owned_files "pos_file" => "#{@tmp_dir}/tail.pos", }) assert_nothing_raised do - d = create_driver(config, false) + create_driver(config, false) end end