From 9536675e65a031323edaea903aeb3b059deab2b3 Mon Sep 17 00:00:00 2001 From: John McCrae Date: Wed, 27 Mar 2024 12:00:04 -0700 Subject: [PATCH 1/5] The patcher cannot find the files to patch. Correcting the path Signed-off-by: John McCrae --- config/software/ruby.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/config/software/ruby.rb b/config/software/ruby.rb index 4b4a1ead0..c9d6f8688 100644 --- a/config/software/ruby.rb +++ b/config/software/ruby.rb @@ -153,6 +153,19 @@ patch source: "ruby-win32_warning_removal.patch", plevel: 1, env: patch_env end + # We fixed a bug regarding Windows fqdn resolution in Ohai on the 17-stable branch. + # That Ohai update requires the Resolv class. The 'resolv' class unconditionally + # loads the Win32::Registry class as a dependency. + # Chef Infra already loads Win32::Registry and has a monkeypatch for the export_string method. + # When the Resolv class loads again in Ohai, it overwrites the monkeypatch and that + # leads to registry encoding/decoding errors - Base Ruby classes return text encoded in + # UTF-16LE format and we need UTF-8. + # Here we patch the Ruby Win32/Reolv.rb file to make reloading the Win32::Registry class + # conditional and therefore prevent the monkeypatch from being overwritten. + if windows? && version.satisfies?("~> 3.0.0") + patch source: "ruby-win32_resolv.patch", plevel: 1, env: patch_env + end + # RHEL6 has a base compiler that does not support -fstack-protector-strong, but we # cannot build modern ruby on the RHEL6 base compiler, and the configure script # determines that it supports that flag and so includes it and then ultimately From e68febb184abd24802c9be98a333a303de75a022 Mon Sep 17 00:00:00 2001 From: John McCrae Date: Wed, 27 Mar 2024 12:01:42 -0700 Subject: [PATCH 2/5] The patcher cannot find the files to patch. Correcting the path Signed-off-by: John McCrae --- config/patches/ruby/ruby-win32_resolv.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 config/patches/ruby/ruby-win32_resolv.patch diff --git a/config/patches/ruby/ruby-win32_resolv.patch b/config/patches/ruby/ruby-win32_resolv.patch new file mode 100644 index 000000000..8f509180c --- /dev/null +++ b/config/patches/ruby/ruby-win32_resolv.patch @@ -0,0 +1,11 @@ +--- ext/lib/ruby/3.0.0/win32/resolv.rb.org 2024-03-25 19:48:15 ++++ ext/lib/ruby/3.0.0/win32/resolv.rb 2024-03-25 19:49:01 +@@ -4,7 +4,7 @@ + + =end + +-require 'win32/registry' ++require 'win32/registry' unless defined?(Win32::Registry) + + module Win32 + module Resolv From a7bb1a55f317afe8299c58de4edd7235834cd0a8 Mon Sep 17 00:00:00 2001 From: John McCrae Date: Wed, 27 Mar 2024 13:34:41 -0700 Subject: [PATCH 3/5] The patcher cannot find the files to patch. Correcting the path Signed-off-by: John McCrae --- config/patches/ruby/ruby-win32_resolv.patch | 4 ++-- config/software/ruby.rb | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config/patches/ruby/ruby-win32_resolv.patch b/config/patches/ruby/ruby-win32_resolv.patch index 8f509180c..d0d98c11e 100644 --- a/config/patches/ruby/ruby-win32_resolv.patch +++ b/config/patches/ruby/ruby-win32_resolv.patch @@ -1,5 +1,5 @@ ---- ext/lib/ruby/3.0.0/win32/resolv.rb.org 2024-03-25 19:48:15 -+++ ext/lib/ruby/3.0.0/win32/resolv.rb 2024-03-25 19:49:01 +--- ext\win32\lib\win32\resolv.rb.org 2024-03-25 19:48:15 ++++ ext\win32\lib\win32\resolv.rb 2024-03-25 19:49:01 @@ -4,7 +4,7 @@ =end diff --git a/config/software/ruby.rb b/config/software/ruby.rb index c9d6f8688..ba14d96ac 100644 --- a/config/software/ruby.rb +++ b/config/software/ruby.rb @@ -163,6 +163,9 @@ # Here we patch the Ruby Win32/Reolv.rb file to make reloading the Win32::Registry class # conditional and therefore prevent the monkeypatch from being overwritten. if windows? && version.satisfies?("~> 3.0.0") + puts "************************ PATCH ENV ***************************" + puts patch_env + puts "********************** END PATCH ENV ************************" patch source: "ruby-win32_resolv.patch", plevel: 1, env: patch_env end From 93b04701cf7fe327c79c3fb4e85fa8836e987788 Mon Sep 17 00:00:00 2001 From: John McCrae Date: Wed, 27 Mar 2024 13:54:27 -0700 Subject: [PATCH 4/5] The patcher cannot find the files to patch. Correcting the path Signed-off-by: John McCrae --- config/patches/ruby/ruby-win32_resolv.patch | 4 ++-- config/software/ruby.rb | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/config/patches/ruby/ruby-win32_resolv.patch b/config/patches/ruby/ruby-win32_resolv.patch index d0d98c11e..b4592f2f1 100644 --- a/config/patches/ruby/ruby-win32_resolv.patch +++ b/config/patches/ruby/ruby-win32_resolv.patch @@ -1,5 +1,5 @@ ---- ext\win32\lib\win32\resolv.rb.org 2024-03-25 19:48:15 -+++ ext\win32\lib\win32\resolv.rb 2024-03-25 19:49:01 +--- ext/win32/lib/win32/resolv.rb.org 2024-03-25 19:48:15 ++++ ext/win32/lib/win32/resolv.rb 2024-03-25 19:49:01 @@ -4,7 +4,7 @@ =end diff --git a/config/software/ruby.rb b/config/software/ruby.rb index ba14d96ac..dc7edad32 100644 --- a/config/software/ruby.rb +++ b/config/software/ruby.rb @@ -162,11 +162,13 @@ # UTF-16LE format and we need UTF-8. # Here we patch the Ruby Win32/Reolv.rb file to make reloading the Win32::Registry class # conditional and therefore prevent the monkeypatch from being overwritten. + + puts "************************ PATCH ENV ***************************" + puts patch_env + puts "********************** END PATCH ENV ************************" + if windows? && version.satisfies?("~> 3.0.0") - puts "************************ PATCH ENV ***************************" - puts patch_env - puts "********************** END PATCH ENV ************************" - patch source: "ruby-win32_resolv.patch", plevel: 1, env: patch_env + patch source: "ruby-win32_resolv.patch", plevel: 0, env: patch_env end # RHEL6 has a base compiler that does not support -fstack-protector-strong, but we From 8d5c42f55bd82957705204aaf3d5a3d0f60ccb9d Mon Sep 17 00:00:00 2001 From: John McCrae Date: Wed, 27 Mar 2024 15:49:00 -0700 Subject: [PATCH 5/5] The patcher cannot find the files to patch. Had to update the plevel from p1 tp p0 Signed-off-by: John McCrae --- config/software/ruby.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/config/software/ruby.rb b/config/software/ruby.rb index dc7edad32..f5de090db 100644 --- a/config/software/ruby.rb +++ b/config/software/ruby.rb @@ -163,10 +163,6 @@ # Here we patch the Ruby Win32/Reolv.rb file to make reloading the Win32::Registry class # conditional and therefore prevent the monkeypatch from being overwritten. - puts "************************ PATCH ENV ***************************" - puts patch_env - puts "********************** END PATCH ENV ************************" - if windows? && version.satisfies?("~> 3.0.0") patch source: "ruby-win32_resolv.patch", plevel: 0, env: patch_env end