Skip to content

Remove-Module doesn't care about casing, but Import-Module does care #3573

Description

PowerShell Core on Linux.

Steps to reproduce

# this works
Remove-Module psreadline
# this fails
Import-Module psreadline
# you need to run
Import-Module PSReadLine 

Expected behavior

Consistent behavior for both cmdlets.

Actual behavior

# this works
Remove-Module psreadline
# this fails
Import-Module psreadline

Environment data

PS /home/aleksandar> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.0-alpha
PSEdition                      Core
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.18
CLRVersion
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Activity

  1. iSazonov commented on Apr 16, 2017

    @iSazonov
    Collaborator

    Aleksandar Nikolić (@alexandair) Thanks for your report!

    I believe if on Unix we allow import different modules modulename and Modulename we should be case-sensitive in Remove-Module and Get-Module too?

  2. rkeithhill commented on Apr 16, 2017

    @rkeithhill
    Collaborator

    Is it a good idea to allow case-sensitive module names considering that Windows will not support such module names as its file system is case-insensitive? Seems like PowerShell should treat modules as case-insensitive. I don't see any value in allowing posh-git, Posh-Git and Posh-GIT to be different modules. I think that would just lead to confusion. IMO all of the module-related commands should be case-insensitive. And if on Linux someone has both mymodule and MyModule dirs. and is trying to import Mymodule, PowerShell should warn the user about the conflict.

  3. iSazonov commented on Apr 17, 2017

    @iSazonov
    Collaborator

    If we consider the module names as case-insensitive, then should we do the same in relation to the names of scripts and other PowerShell files?

  4. rkeithhill commented on Apr 17, 2017

    @rkeithhill
    Collaborator

    I don't think so. Script filename casing should following the OS's casing rules. That said, the PowerShell Gallery should consider warning (or rejecting) when publishing scripts that would stomp a different script with the same name on a case-insensitive file system. Either that or use some other means of disambiguation (author name, pub-date, version, etc).

  5. iSazonov commented on Apr 17, 2017

    @iSazonov
    Collaborator

    I expect that this will amaze users that .psm1 is case-insensitive and .ps1 case-sensitive.

  6. rkeithhill commented on Apr 17, 2017

    @rkeithhill
    Collaborator

    Loading a module by path doesn't have to follow the same rules as loading a module by name. Considering module "names" are backed by file system names, I'll admit this gets messy. But given that command names in PowerShell are case-insensitive, it seems like the right way to go.

  7. joeyaiello commented on Apr 17, 2017

    @joeyaiello
    Contributor

    I believe this is an application of the question raised in #706. Ideally, we should address this all up.

  8. modified the milestones: , on Sep 6, 2017
  9. SteveL-MSFT commented on Oct 12, 2017

    @SteveL-MSFT
    Member

    Dupe of #1621

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-DuplicateThe issue is a duplicate.WG-Cmdletsgeneral cmdlet issues

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions