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

Puppet::FileSystem.unlink fails on Windows when the target path doesn't exist

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.2.0
    • Fix Version/s: PUP 4.2.2
    • Component/s: Windows
    • Labels:
    • Template:
    • Story Points:
      2
    • Sprint:
      Windows 2015-08-26
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      There was a an issue with removing a symlink that links to a target that no longer exists. It would cause Puppet to error. This fixes that behavior so the symlink is removed without error.

      Description

      When attempting to delete a symlink on Windows for a target path that no longer exists, Puppet throws a Permission Denied error.

      This was discovered during the work for MODULES-2175.

      [1] pry(DscSymlink)> e.class
      => Errno::EACCES
      

      Expected: The link should be removed.

      Repro: To reproduce, create a symlink, delete the target path and then try to unlink it:

          it "should unlink a symlink if the existing link path does not exist" do
            path =   Dir.mktmpdir('test')
            symlink_path = "#{path}\\link"
            link_target = Dir.mktmpdir('link_test')
            Puppet::FileSystem.symlink(link_target, symlink_path, { :force => true})
            system("rmdir /s /q \"#{link_target}\"")
       
            Puppet::FileSystem.unlink(symlink_path)
          end
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ryan.gard Ryan Gard
                Reporter:
                rob Rob Reynolds
                QA Contact:
                Ryan Gard
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support