Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patching resolv.rb to load conditionally #1883

Merged
merged 2 commits into from
Mar 26, 2024
Merged

Conversation

johnmccrae
Copy link
Contributor

@johnmccrae johnmccrae commented Mar 25, 2024

Description

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/Resolv.rb file to make reloading the Win32::Registry class conditional and therefore prevent the monkeypatch from being overwritten.

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • If Gemfile.lock has changed, I have used --conservative to do it and included the full output in the Description above.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

Signed-off-by: John McCrae <john.mccrae@progress.com>
@johnmccrae johnmccrae requested review from a team as code owners March 25, 2024 20:29
Signed-off-by: John McCrae <john.mccrae@progress.com>
Copy link

sonarcloud bot commented Mar 25, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@poorndm
Copy link
Collaborator

poorndm commented Mar 26, 2024

@johnmccrae johnmccrae merged commit 763ae8b into main Mar 26, 2024
6 checks passed
@johnmccrae johnmccrae deleted the jfm/chef17-patching-resolv2 branch March 26, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants