From eacfd9418cf088ef6c1c026fc972350cd8255692 Mon Sep 17 00:00:00 2001 From: Manikyam Bavandla Date: Fri, 29 Jul 2016 16:35:20 -0700 Subject: [PATCH 1/4] Revert "Merge pull request #1458 from PowerShell/psedition_rename" This reverts commit 042d1e99bb0661ae697dfef0ade6cc55f4cceb06, reversing changes made to 105bf9c9ffbadd4f0e7d63b6113976521573e5ea. --- .../Microsoft.PowerShell.Archive.psm1 | 2 +- .../Microsoft.PowerShell.Utility.psm1 | 4 ++-- src/Modules/Shared/PowerShellGet/PSModule.psm1 | 9 +++------ .../Windows-Core+Full/PSDiagnostics/PSDiagnostics.psm1 | 2 +- .../engine/Modules/NewModuleManifestCommand.cs | 2 +- src/System.Management.Automation/engine/PSVersionInfo.cs | 6 ++++-- src/System.Management.Automation/engine/Utils.cs | 2 +- test/powershell/Host/PSVersionTable.Tests.ps1 | 2 +- 8 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/Modules/Shared/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psm1 b/src/Modules/Shared/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psm1 index e179118c24..908e248e93 100644 --- a/src/Modules/Shared/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psm1 +++ b/src/Modules/Shared/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psm1 @@ -464,7 +464,7 @@ function GetResolvedPathHelper function Add-CompressionAssemblies { - if ($PSEdition -eq "WindowsPowerShell") + if ($PSEdition -eq "Desktop") { Add-Type -AssemblyName System.IO.Compression Add-Type -AssemblyName System.IO.Compression.FileSystem diff --git a/src/Modules/Shared/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1 b/src/Modules/Shared/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1 index 7a5f06360e..2328d1dc91 100644 --- a/src/Modules/Shared/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1 +++ b/src/Modules/Shared/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1 @@ -587,7 +587,7 @@ function ConvertFrom-SddlString Begin { # On CoreCLR CryptoKeyRights and ActiveDirectoryRights are not supported. - if ($PSEdition -eq "PowerShellCore" -and ($Type -eq "CryptoKeyRights" -or $Type -eq "ActiveDirectoryRights")) + if ($PSEdition -eq "Core" -and ($Type -eq "CryptoKeyRights" -or $Type -eq "ActiveDirectoryRights")) { $errorId = "TypeNotSupported" $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument @@ -622,7 +622,7 @@ function ConvertFrom-SddlString { param($AccessMask, $Type) - if ($PSEdition -eq "PowerShellCore") + if ($PSEdition -eq "Core") { ## All the types of access rights understood by .NET Core $rightTypes = [Ordered] @{ diff --git a/src/Modules/Shared/PowerShellGet/PSModule.psm1 b/src/Modules/Shared/PowerShellGet/PSModule.psm1 index 3bf44f236c..ed6449f934 100644 --- a/src/Modules/Shared/PowerShellGet/PSModule.psm1 +++ b/src/Modules/Shared/PowerShellGet/PSModule.psm1 @@ -12545,7 +12545,7 @@ function Update-ModuleManifest $ProcessorArchitecture, [Parameter()] - [ValidateSet('WindowsPowerShell','PowerShellCore')] + [ValidateSet('Desktop','Core')] [string[]] $CompatiblePSEditions, @@ -14147,8 +14147,6 @@ function Test-MicrosoftCertificate $AuthenticodeSignature ) - $result = $false - if($AuthenticodeSignature.SignerCertificate) { try @@ -14162,11 +14160,10 @@ function Test-MicrosoftCertificate } $SafeX509ChainHandle = [Microsoft.PowerShell.Commands.PowerShellGet.Win32Helpers]::CertDuplicateCertificateChain($X509Chain.ChainContext) - $result = [Microsoft.PowerShell.Commands.PowerShellGet.Win32Helpers]::IsMicrosoftCertificate($SafeX509ChainHandle) - $SafeX509ChainHandle.Close() + return [Microsoft.PowerShell.Commands.PowerShellGet.Win32Helpers]::IsMicrosoftCertificate($SafeX509ChainHandle) } - return $result + return $false } function Test-ValidManifestModule diff --git a/src/Modules/Windows-Core+Full/PSDiagnostics/PSDiagnostics.psm1 b/src/Modules/Windows-Core+Full/PSDiagnostics/PSDiagnostics.psm1 index 2e5e94a02d..52016fbb4e 100644 --- a/src/Modules/Windows-Core+Full/PSDiagnostics/PSDiagnostics.psm1 +++ b/src/Modules/Windows-Core+Full/PSDiagnostics/PSDiagnostics.psm1 @@ -433,7 +433,7 @@ namespace Microsoft.PowerShell.Diagnostics "@ -if ($psedition.ToLower() -eq "powershellcore") +if ($psedition.ToLower() -eq "core") { # Currently we only support these cmdlets as logman.exe is not working on Nano/Lot system. Export-ModuleMember Enable-PSTrace, Disable-PSTrace, Get-LogProperties, Set-LogProperties diff --git a/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs b/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs index e78a3d6d7b..b6fd098958 100644 --- a/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs +++ b/src/System.Management.Automation/engine/Modules/NewModuleManifestCommand.cs @@ -386,7 +386,7 @@ namespace Microsoft.PowerShell.Commands /// [Parameter] [AllowEmptyCollection] - [ValidateSet("WindowsPowerShell", "PowerShellCore")] + [ValidateSet("Desktop", "Core")] [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Cmdlets use arrays for parameters.")] public string[] CompatiblePSEditions diff --git a/src/System.Management.Automation/engine/PSVersionInfo.cs b/src/System.Management.Automation/engine/PSVersionInfo.cs index 7a8ba3b8b6..396a402556 100644 --- a/src/System.Management.Automation/engine/PSVersionInfo.cs +++ b/src/System.Management.Automation/engine/PSVersionInfo.cs @@ -50,9 +50,11 @@ namespace System.Management.Automation /// Linux -- All PS on Linux flavors. This may need to be subdivided based on compatibility between distros. /// #if !CORECLR - internal const string PSEditionValue = "WindowsPowerShell"; + internal const string PSEditionValue = "Desktop"; +#elif LINUX + internal const string PSEditionValue = "Linux"; #else - internal const string PSEditionValue = "PowerShellCore"; + internal const string PSEditionValue = "Core"; #endif // Static Constructor. diff --git a/src/System.Management.Automation/engine/Utils.cs b/src/System.Management.Automation/engine/Utils.cs index ea1fbc3c51..7a5dbe7bcb 100644 --- a/src/System.Management.Automation/engine/Utils.cs +++ b/src/System.Management.Automation/engine/Utils.cs @@ -71,7 +71,7 @@ namespace System.Management.Automation /// /// Allowed PowerShell Editions /// - internal static string[] AllowedEditionValues = { "WindowsPowerShell", "PowerShellCore" }; + internal static string[] AllowedEditionValues = { "Desktop", "Core" }; /// /// helper fn to check byte[] arg for null. diff --git a/test/powershell/Host/PSVersionTable.Tests.ps1 b/test/powershell/Host/PSVersionTable.Tests.ps1 index 880fd241b4..7d2d5b5bb2 100644 --- a/test/powershell/Host/PSVersionTable.Tests.ps1 +++ b/test/powershell/Host/PSVersionTable.Tests.ps1 @@ -20,6 +20,6 @@ Describe "PSVersionTable" -Tags "CI" { } It "Should have the correct edition" -Skip:(!$IsCoreCLR) { - $PSVersionTable["PSEdition"] | Should Be "PowerShellCore" + $PSVersionTable["PSEdition"] | Should Be "Core" } } From f68660511dae61843eb4fe105e30e623a3ccece2 Mon Sep 17 00:00:00 2001 From: Manikyam Bavandla Date: Fri, 29 Jul 2016 16:36:15 -0700 Subject: [PATCH 2/4] Remove redundent .ToLower() in PSDiagnostics.psm1 --- src/Modules/Windows-Core+Full/PSDiagnostics/PSDiagnostics.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Modules/Windows-Core+Full/PSDiagnostics/PSDiagnostics.psm1 b/src/Modules/Windows-Core+Full/PSDiagnostics/PSDiagnostics.psm1 index 52016fbb4e..38fe05ee7a 100644 --- a/src/Modules/Windows-Core+Full/PSDiagnostics/PSDiagnostics.psm1 +++ b/src/Modules/Windows-Core+Full/PSDiagnostics/PSDiagnostics.psm1 @@ -433,7 +433,7 @@ namespace Microsoft.PowerShell.Diagnostics "@ -if ($psedition.ToLower() -eq "core") +if ($psedition -eq 'Core') { # Currently we only support these cmdlets as logman.exe is not working on Nano/Lot system. Export-ModuleMember Enable-PSTrace, Disable-PSTrace, Get-LogProperties, Set-LogProperties From 5eef2cacc45caea969a6dde237dd93f918fa1828 Mon Sep 17 00:00:00 2001 From: Manikyam Bavandla Date: Wed, 3 Aug 2016 15:53:22 -0700 Subject: [PATCH 3/4] Removed Linux PSEdition name --- demos/crontab/CronTab/CronTab.psd1 | 2 +- src/System.Management.Automation/engine/PSVersionInfo.cs | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/demos/crontab/CronTab/CronTab.psd1 b/demos/crontab/CronTab/CronTab.psd1 index 15c279cbba..4c8f772bf2 100755 --- a/demos/crontab/CronTab/CronTab.psd1 +++ b/demos/crontab/CronTab/CronTab.psd1 @@ -7,7 +7,7 @@ RootModule = 'CronTab.psm1' ModuleVersion = '0.1.0.0' # Supported PSEditions -CompatiblePSEditions = @('Linux') +CompatiblePSEditions = @('Core') # ID used to uniquely identify this module GUID = '508bb97f-de2e-482e-aae2-01caec0be8c7' diff --git a/src/System.Management.Automation/engine/PSVersionInfo.cs b/src/System.Management.Automation/engine/PSVersionInfo.cs index 396a402556..590d3791d9 100644 --- a/src/System.Management.Automation/engine/PSVersionInfo.cs +++ b/src/System.Management.Automation/engine/PSVersionInfo.cs @@ -51,8 +51,6 @@ namespace System.Management.Automation /// #if !CORECLR internal const string PSEditionValue = "Desktop"; -#elif LINUX - internal const string PSEditionValue = "Linux"; #else internal const string PSEditionValue = "Core"; #endif From 93d4129a3b64e29627f0898e14520ae2f8eda707 Mon Sep 17 00:00:00 2001 From: Manikyam Bavandla Date: Wed, 3 Aug 2016 16:27:47 -0700 Subject: [PATCH 4/4] Reverting PSEdition name changes. --- docs/learning-powershell/powershell-beginners-guide.md | 2 +- .../Cmdlets/CmdletWithSearchAndSource.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/learning-powershell/powershell-beginners-guide.md b/docs/learning-powershell/powershell-beginners-guide.md index a4046fbce4..fa544ba719 100644 --- a/docs/learning-powershell/powershell-beginners-guide.md +++ b/docs/learning-powershell/powershell-beginners-guide.md @@ -186,7 +186,7 @@ Type **$PSVersionTable** in your PowerShell session, you will see something like Name Value ---- ----- PSVersion 5.1.10032.0 -PSEdition Linux +PSEdition Core PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 3.0.0.0 CLRVersion diff --git a/src/Microsoft.PowerShell.PackageManagement/Cmdlets/CmdletWithSearchAndSource.cs b/src/Microsoft.PowerShell.PackageManagement/Cmdlets/CmdletWithSearchAndSource.cs index 50b48e6f49..f239de1088 100644 --- a/src/Microsoft.PowerShell.PackageManagement/Cmdlets/CmdletWithSearchAndSource.cs +++ b/src/Microsoft.PowerShell.PackageManagement/Cmdlets/CmdletWithSearchAndSource.cs @@ -43,7 +43,7 @@ namespace Microsoft.PowerShell.PackageManagement.Cmdlets { internal readonly OrderedDictionary> _resultsPerName = new OrderedDictionary>(); protected List _providersNotFindingAnything = new List(); #if CORECLR - internal static readonly string[] ProviderFilters = new[] { "Packagemanagement", "Provider", "PSEdition_PowerShellCore" }; + internal static readonly string[] ProviderFilters = new[] { "Packagemanagement", "Provider", "PSEdition_Core" }; #else internal static readonly string[] ProviderFilters = new[] { "Packagemanagement", "Provider" }; #endif