Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-Alias / Set-Alias shouldn't allow the alias target to be the same as the alias name. #20153

Open
5 tasks done
mklement0 opened this issue Aug 22, 2023 · 0 comments
Open
5 tasks done
Labels
Issue-Enhancement the issue is more of a feature request than a bug Needs-Triage The issue is new and needs to be triaged by a work group. WG-Cmdlets-Utility cmdlets in the Microsoft.PowerShell.Utility module

Comments

@mklement0
Copy link
Contributor

mklement0 commented Aug 22, 2023

Prerequisites

Steps to reproduce

Defining an alias whose target names is the same as the alias' itself makes no sense, yet:

  • such a definition is currently quietly accepted.
  • then fails on invocation.
# Note: 'oss' is a built-in *function*

Set-Alias oss oss

oss -?

Expected behavior

The Set-Alias call should fail.

Actual behavior

The Set-Alias definition is quietly accepted.

On trying to invoke the alias, a "is not recognized as a name of a cmdlet, function, script file, or executable program." error occurs.

Error details

No response

Environment data

PowerShell 7.4.0-preview.4

Visuals

No response

@mklement0 mklement0 added the Needs-Triage The issue is new and needs to be triaged by a work group. label Aug 22, 2023
@StevenBucher98 StevenBucher98 added WG-Cmdlets-Utility cmdlets in the Microsoft.PowerShell.Utility module Issue-Enhancement the issue is more of a feature request than a bug labels Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement the issue is more of a feature request than a bug Needs-Triage The issue is new and needs to be triaged by a work group. WG-Cmdlets-Utility cmdlets in the Microsoft.PowerShell.Utility module
Projects
None yet
Development

No branches or pull requests

2 participants