PowerShell / PowerShell/PowerShell
Get-Module -ListAvailable doesn't respect DefaultPrefix
まだ誰も着手していません。
- 主要言語
- C#
- スター
- 55.5k
- フォーク
- 8.5k
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 88
説明
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
Use any module that has the DefaultCommandPrefix defined in the module manifest. I modified one of my modules to test with.
In Windows PowerShell, if I have a module that uses a defined prefix, this works as expected.
Expected behavior
PS C:\> $mod = Get-Module PSChristmas -ListAvailable
PS C:\> $mod.ExportedFunctions.keys
New-xElfName
Get-xPSChristmasPresent
New-xPSChristmasGreeting
New-xPSChristmas
Show-xPSChristmasMessage
Invoke-xJingle
Write-xFestive
The module is NOT loaded into my session. But not in PowerShell 7. PowerShell 7 fails to use the prefix.
Actual behavior
PS C:\> $mod = Get-Module PSChristmas -ListAvailable
PS C:\> $mod.ExportedFunctions.keys
New-ElfName
Get-PSChristmasPresent
New-PSChristmasGreeting
New-PSChristmas
Show-PSChristmasMessage
Invoke-Jingle
Write-Festive
If I import the module in PowerShell 7 and re-run the command then it works.
PS C:\> import-module pschristmas
PS C:\> $mod = Get-Module PSChristmas
PS C:\> $mod.ExportedFunctions.keys
Get-xPSChristmasPresent
Invoke-xJingle
New-xElfName
New-xPSChristmas
New-xPSChristmasGreeting
Show-xPSChristmasMessage
Write-xFestive
Environment data
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.19043
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Also tested in 7.2.0-preview.4 with the same results.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
DefaultCommandPrefix を定義するモジュールマニフェストで問題を再現し、その後、Get-Module -ListAvailable と Import-Module 後の動作を比較します。list-available パスでエクスポートされた関数がどのように設定されるかを追跡します。モジュールがインポートされる前に、一覧表示されたエクスポート関数名にマニフェストのプレフィックスが含まれていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- powershell
- 領域
- cli
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100