From a3a5c6b7749efb3811d02e93f199c04e8e8e9a38 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 6 Jun 2018 11:18:20 -0700 Subject: [PATCH 1/8] remove PSReadline from signing --- tools/releaseBuild/signing.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/releaseBuild/signing.xml b/tools/releaseBuild/signing.xml index ba6b1bdd77..0a85cef0b6 100644 --- a/tools/releaseBuild/signing.xml +++ b/tools/releaseBuild/signing.xml @@ -39,8 +39,6 @@ - - From b869f1b168ac61dd3041b0a60a033ae798b437d7 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 6 Jun 2018 12:15:33 -0700 Subject: [PATCH 2/8] Get the fix for this issue with installing fpm https://github.com/jordansissel/fpm/pull/1494 --- build.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index 80c43da5be..21fe206ecc 100644 --- a/build.psm1 +++ b/build.psm1 @@ -1671,7 +1671,7 @@ function Start-PSBootstrap { if($Environment.IsMacOS) { $gemsudo = $sudo } - Start-NativeExecution ([ScriptBlock]::Create("$gemsudo gem install fpm -v 1.9.3")) + Start-NativeExecution ([ScriptBlock]::Create("$gemsudo gem install fpm -v 1.10.0")) Start-NativeExecution ([ScriptBlock]::Create("$gemsudo gem install ronn -v 0.7.3")) } catch { Write-Warning "Installation of fpm and ronn gems failed! Must resolve manually." From 1aec38e14f5404c273a148742021a0ab06492c97 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 6 Jun 2018 13:05:10 -0700 Subject: [PATCH 3/8] make sure the path comparison is case insensitive. --- tools/packaging/packaging.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 35523b8d0e..a9771724cd 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -449,7 +449,7 @@ function New-PSSignedBuildZip # Replace unsigned binaries with signed $signedFilesFilter = Join-Path -Path $signedFilesPath -ChildPath '*' Get-ChildItem -path $signedFilesFilter -Recurse -File | Select-Object -ExpandProperty FullName | Foreach-Object -Process { - $relativePath = $_.Replace($signedFilesPath,'') + $relativePath = $_.ToLowerInvariant().Replace($signedFilesPath.ToLowerInvariant(),'') $destination = Join-Path -Path $buildPath -ChildPath $relativePath Write-Log "replacing $destination with $_" Copy-Item -Path $_ -Destination $destination -force From 587ce9df81c2a7128475ac9ef923c05249bb073d Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Wed, 6 Jun 2018 13:28:34 -0700 Subject: [PATCH 4/8] fix mac package name --- tools/packaging/packaging.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index a9771724cd..e69a263cd1 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -615,7 +615,7 @@ function New-UnixPackage { $IsPreview = Test-IsPreview -Version $Version # Preview versions have preview in the name - $Name = if ($IsPreview) { "powershell-preview" } else { "powershell" } + $Name = if ($IsPreview -and $Environment.IsLinux) { "powershell-preview" } else { "powershell" } # Verify dependencies are installed and in the path Test-Dependencies From 6c914c0faa16514f8fa881af959654dc7a3a231d Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Thu, 7 Jun 2018 21:15:03 +0000 Subject: [PATCH 5/8] Update the ChangeLog.md for 6.1.0-preview.3 release --- .spelling | 11 +++++++ CHANGELOG.md | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) diff --git a/.spelling b/.spelling index 83013884ad..5e076ca163 100644 --- a/.spelling +++ b/.spelling @@ -426,6 +426,17 @@ Dockerfile VisualStudio readonly PowerShell.6 +preview.3 +Auth +mcbobke +wesholton84 +Patochun +Jumplist +bjh7242 +beta2 +PSGallery +adelton +qmfrederik #endregion #region CODE_OF_CONDUCT.md Overrides diff --git a/CHANGELOG.md b/CHANGELOG.md index a5b96c42b2..3283016080 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,97 @@ # Changelog +## v6.1.0-preview.3 - 2018-06-07 + +### Breaking Changes + +- Clean up uses of `CommandTypes.Workflow` and `WorkflowInfo` (#6708) +- Disallow Basic Auth over HTTP in PowerShell Remoting on Unix (#6787) +- Change packaging to differentiate only between major versions and previews (#6968) + +### Engine Updates and Fixes + +- Fix crash when terminal is reset (#6777) +- Fix a module-loading regression that caused an infinite loop (#6843) +- Further improve `PSMethod` to `Delegate` conversion (#6851) +- Blacklist `System.Windows.Forms` from loading to prevent a crash (#6822) +- Fix `Format-Table` where rows were being trimmed unnecessarily if there's only one row of headers (#6772) +- Fix `SetDate` function in `libpsl-native` to avoid corrupting memory during `P/Invoke` (#6881) +- Fix tab completions for hash table (#6839) (Thanks @iSazonov!) +- Fix parser to continue parsing key-value pairs after an `If-Statement` value in a `HashExpression` (#7002) +- Add error handling for `#requires` in an interactive session (#6469) + +### General Cmdlet Updates and Fixes + +- Enhance and refactor `Add-Type` cmdlet (#6141) (Thanks @iSazonov!) +- Improve parameter validation in `ExportCsvHelper` (#6816) (Thanks @sethvs!) +- Quote `Multipart` form-data field names (#6782) (Thanks @markekraus!) +- Fix Web Cmdlets for .NET Core 2.1 (#6806) (Thanks @markekraus!) +- Fix `Set-Location DriveName:` to restore current working directory in the drive (#6774) (Thanks @mcbobke!) +- Add the alias `-lp` for `-LiteralPath` parameters #6732 (#6770) (Thanks @kvprasoon!) +- Remove `more` function and move the `$env:PAGER` capability into the `help` function (#6059) (Thanks @iSazonov!) +- Add line break to the error message for `Set-ExecutionPolicy` (#6803) (Thanks @wesholton84!) + +### Code Cleanup + +- Clean up `#if SILVERLIGHT` (#6907) (Thanks @iSazonov!) +- Clean up the unused method `NonWindowsGetDomainName()` (#6948) (Thanks @iSazonov!) +- Clean up FileSystem provider (#6909) (Thanks @iSazonov!) + +### Test + +- Add tests for PowerShell hosting API to verify MyGet packages (#6737) +- Remove Web Cmdlets tests using proxy environment variables (#6808) (Thanks @iSazonov!) +- Enable Web Cmdlets tests for greater platform support (#6836) (Thanks @markekraus!) +- Convert `ShouldBeErrorId` to `Should -Throw -ErrorId` in PowerShell tests (#6682) +- Fix CIM cmdlets tests (#6755) (Thanks @sethvs!) +- Add tests for PowerShell classes inheriting from abstract .NET classes (#6752) +- Fix `Select-Object.Tests.ps1` which previously failed intermittently on Unix platforms. (#6747) +- Update docker package tests to fix error on OpenSUSE 42 (#6783) +- Fix test and infrastructure that block code coverage runs (#6790) +- Update Tests `Isfile` to correct response for `"/"` (#6754) (Thanks @Patochun!) +- Improve code coverage in `Export-Csv.Tests.ps1` (#6795) (Thanks @sethvs!) +- Change `-Quiet` parameter of `Invoke-Pester` to `-Show None` in `OpenCover.psm1` (#6798) (Thanks @sethvs!) +- Replace `Dbg.Assert` with `if () throw` in `CSVCommands.cs` (#6910) (Thanks @sethvs!) +- Fix xUnit test `GetTempFileName` (#6943) (Thanks @iSazonov!) + +### Build and Packaging Improvements + +- Add Windows Compatibility Pack 2.0.0 to PowerShell Core and adopt the official .NET Core 2.1 (#6958) +- Add Jumplist 'Run as Administrator' to Taskbar on Windows (#6913, #6985) (Thanks @bergmeister!) +- Use AppVeyor matrix for faster Pull Request builds (#6945) (Thanks @bergmeister!) +- Fix `build.psm1` to not add tool path to $PATH twice (#6834) +- Add script to create a container manifest (#6735) +- Fix docker manifest creation script to work with more complex tags and with repeated use (#6852) +- Add functions to merge Pester and xUnit logs (#6854) +- Enable generating full symbols for the Windows debug build (#6853) +- Add functions into `build.psm1` to save and restore `PSOptions` between different sessions. (#6884) +- Update signing XML based on new signing guidelines (#6893) +- Update the release docker files to allow specifying the version of to-be-installed PowerShell and the version of image to use (#6835) +- Updates docker files for Fedora 27 and Kali Linux (#6819) +- Change packaging to support Ubuntu 17.10 and 18.04 (#6769) +- Update `Get-ChangeLog` to make it more accurate (#6764) +- Fix comparison to see if sudo test is needed in `install-*.sh` (#6771) (Thanks @bjh7242!) +- Packaging: Add registry keys to support library folder background for explorer context menu (#6784) (Thanks @bergmeister!) +- Skip `dotnet-cli` initialization and stop caching the `dotnet` folder for Travis CI (#7007) +- Skip compiling the non-supported cmdlets on Unix in `System.Management.Automation.dll` to fix the crash in Unix debug build (#6939) +- Use `PSReadLine` 2.0.0-beta2 from PSGallery (#6998) +- Update `PSRP` Linux NuGet package version to 1.4.2-* (#6711) +- Add path cleanup utility `Reset-PWSHSystemPath.ps1` (#6892) (Thanks @DarwinJS!) +- Add logic to create signing XML for NuGet packages (#6921) +- Add and config the `Settings.StyleCop` file (#6930, #6986) (Thanks @iSazonov!) +- Fix the double curly bracket typo in a docker file (#6960) (Thanks @adelton!) +- Remove dependencies on `libcurl` and `libunwind` in packaging to match the .NET Core behavior (#6964) (Thanks @qmfrederik!) +- Make the docker build fail when the curl operation fails. (#6961) (Thanks @adelton!) + +### Documentation and Help Content + +- Update installation doc about Raspbian (#6859) +- Add code coverage report generation instructions (#6515) +- Migrate docs from PowerShell repository to Docs repository (#6899) +- Fix broken links due to migrating GitHub docs on Installation, Known Issues and Breaking Changes to `docs.microsoft.com` (#6981) (Thanks @bergmeister!) +- Update documentation on how to write tests verifying errors conditions (#6687) +- Fix preview download links in `README.md` (#6762) + ## v6.1.0-preview.2 - 2018-04-27 ### Breaking Changes From d8a2861fa951b81ef3e1a82d3249bfc48630a545 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Thu, 7 Jun 2018 23:02:21 +0000 Subject: [PATCH 6/8] Update versions in README.md --- CHANGELOG.md | 3 ++- README.md | 40 +++++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3283016080..5ed742587a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ - Clean up uses of `CommandTypes.Workflow` and `WorkflowInfo` (#6708) - Disallow Basic Auth over HTTP in PowerShell Remoting on Unix (#6787) - Change packaging to differentiate only between major versions and previews (#6968) +- Enhance and refactor `Add-Type` cmdlet (#6141) (Thanks @iSazonov!) + - A few error strings were removed and thus the corresponding fully-qualified error ids are not in use anymore. ### Engine Updates and Fixes @@ -22,7 +24,6 @@ ### General Cmdlet Updates and Fixes -- Enhance and refactor `Add-Type` cmdlet (#6141) (Thanks @iSazonov!) - Improve parameter validation in `ExportCsvHelper` (#6816) (Thanks @sethvs!) - Quote `Multipart` form-data field names (#6782) (Thanks @markekraus!) - Fix Web Cmdlets for .NET Core 2.1 (#6806) (Thanks @markekraus!) diff --git a/README.md b/README.md index 335400ac1e..f40c10530f 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,8 @@ You can download and install a PowerShell package for any of the following platf | -------------------------------------------| ------------------------| ----------------------| ------------------------------| | [Windows (x64)][corefx-win] | [.msi][rl-windows-64] | [.msi][pv-windows-64] | [Instructions][in-windows] | | [Windows (x86)][corefx-win] | [.msi][rl-windows-86] | [.msi][pv-windows-86] | [Instructions][in-windows] | -| [Ubuntu 17.04][corefx-linux] | [.deb][rl-ubuntu17] | [.deb][pv-ubuntu17] | [Instructions][in-ubuntu17] | +| [Ubuntu 18.04][corefx-linux] | | [.deb][pv-ubuntu18] | [Instructions][in-ubuntu18] | +| [Ubuntu 17.10][corefx-linux] | | [.deb][pv-ubuntu17] | [Instructions][in-ubuntu17] | | [Ubuntu 16.04][corefx-linux] | [.deb][rl-ubuntu16] | [.deb][pv-ubuntu16] | [Instructions][in-ubuntu16] | | [Ubuntu 14.04][corefx-linux] | [.deb][rl-ubuntu14] | [.deb][pv-ubuntu14] | [Instructions][in-ubuntu14] | | [Debian 8.7+][corefx-linux] | [.deb][rl-debian8] | [.deb][pv-debian8] | [Instructions][in-deb8] | @@ -62,7 +63,6 @@ You can also download the PowerShell binary archives for Windows, macOS and Linu [rl-windows-64]: https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/PowerShell-6.0.2-win-x64.msi [rl-windows-86]: https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/PowerShell-6.0.2-win-x86.msi -[rl-ubuntu17]: https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/powershell_6.0.2-1.ubuntu.17.04_amd64.deb [rl-ubuntu16]: https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/powershell_6.0.2-1.ubuntu.16.04_amd64.deb [rl-ubuntu14]: https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/powershell_6.0.2-1.ubuntu.14.04_amd64.deb [rl-debian8]: https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/powershell_6.0.2-1.debian.8_amd64.deb @@ -78,27 +78,29 @@ You can also download the PowerShell binary archives for Windows, macOS and Linu [rl-linux-tar]: https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/powershell-6.0.2-linux-x64.tar.gz [rl-raspbian]: https://github.com/PowerShell/PowerShell/releases/download/v6.0.2/powershell-6.0.2-linux-arm32.tar.gz -[pv-windows-64]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/PowerShell-6.1.0-preview.2-win-x64.msi -[pv-windows-86]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/PowerShell-6.1.0-preview.2-win-x86.msi -[pv-ubuntu17]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/powershell_6.1.0-preview.2-1.ubuntu.17.04_amd64.deb -[pv-ubuntu16]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/powershell_6.1.0-preview.2-1.ubuntu.16.04_amd64.deb -[pv-ubuntu14]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/powershell_6.1.0-preview.2-1.ubuntu.14.04_amd64.deb -[pv-debian8]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/powershell_6.1.0-preview.2-1.debian.8_amd64.deb -[pv-debian9]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/powershell_6.1.0-preview.2-1.debian.9_amd64.deb -[pv-centos]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/powershell-6.1.0-preview.2-1.rhel.7.x86_64.rpm -[pv-macos]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/powershell-6.1.0-preview.2-osx.10.12-x64.pkg -[pv-winarm]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/PowerShell-6.1.0-preview.2-win-arm32.zip -[pv-winarm64]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/PowerShell-6.1.0-preview.2-win-arm64.zip -[pv-winx86-zip]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/PowerShell-6.1.0-preview.2-win-x86.zip -[pv-winx64-zip]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/PowerShell-6.1.0-preview.2-win-x64.zip -[pv-macos-tar]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/powershell-6.1.0-preview.2-osx-x64.tar.gz -[pv-linux-tar]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/powershell-6.1.0-preview.2-linux-x64.tar.gz -[pv-raspbian]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.2/powershell-6.1.0-preview.2-linux-arm32.tar.gz +[pv-windows-64]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/PowerShell-6.1.0-preview.3-win-x64.msi +[pv-windows-86]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/PowerShell-6.1.0-preview.3-win-x86.msi +[pv-ubuntu18]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/powershell-preview_6.1.0-preview.3-1.ubuntu.18.04_amd64.deb +[pv-ubuntu17]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/powershell-preview_6.1.0-preview.3-1.ubuntu.17.10_amd64.deb +[pv-ubuntu16]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/powershell-preview_6.1.0-preview.3-1.ubuntu.16.04_amd64.deb +[pv-ubuntu14]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/powershell-preview_6.1.0-preview.3-1.ubuntu.14.04_amd64.deb +[pv-debian8]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/powershell-preview_6.1.0-preview.3-1.debian.8_amd64.deb +[pv-debian9]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/powershell-preview_6.1.0-preview.3-1.debian.9_amd64.deb +[pv-centos]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/powershell-preview-6.1.0-preview.3-1.rhel.7.x86_64.rpm +[pv-macos]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/powershell-6.1.0-preview.3-osx.10.12-x64.pkg +[pv-winarm]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/PowerShell-6.1.0-preview.3-win-arm32.zip +[pv-winarm64]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/PowerShell-6.1.0-preview.3-win-arm64.zip +[pv-winx86-zip]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/PowerShell-6.1.0-preview.3-win-x86.zip +[pv-winx64-zip]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/PowerShell-6.1.0-preview.3-win-x64.zip +[pv-macos-tar]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/powershell-6.1.0-preview.3-osx-x64.tar.gz +[pv-linux-tar]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/powershell-6.1.0-preview.3-linux-x64.tar.gz +[pv-raspbian]: https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/powershell-6.1.0-preview.3-linux-arm32.tar.gz [in-windows]: https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-windows?view=powershell-6 [in-ubuntu14]: https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6#ubuntu-1404 [in-ubuntu16]: https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6#ubuntu-1604 -[in-ubuntu17]: https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6#ubuntu-1704 +[in-ubuntu17]: https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6#ubuntu-1710 +[in-ubuntu18]: https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6#ubuntu-1804 [in-deb8]: https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6#debian-8 [in-deb9]: https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6#debian-9 [in-centos]: https://docs.microsoft.com/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6#centos-7 From f08a031f88ce1d3866a21720bf8d832490a90652 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 8 Jun 2018 23:31:38 +0000 Subject: [PATCH 7/8] Merged PR 3079: Resolve Linux SxS conflicts and issues Fix man page conflict between stable and preview Linux package - rename preview man page pwsh-preview Fix /etc/shell entries not being created correctly for preview packages --- build.psm1 | 2 +- tools/packaging/packaging.psm1 | 44 +++++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/build.psm1 b/build.psm1 index 21fe206ecc..7110445214 100644 --- a/build.psm1 +++ b/build.psm1 @@ -2094,7 +2094,7 @@ function script:Start-NativeExecution try { if($VerboseOutputOnError.IsPresent) { - $output = & $sb + $output = & $sb 2>&1 } else { diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index e69a263cd1..927e976fe3 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -652,15 +652,17 @@ function New-UnixPackage { if($pscmdlet.ShouldProcess("Create package file system")) { + # refers to executable, does not vary by channel New-Item -Force -ItemType SymbolicLink -Path $linkSource -Target "$Destination/pwsh" >$null # Generate After Install and After Remove scripts - $AfterScriptInfo = New-AfterScripts + $AfterScriptInfo = New-AfterScripts -Link $Link # there is a weird bug in fpm # if the target of the powershell symlink exists, `fpm` aborts # with a `utime` error on macOS. # so we move it to make symlink broken + # refers to executable, does not vary by channel $symlink_dest = "$Destination/pwsh" $hack_dest = "./_fpm_symlink_hack_powershell" if ($Environment.IsMacOS) { @@ -671,14 +673,15 @@ function New-UnixPackage { } # Generate gzip of man file - $ManGzipInfo = New-ManGzip + $ManGzipInfo = New-ManGzip -IsPreview:$IsPreview # Change permissions for packaging Start-NativeExecution { find $Staging -type d | xargs chmod 755 find $Staging -type f | xargs chmod 644 chmod 644 $ManGzipInfo.GzipFile - chmod 755 "$Staging/pwsh" # only the executable should be executable + # refers to executable, does not vary by channel + chmod 755 "$Staging/pwsh" #only the executable file should be granted the execution permission } } @@ -1055,6 +1058,12 @@ function Test-Dependencies function New-AfterScripts { + param( + [Parameter(Mandatory)] + [string] + $Link + ) + if ($Environment.IsRedHatFamily) { # add two symbolic links to system shared libraries that libmi.so is dependent on to handle # platform specific changes. This is the only set of platforms needed for this currently @@ -1065,14 +1074,14 @@ function New-AfterScripts $AfterInstallScript = [io.path]::GetTempFileName() $AfterRemoveScript = [io.path]::GetTempFileName() - $packagingStrings.RedHatAfterInstallScript -f "$Link/pwsh" | Out-File -FilePath $AfterInstallScript -Encoding ascii - $packagingStrings.RedHatAfterRemoveScript -f "$Link/pwsh" | Out-File -FilePath $AfterRemoveScript -Encoding ascii + $packagingStrings.RedHatAfterInstallScript -f "$Link" | Out-File -FilePath $AfterInstallScript -Encoding ascii + $packagingStrings.RedHatAfterRemoveScript -f "$Link" | Out-File -FilePath $AfterRemoveScript -Encoding ascii } elseif ($Environment.IsUbuntu -or $Environment.IsDebian -or $Environment.IsSUSEFamily) { $AfterInstallScript = [io.path]::GetTempFileName() $AfterRemoveScript = [io.path]::GetTempFileName() - $packagingStrings.UbuntuAfterInstallScript -f "$Link/pwsh" | Out-File -FilePath $AfterInstallScript -Encoding ascii - $packagingStrings.UbuntuAfterRemoveScript -f "$Link/pwsh" | Out-File -FilePath $AfterRemoveScript -Encoding ascii + $packagingStrings.UbuntuAfterInstallScript -f "$Link" | Out-File -FilePath $AfterInstallScript -Encoding ascii + $packagingStrings.UbuntuAfterRemoveScript -f "$Link" | Out-File -FilePath $AfterRemoveScript -Encoding ascii } return [PSCustomObject] @{ @@ -1083,16 +1092,33 @@ function New-AfterScripts function New-ManGzip { + param( + [switch] + $IsPreview + ) + # run ronn to convert man page to roff $RonnFile = Join-Path $PSScriptRoot "/../../assets/pwsh.1.ronn" + if($IsPreview.IsPresent) + { + $newRonnFile = $RonnFile -replace 'pwsh', 'pwsh-preview' + Copy-Item -Path $RonnFile -Destination $newRonnFile -force + $RonnFile = $newRonnFile + } + $RoffFile = $RonnFile -replace "\.ronn$" # Run ronn on assets file - Start-NativeExecution { ronn --roff $RonnFile } + Start-NativeExecution { ronn --roff $RonnFile } -VerboseOutputOnError + + if($IsPreview.IsPresent) + { + Remove-item $RonnFile + } # gzip in assets directory $GzipFile = "$RoffFile.gz" - Start-NativeExecution { gzip -f $RoffFile } + Start-NativeExecution { gzip -f $RoffFile } -VerboseOutputOnError $ManFile = Join-Path "/usr/local/share/man/man1" (Split-Path -Leaf $GzipFile) From 0d67d4dc3a38a2030b26a0a81ae485fa2c243b49 Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Mon, 11 Jun 2018 23:06:08 +0000 Subject: [PATCH 8/8] Merged PR 3115: Use Directory.CreateDirectory instead of DirectoryInfo.CreateSubDirectory Change to use Directory.CreateDirectory because of regression introduced by https://github.com/dotnet/corefx/pull/27810 in creating a subdirectory under root path. --- .../namespaces/FileSystemProvider.cs | 5 +---- .../FileSystem.Tests.ps1 | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/System.Management.Automation/namespaces/FileSystemProvider.cs b/src/System.Management.Automation/namespaces/FileSystemProvider.cs index 7f80af1965..ba306edf9a 100644 --- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs +++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs @@ -2599,10 +2599,7 @@ namespace Microsoft.PowerShell.Commands if (ShouldProcess(resource, action)) { - // Use the parent directory to create the sub-directory - - DirectoryInfo parentDirectory = new DirectoryInfo(parentPath); - DirectoryInfo result = parentDirectory.CreateSubdirectory(childName); + var result = Directory.CreateDirectory(Path.Combine(parentPath, childName)); if (streamOutput) { diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 index a2738d0428..f25667e494 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 @@ -1396,3 +1396,21 @@ Describe "Remove-Item UnAuthorized Access" -Tags "CI", "RequireAdminOnWindows" { Get-Content $errorFile | Should -BeExactly 'RemoveItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.RemoveItemCommand' } } + +Describe "Verify sub-directory creation under root" -Tag 'CI','RequireSudoOnUnix' { + BeforeAll { + $dirPath = "\TestDir-$((New-Guid).Guid)" + } + + AfterAll { + if(Test-Path $dirPath) + { + Remove-Item -Path $dirPath -Force -ErrorAction SilentlyContinue + } + } + + It "Can create a sub directory under root path" { + New-Item -Path $dirPath -ItemType Directory -Force > $null + $dirPath | Should -Exist + } +}