Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with xArchive when file names contain brackets. #255

Closed
bielawb opened this issue Oct 19, 2016 · 0 comments
Closed

Error with xArchive when file names contain brackets. #255

bielawb opened this issue Oct 19, 2016 · 0 comments
Labels
bug The issue is a bug.

Comments

@bielawb
Copy link
Contributor

bielawb commented Oct 19, 2016

In certain scenarios xArchive will fail. It seems to show up only in set certain scenarios:
-- zip file has a name that contains bracket
-- one of the files in the zip contains bracket, but most files are synced already (e.g. if file in question was removed).

Repro:

configuration BracketsInZip {
    Import-DscResource -ModuleName @{ 
        ModuleName = 'xPSDesiredStateConfiguration'
        RequiredVersion = '4.0.0.0' 
    }
    xArchive test {
        Path = 'C:\temp\testZip[.zip'
        Destination = 'C:\temp\TestWithBracket'
    }

}

configuration BracketsInsideZip {
    Import-DscResource -ModuleName @{ 
        ModuleName = 'xPSDesiredStateConfiguration'
        RequiredVersion = '4.0.0.0' 
    }
    xArchive test {
        Path = 'C:\temp\testZip.zip'
        Destination = 'C:\temp\TestWithBracket'
    }

}

# Testing zip file with odd name...
BracketsInZip -OutputPath c:\temp\bracket
Start-DscConfiguration -Path c:\temp\bracket -Wait -Verbose

# Error message...
PowerShell DSC resource MSFT_xArchive  failed to execute Test-TargetResource functionality with error message: The specified wildcard character pattern is not valid: testZip[.zip 


# Testing zip file that contains files with odd name...
BracketsInsideZip -OutputPath c:\temp\bracket
Start-DscConfiguration -Path c:\temp\bracket -Wait -Verbose -Force

# Error message...
VERBOSE: [ASUS]:                            [[xArchive]test] Writing to file C:\temp\TestWithBracket\testZip\testFile[
VERBOSE: [ASUS]: LCM:  [ End    Set      ]  [[xArchive]test]  in 0.1300 seconds.
PowerShell DSC resource MSFT_xArchive  failed to execute Set-TargetResource functionality with error message: Cannot retrieve the dynamic parameters for the cmdlet. The specified wildcard 
character pattern is not valid: testFile[ 

The fix: use -LiteralPath whenever possible. -Path assumes wildcards and shouldn't be used as individual files (rather than wildcards) are expected as input to any cmdlet called.

@kwirkykat kwirkykat added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Oct 20, 2016
@kwirkykat kwirkykat self-assigned this Nov 29, 2016
lfshr added a commit to lfshr/xPSDesiredStateConfiguration that referenced this issue Nov 30, 2016
@kwirkykat kwirkykat removed the help wanted The issue is up for grabs for anyone in the community. label Dec 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants