Skip to content

Test-FileCatalog does not work on PSCore. #5594

Closed

Description

@BerheAbrha

Steps to reproduce

  1. Create new file catalog for one of the modules in your system (using New-FileCatlog)
  2. Run Test-FileCatlog on the catalog created in step 1.
New-FileCatalog -CatalogFilePath "C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\pester.cat"  -Path "C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0"

Test-FileCatalog "C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\pester.cat"

Expected behavior

PS C:\DSC-tests\DSC\Tests\PullServerClient\BVT> Test-FileCatalog "C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\pester.cat" -Detailed


Status        : Valid
HashAlgorithm : SHA1
CatalogItems  : {[Functions\Coverage.ps1, F4022ABD45FE0FB2C3527A539F022E2AFDF16851], [Functions\Assertions\BeGreaterThan.ps1, 
                EEE62A89040021D1F3B2B86D8B6C4884AF7C8925], [bin\Pester.bat, E20AF79E7EC1B2DBA3DF7600C46E9CA613DF1A3C], [Functions\GlobalMock-A.Tests.ps1, 
                DF7F6F009A46AE9386C01A2350741C264FB4163D]...}
PathItems     : {[Build.bat, B4FEDB2F7522EB6EEA68EEA73A095EBA8E441926], [build.psake.ps1, 70DA7E6DF0664C0E791C32C31E14924B779A6938], [CHANGELOG.md, 
                86F6D42CC7389E38952ED741BFACE73A2C755119], [chocolateyInstall.ps1, 013A7B468B830C37FA51518E56933ACE54889CCC]...}
Signature     : System.Management.Automation.Signature


Actual behavior

PS C:\InGuestPolicyx64> Test-FileCatalog "C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\pester.cat"

<NO OUTPUT>

Environment data

PS C:\InGuestPolicyx64> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.0-beta
PSEdition                      Core
GitCommitId                    v6.0.0-beta.6-dirty
OS                             Microsoft Windows 10.0.16250
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Activity

  1. markekraus commented on Dec 1, 2017

    @markekraus
    Contributor

    Ilya (@iSazonov) This appears to be caused by #3074. Can you take a look? there appears to be no code path for when -Path is not supplied. In 5.1 supplying just -CatalogFilePath (position 0) would use the directory of the catalog file. This is performed in PerformAction() which is never reached because ProcessRecord() doesn't have any code paths for null -Path.

  2. markekraus commented on Dec 1, 2017

    @markekraus
    Contributor

    Berhe (@BerheAbrha) you can work around this by supplying the -Path and -CatalogFilePath:

    Example:

    New-FileCatalog -CatalogFilePath C:\temp\temp.cat -Path C:\temp\
    Test-FileCatalog -Path C:\temp\ -CatalogFilePath C:\temp\temp.cat -Detailed

    Also, judging from your PSVersiontable, you are not on the latest version of PS core. However, i was able to repro this for you on

    Name                           Value
    ----                           -----
    PSVersion                      6.0.0-rc
    PSEdition                      Core
    GitCommitId                    v6.0.0-rc
    OS                             Microsoft Windows 10.0.15063
    Platform                       Win32NT
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
    PSRemotingProtocolVersion      2.3
    SerializationVersion           1.1.0.1
    WSManStackVersion              3.0
    
  3. SteveL-MSFT commented on Dec 1, 2017

    @SteveL-MSFT
    Member

    The problem appears to be line 117 was moved inside the if statement when it should stay where it was outside of it. I'll submit a fix.

  4. iSazonov commented on Dec 1, 2017

    @iSazonov
    Collaborator

    My bad 😕

  5. SteveL-MSFT commented on Dec 1, 2017

    @SteveL-MSFT
    Member

    Ilya (@iSazonov) no worries, I'm just adding some tests and should have a PR soon

  6. BerheAbrha commented on Dec 1, 2017

    @BerheAbrha
    Author

    Mark Kraus (@markekraus), It does work when the path is supplied to the cmdlet. But it is regression from WMF 5.1 where path is not required. This broke signature validation logic in DSC.

    PS C:\InGuestPolicyx64> Test-FileCatalog -CatalogFilePath "C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\peste
    r.cat" -Detailed -Path "C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0"
    
    
    Status        : Valid
    HashAlgorithm : SHA1
    CatalogItems  : {[Functions\Coverage.ps1, F4022ABD45FE0FB2C3527A539F022E2AFDF16851],
                    [Functions\Assertions\BeGreaterThan.ps1, EEE62A89040021D1F3B2B86D8B6C4884AF7C8925], [bin\Pester.bat,
                    E20AF79E7EC1B2DBA3DF7600C46E9CA613DF1A3C], [Functions\GlobalMock-A.Tests.ps1,
                    DF7F6F009A46AE9386C01A2350741C264FB4163D]...}
    PathItems     : {[Build.bat, B4FEDB2F7522EB6EEA68EEA73A095EBA8E441926], [build.psake.ps1,
                    70DA7E6DF0664C0E791C32C31E14924B779A6938], [CHANGELOG.md, 86F6D42CC7389E38952ED741BFACE73A2C755119],
                    [chocolateyInstall.ps1, 013A7B468B830C37FA51518E56933ACE54889CCC]...}
    Signature     : System.Management.Automation.Signature
    
  7. added a commit that references this issue on Dec 1, 2017
    b69ff71
  8. markekraus commented on Dec 1, 2017

    @markekraus
    Contributor

    Berhe (@BerheAbrha) Yes it was a regression. i was letting you know the workaround while the issue was being addressed. #5596 has addressed the issue and this should be fixed in 6.0.0-GA 😃 , Thanks for reporting!

  9. added 2 commits that reference this issue on Dec 2, 2017
    72bc90f
    2b7c223
  10. added 2 commits that reference this issue on Aug 6, 2026
    b8b3ffa
    039b01c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions