Uploaded image for project: 'Modules'
  1. Modules
  2. MODULES-2804

Misuse of the read method of Win32::Registry Class

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • None
    • reboot
    • Puppet agent 3.8.2

    • 2
    • Windows 2015-12-02

    Description

      The read method of Win32::Registry class actually returns a [type, data] array if the value exists, but it's used as if it returns just the data in methods like package_installer?, pending_computer_rename?.

      In most cases, there is no problem with it because the detecting result is determined by whether the registry value exists or not, not by the data. But it's probably cause trouble sometimes. Unit tests didn't catch this since the return value is mocked as data, not [type, data]...

        def reg_value(path, value)
          rval = nil
       
          with_key(path) do |reg|
            rval = reg.read(value)
          end
       
          rval
        end
      

      The same problem in pending_rename_operations?.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              digglife Eric Zhu
              Ryan Gard Ryan Gard
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support