PowerShell / PowerShell/PowerShell

`Get-Command -UseFuzzyMatching` output includes duplicates

Open
#26,593 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Needs-Triage WG-Engine WG-NeedsReview
Dominant language
C#
Stars
55.5k
Forks
8.5k
Avg merge
1d 2h
Merged PRs (30d)
88

Description

Prerequisites
Steps to reproduce
Get-Command -Name Get-ChildItem -UseFuzzyMatching

# Or with -FuzzyMinimumDistance specified:
Get-Command -Name Get-ChildItem -UseFuzzyMatching -FuzzyMinimumDistance 5
Expected behavior

With either example command, only unique results are produced.

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Get-ChildItem                                      7.0.0.0    Microsoft.PowerShell.Management
Cmdlet          Get-Item                                           7.0.0.0    Microsoft.PowerShell.Management
Actual behavior

Duplicate results are produced by either example command.

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Get-ChildItem                                      7.0.0.0    Microsoft.PowerShell.Management
Cmdlet          Get-ChildItem                                      7.0.0.0    Microsoft.PowerShell.Management
Cmdlet          Get-ChildItem                                      7.0.0.0    Microsoft.PowerShell.Management
Cmdlet          Get-Item                                           7.0.0.0    Microsoft.PowerShell.Management
Cmdlet          Get-Item                                           7.0.0.0    Microsoft.PowerShell.Management
Cmdlet          Get-Item                                           7.0.0.0    Microsoft.PowerShell.Management

Cursory testing shows that at most, two duplicate results are produced irrespective of the command or -FuzzyMinimumDistance (but sometimes it's one or zero duplicates).

Environment data
Name                           Value
----                           -----
PSVersion                      7.6.0-preview.5
PSEdition                      Core
GitCommitId                    7.6.0-preview.5
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0, 5.0, 5.1…}
PSRemotingProtocolVersion      2.4
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the duplicate results with Get-Command -Name Get-ChildItem -UseFuzzyMatching, including the FuzzyMinimumDistance variant, then trace the fuzzy-matching path for Get-Command. Done means both commands return only unique results matching the expected output shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.