Skip to content

NoClobber WinCompat module import - #12269

Merged
Dongbo Wang (daxian-dbw) merged 13 commits into
PowerShell:masterfrom
anmenaga:wincompat-11419
Apr 16, 2020
Merged

Dongbo Wang (daxian-dbw) merged 13 commits into
PowerShell:masterfrom
anmenaga:wincompat-11419

Conversation

@anmenaga

@anmenaga Andrew (anmenaga) commented Apr 7, 2020 •

Copy link
Copy Markdown

PR Summary

Fix #11419
This addresses an issue where Windows PowerShell proxy modules have a priority over PS Core modules during WinCompat module import. (see #11419 )

PR Context

Implicit PS Remoting code (reused by WinCompat) is doing Export-PSSession -AllowClobber.
The fix is to omit -AllowClobber parameter if WinCompat:

  1. is either importing a module that is one of the engine modules:
"Microsoft.PowerShell.Utility",
"Microsoft.PowerShell.Management",
"Microsoft.PowerShell.Diagnostics",
"Microsoft.PowerShell.Host",
"Microsoft.PowerShell.Security",
"Microsoft.WSMan.Management",
"Microsoft.PowerShell.Commands.Utility",
"Microsoft.PowerShell.Commands.Management",
"Microsoft.PowerShell.Commands.Diagnostics",
"Microsoft.PowerShell.ConsoleHost"
  1. or is importing a module specified in powershell.config.json in WindowsPowerShellCompatibilityNoClobberModuleList list. (this list is empty by default)

If a module falls into one of these buckets, then PS-Core version of the module is imported first (for engine modules from $PSHOME\Modules), then proxies are generated for WinPS version of the module without -AllowClobber flag. This result s in proxy modules not having PS Core commands.

Fix #11419
Fix #12014

Also fixed a bug where WinCompat module DenyList was not working for module names containing dots . in some cases.

PR Checklist

@anmenaga Andrew (anmenaga) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Apr 7, 2020
@anmenaga Andrew (anmenaga) added this to the 7.1.0-preview.2 milestone Apr 7, 2020
@iSazonov

Copy link
Copy Markdown
Collaborator

Do we want to have the fix as servicing one for 7.0 LTS?

@daxian-dbw

Copy link
Copy Markdown
Member

PoshChan-Bot (@PoshChan) please retry windows

@PoshChan

Copy link
Copy Markdown
Collaborator

Dongbo Wang (@daxian-dbw), successfully started retry of PowerShell-CI-Windows

@anmenaga Andrew (anmenaga) changed the title NoClobber WinCompat module import WIP: NoClobber WinCompat module import Apr 8, 2020
@anmenaga Andrew (anmenaga) changed the title WIP: NoClobber WinCompat module import NoClobber WinCompat module import Apr 14, 2020

@rjmholt Rob Holt (rjmholt) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, but I think there are some cases with module specifications that need dealing with. Also left some style comments

@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Apr 14, 2020
@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Apr 15, 2020
@anmenaga

Copy link
Copy Markdown
Author

PoshChan-Bot (@PoshChan) please retry windows

@PoshChan

Copy link
Copy Markdown
Collaborator

Andrew (@anmenaga), successfully started retry of PowerShell-CI-Windows

@ghost

Copy link
Copy Markdown

🎉v7.1.0-preview.2 has been released which incorporates this pull request.:tada:

Handy links:

@ghost

Copy link
Copy Markdown

🎉v7.0.1 has been released which incorporates this pull request.:tada:

Handy links:

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

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

8 participants