Fetch the registry value not the type #2684
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Facter's product release resolver called
Win32::Registry#eachand incorrectly assumed the second parameter was thevalue, when actually it was thetype. Note theeachmethod is an alias foreach_value, which yields three parameters:name,typeandvalue[1]`The issue wasn't noticed because the code also called
Win32::Registry#[]to get the value and the tests incorrectly stubbed the Windows registry behavior.Commit 2c291fe assumed the second parameter was the
value, as a result theos.windowsfacts had a value of 1, which corresponds toREG_SZ[2]:This isn't the first time we've had problems with overstubbing in facter, see 6e7970e, 86048b5, 5818550
Fixes #2683
[1] https://github.com/ruby/ruby/blob/v3_2_3/ext/win32/lib/win32/registry.rb#L579
[2] https://github.com/ruby/ruby/blob/v3_2_3/ext/win32/lib/win32/registry.rb#L114