Skip to content

Commit e39937c

Browse files
authored
td-agent-v4: Backport #620 (#625)
When a non-ASCII key exists under the registry key `SOFTWARE/Microsoft/Windows/CurrentVersion/Uninstall/`, Fluentd fails to start workers due to `Encoding::UndefinedConversionError`. This patch avoid this issue. Backported from v5.0.3: #620 --------- Signed-off-by: Takuro Ashie <ashie@clear-code.com>
1 parent 25010d7 commit e39937c

6 files changed

Lines changed: 60 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Treasure Agent 4 changelog
22

3+
## Release v4.5.3 for Windows - 2024/02/29
4+
5+
### News
6+
7+
* This release is only for Windows, to fix failure launching worker process when
8+
non-ASCII registry key exists (#616).
9+
310
## Release v4.5.2 - 2023/11/29
411

512
### News

td-agent/Rakefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -841,8 +841,17 @@ class BuildTask
841841
dependency = Gem::Dependency.new('', version_condition)
842842
if dependency.match?('', ruby_version)
843843
patch_path = File.join(__dir__, "patches", patch_name)
844-
cd(ruby_lib_dir) do
845-
sh("ridk", "exec", "patch", "-p2", "--input=#{patch_path}")
844+
if patch_name.start_with?("rubyinstaller/")
845+
# Patches for RubyInstaller's binary package
846+
base_dir = td_agent_staging_dir
847+
strip_level = 1
848+
else
849+
# patches for Ruby source tree
850+
base_dir = ruby_lib_dir
851+
strip_level = 2
852+
end
853+
cd(base_dir) do
854+
sh("ridk", "exec", "patch", "-p#{strip_level}", "--input=#{patch_path}")
846855
end
847856
end
848857
end

td-agent/config.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PACKAGE_NAME = "td-agent"
2-
PACKAGE_VERSION = "4.5.2"
2+
PACKAGE_VERSION = "4.5.3"
33

44
FLUENTD_REVISION = 'd3cf2e0f95a0ad88b9897197db6c5152310f114f' # v1.16.3
55
FLUENTD_LOCAL_GEM_REPO = "file://" + File.expand_path(File.join(__dir__, "local_gem_repo"))
@@ -41,10 +41,10 @@
4141
#BUNDLED_RUBY_INSTALLER_X64_VERSION = "3.1.4-1"
4242
#BUNDLED_RUBY_INSTALLER_X64_SHA256SUM = "6701088607ea4b587a31af76d75cb3fe9f7bcd75fc175cffcca22369ebb6331d"
4343

44-
# Patch files are assumed to be for Ruby's source tree, then applied to
45-
# lib/ruby/x.y.0 in RubyInstaller. So that "-p2" options will be passed
46-
# to patch command.
44+
# Files under rubyinstaller/ are patches for RubyInstaller's binary package.
45+
# Other patches are for Ruby's source tree which can be shared with BUNDLED_RUBY_PATCHES.
4746
BUNDLED_RUBY_INSTALLER_PATCHES = [
4847
["ruby-3.0/0001-ruby-resolv-Fix-confusion-of-received-response-messa.patch", ["= 2.7.3"]],
4948
["ruby-3.0/0001-ruby-resolv-Fix-confusion-of-received-response-messa.patch", ["= 3.0.1"]],
49+
["rubyinstaller/0001-Avoid-crash-on-invalid-registry-key-while-detecting-.patch", [">= 2.7.8"]],
5050
]

td-agent/debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
td-agent (4.5.3-1) unstable; urgency=low
2+
3+
* New upstream release.
4+
5+
-- Takuro Ashie <ashie@clear-code.com> Thu, 29 Feb 2024 01:56:09 -0000
6+
17
td-agent (4.5.2-1) unstable; urgency=low
28

39
* New upstream release.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From dce1859255d8f0710e38282ba3a54a1d46e910e0 Mon Sep 17 00:00:00 2001
2+
From: Takuro Ashie <ashie@clear-code.com>
3+
Date: Thu, 29 Feb 2024 09:31:22 +0900
4+
Subject: [PATCH] Avoid crash on invalid registry key while detecting MSYS2
5+
installation
6+
7+
https://github.com/oneclick/rubyinstaller2/issues/372
8+
9+
Signed-off-by: Takuro Ashie <ashie@clear-code.com>
10+
---
11+
.../2.7.0/ruby_installer/runtime/msys2_installation.rb | 2 ++
12+
1 file changed, 2 insertions(+)
13+
14+
diff --git a/lib/ruby/site_ruby/2.7.0/ruby_installer/runtime/msys2_installation.rb b/lib/ruby/site_ruby/2.7.0/ruby_installer/runtime/msys2_installation.rb
15+
index e9ce60d5..d5f78eac 100644
16+
--- a/lib/ruby/site_ruby/2.7.0/ruby_installer/runtime/msys2_installation.rb
17+
+++ b/lib/ruby/site_ruby/2.7.0/ruby_installer/runtime/msys2_installation.rb
18+
@@ -78,6 +78,8 @@ module Runtime # Rewrite from D:/a/rubyinstaller2/rubyinstaller2/lib/ruby_instal
19+
# Ignore entries without valid installer data or broken character encoding
20+
end
21+
end
22+
+ rescue Encoding::InvalidByteSequenceError, Encoding::UndefinedConversionError
23+
+ # Avoid crash even if subkey includes inconvertible characters to internal encoding
24+
end
25+
rescue Win32::Registry::Error
26+
end
27+
--
28+
2.34.1
29+

td-agent/yum/td-agent.spec.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ fi
261261
# NOTE: %{_tmpfilesdir} is available since CentOS 7
262262
%attr(0755,td-agent,td-agent) %dir /tmp/@PACKAGE@
263263
%changelog
264+
* Thu Feb 29 2024 Takuro Ashie <ashie@clear-code.com> - 4.5.3-1
265+
- New upstream release.
266+
264267
* Wed Nov 22 2023 Takuro Ashie <ashie@clear-code.com> - 4.5.2-1
265268
- New upstream release.
266269

0 commit comments

Comments
 (0)