PowerShell / PowerShell/PSResourceGet

Get-PSResource searching module folders

Aperta
#1,012 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Area-GetPSResource
Lingua principale
C#
Stelle
576
Fork
114
Merge medio
1g 2h
PR unite (30g)
7

Descrizione

Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.
Steps to reproduce

If you run Get-PSResource you'll notice that its appears to be searching in the module directories instead of $env:PSModulePath. You can especially see this behavior when searching for an explicit module.

It should only be searching like this:

  1. Loop through PSModulePath
  2. If name is specified limit search to directories with that name
  3. If version number is found look one folder deeper for module manifest
Get-PSResource -Name PowerShellGet
Expected behavior
Only required folders are searched when getting resources.
Actual behavior
PS C:\> Get-PSResource -Name PowerShellGet-Verbose
VERBOSE: Retrieving directories in the path 'C:\Users\Thomas\Documents\PowerShell\Modules'
VERBOSE: Retrieving directories in the path 'C:\Users\Thomas\Documents\PowerShell\Scripts'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\AnyPackage'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\AnyPackage.Chocolatey'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\AnyPackage.PowerShellGet'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\AnyPackage.Scoop'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\AnyPackage.WinGet'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\ClassExplorer'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Cobalt'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\CompletionPredictor'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\DirectoryPredictor'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\EditorServicesCommandSuite'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Foil'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\InvokeBuild'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\kbupdate'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\kbupdate-library'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Microsoft.PowerShell.Archive'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Microsoft.PowerShell.ConsoleGuiTools'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Microsoft.PowerShell.Crescendo'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Microsoft.PowerShell.GraphicalTools'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Microsoft.PowerShell.TextUtility'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\NewFile'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PackageManagement'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Pester'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Plaster'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\platyPS'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerGit'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGetCompat'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PSCodeHealth'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PSDesiredStateConfiguration'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PSFramework'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PSReadLine'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PSScriptAnalyzer'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PSSQLite'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PSStringTemplate'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Scoop'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\ScriptLog'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\SNMP'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\SqlServer'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\TabExpansionPlusPlus'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\UniversalPackageManager.PowerShellGet'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\UniversalPackageManager.Provider.Msu'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Scripts\Export-PSObjectToINI.ps1'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Scripts\Get-WindowsAutoPilotInfo.ps1'
VERBOSE: Entering GetPSResource
VERBOSE: Searching through package path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet'
VERBOSE: Searching through package path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet'
VERBOSE: Searching through package version path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.19'
VERBOSE: Package version parsed as NuGet version: '3.0.19-beta19'
VERBOSE: Reading package metadata from: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.19\PSGetModuleInfo.xml'

VERBOSE: Searching through package version path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.17'
VERBOSE: Package version parsed as NuGet version: '3.0.17-beta17'
VERBOSE: Reading package metadata from: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.17\PSGetModuleInfo.xml'
VERBOSE: Searching through package version path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.16'
VERBOSE: Package version parsed as NuGet version: '3.0.16-beta16'
VERBOSE: Reading package metadata from: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.16\PSGetModuleInfo.xml'
VERBOSE: Searching through package version path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.14'
VERBOSE: Package version parsed as NuGet version: '3.0.14-beta14'
VERBOSE: Reading package metadata from: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.14\PSGetModuleInfo.xml'
VERBOSE: Searching through package version path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.12'
VERBOSE: The PSGetModuleInfo.xml file found at location: C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.12\PSGetModuleInfo.xml cannot be parsed due to TryReadPSGetInfo: Cannot read the PowerShellGet information file with error: Could not find file 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.12\PSGetModuleInfo.xml'.
VERBOSE: Searching through package version path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\2.2.5'
VERBOSE: Package version parsed as NuGet version: '2.2.5.0'
VERBOSE: Reading package metadata from: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\2.2.5\PSGetModuleInfo.xml'
Error details

No response

Environment data
Name          Version
----          -------
PowerShellGet 3.0.19

Name                           Value
----                           -----
PSVersion                      7.4.0-preview.2
PSEdition                      Core
GitCommitId                    7.4.0-preview.2
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Visuals

No response

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo Get-PSResource -Name PowerShellGet e rivedendo il punto di ingresso della ricerca di Get-PSResource. Traccia come $env:PSModulePath diventa i percorsi di ricerca, quindi aggiungi o aggiorna la copertura per il comportamento segnalato; il lavoro è completato quando una ricerca esplicita del modulo controlla solo le directory dei moduli e le sottocartelle delle versioni richieste.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp, powershell
Ambito
cli, tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.