PowerShell / PSDscResources

MIT License
129 stars 53 forks source link

Archive: DSC resouce does not support paths longer than 260 #204

Open pubsquash opened 2 years ago

pubsquash commented 2 years ago

Details of the scenario you tried and the problem that is occurring

Trying to extract Oracle 19c package, there is one file which the archive DSC resource is failing on.

This is the path: C:\Utilities\DSC\Source\b9c366ec-18c4-4d1e-86ed-feca54f0e966\client\stage\Components\oracle.jdk\1.8.0.201.0\1\DataFiles\Expanded\filegroup3\lib\missioncontrol\plugins\com.jrockit.mc.console.ui.notification_5.5.2.174165\com.jrockit.mc.console.ui.notification_contexts.xml

Yes I could shorten the path but perhaps it would be a better solution to support long paths with: "\\?\"

Verbose logs showing the problem

C:\Utilities\DSC\Source\b9c366ec-18c4-4d1e-86ed-feca54f0e966\client\stage\Components\oracle.jdk\1.8.0.201.0\1\DataFiles \Expanded\filegroup3\lib\missioncontrol\plugins\com.jrockit.mc.console.ui.notification_5.5.2.174165\com.jrockit.mc.cons ole.ui.notification_contexts.xml VERBOSE: [XW0000E4UIS0001]: LCM: [ End Set ] [[Archive]Unzip] in 77.3050 seconds. PowerShell DSC resource MSFT_ArchiveResource failed to execute Set-TargetResource functionality with error message: An error was encountered while copying the archived file to C:\Utilities\DSC\Source\b9c366ec-18c4-4d1e-86ed-feca54f0e96 6\client\stage\Components\oracle.jdk\1.8.0.201.0\1\DataFiles\Expanded\filegroup3\lib\missioncontrol\plugins\com.jrockit .mc.console.ui.notification_5.5.2.174165\com.jrockit.mc.console.ui.notification_contexts.xml

Suggested solution to the issue

Support long paths with: "\\?\"

The DSC configuration that is used to reproduce the issue (as detailed as possible)

        Archive $ArchiveResourceName
        {
            Ensure      = "Present"
            Path        = $LocalArchivePath
            Destination = $ExtractDestination
            DependsOn   = "[xRemoteFile]$xRemoteFileResourceName"
            Force = $true
            Checksum = "ModifiedDate"
            Validate = $true
        }

The operating system the target node is running

Version and build of PowerShell the target node is running

Version of the DSC module that was used ('dev' if using current dev branch)

ImplementedAs Name ModuleName Version Properties


PowerShell Archive PSDesiredStateConfiguration 1.1