Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-7627

CreateSymbolicLinkW returns the wrong data type

    XMLWordPrintable

    Details

    • Template:
    • Team:
      Agent
    • Story Points:
      1
    • Sprint:
      Agent 2017-06-14
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Puppet's interface with the CreateSymbolicLinkW Windows API function previously defined an incorrect return type which could cause unexpected results in the case of an error.
    • QA Risk Assessment:
      Manual
    • QA Risk Assessment Reason:
      ruby API issue; should be covered in unit tests

      Description

      I was investigating why David Schmitt and I were getting different results from `Puppet::FileSystem.symlink` on Windows. His VM was correctly reporting an error and mine was silently failing.

      When run as a non-administrator user on my VM, `CreateSymbolicLinkW` would return non-zero (success for this function) when it should have failed. Going through the MSDN docs, I noticed that it returns a 1 byte `BOOLEAN` rather than the 4 byte `BOOL` that it is currently prototyped for with FFI (so I was getting a value with random data in the 3 upper bytes).

      Changing the FFI prototype for the function over to returning an `int8` resolved the problem for me (see linked PR).

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            tim.sharpe Tim Sharpe
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support