PowerShell / PowerShell/PSResourceGet
`Get-PSResource` does not search in user context environment variable `PSModulePath`
まだ誰も着手していません。
- 主要言語
- C#
- スター
- 576
- フォーク
- 114
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 7
説明
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
PackageManagement, PowerShellGetv2 and PowerShellGet 3.0.18-beta (and prior versions) does not search in directorories specified in user context environmental variable PSModulePath when searching for modules. But at least v3 has a -Path parameter.
Reproduce:
- Install
Az.Accountsto%LOCALAPPDATA%\Microsoft\PowerShell\Modulesby usingSave-PSResource. - Make sure said module is not installed any other places specified in
$env:PSModulePath.- Or rather any other default locations for PowerShell modules I guess.
- Make sure
%LOCALAPPDATA%\Microsoft\PowerShell\Modulesis specified inHKCU:\Environment\PSModulePath, and that PowerShell loaded it into$env:PSModulePathat start. Should also be seen in[System.Environment]::GetEnvironmentVariable('PSModulePath','User'). - Search for installed modules with
PowerShellGet\Get-PSResource -Name 'Az.Accounts'. Result: Not found. - Add
-Scope 'CurrentUser: Nope, still not found. - Add
-Path ('{0}\Microsoft\PowerShell\Modules' -f $env:LOCALAPPDATA): Found.
Microsoft.PowerShell.Core\Import-Module and Get-Module works as expected.
Expected behavior
PowerShellGet\Get-PSResource should search in all PSModulePath paths, also those specified in user context environmental variable.
Actual behavior
It does not.
Error details
No response
Environment data
PowerShellGet v3.0.18
Windows PowerShell 5.1 x64 on Windows 10 22H2
Visuals
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、Get-PSResource -Name 'Az.Accounts' とユーザーコンテキストの PSModulePath エントリを使用して、Windows PowerShell 5.1 のケースを再現します。Get-PSResource の検索実装を追跡し、そのパス処理を明示的な -Path および -Scope CurrentUser のケースと比較します。-Path を指定しなくてもユーザーコンテキストの PSModulePath の場所にあるリソースが見つかり、このシナリオのリグレッションカバレッジが用意されていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- csharp, powershell
- 領域
- cli, tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100