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

CreateSymbolicLinkW returns the wrong data type

    XMLWordPrintable

Details

    • Agent
    • 1
    • Agent 2017-06-14
    • Needs Assessment
    • Bug Fix
    • 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.
    • Manual
    • 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

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

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support