diff --git a/.uppercut b/.uppercut index 6deb8c7a1e..249505f86e 100644 --- a/.uppercut +++ b/.uppercut @@ -18,7 +18,7 @@ - + diff --git a/CHANGELOG.md b/CHANGELOG.md index 38377540d5..0968e1b129 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,27 @@ +## [0.9.10.2](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.10.2+is%3Aclosed) (June 19, 2016) + +### BUG FIXES + + * Fix - Chocolatey Licensed is unable to find 0.9.10.x (only 0.9.10.0) - see [#814](https://github.com/chocolatey/choco/issues/814) + * Fix - Logging is broken in some packages due to new TEMP directory - see [#813](https://github.com/chocolatey/choco/issues/813) + * [API] Fix - When performing an Install/Uninstall/Upgrade operation through the API, an error is throw for "chocolatey.resources" - see [#811](https://github.com/chocolatey/choco/issues/811) + +### IMPROVEMENTS + + * Ensure log file path exists - and fix the log file arguments if necessary - see [#758](https://github.com/chocolatey/choco/issues/758) + + +## [0.9.10.1](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.10.1+is%3Aclosed) (June 18, 2016) + +### BUG FIXES + + * Fix - Cannot bind argument to parameter 'exitCode' because it is null - see [#810](https://github.com/chocolatey/choco/issues/810) + +### IMPROVEMENTS + + * [Security] Upgrade to 7zip 16.02 to overcome CVE-2016-2334/CVE-2016-2335 - see [#812](https://github.com/chocolatey/choco/issues/812) + + ## [0.9.10](https://github.com/chocolatey/choco/issues?q=milestone%3A0.9.10+is%3Aclosed) (June 17, 2016) ![Chocolatey Logo](https://cdn.rawgit.com/chocolatey/choco/14a627932c78c8baaba6bef5f749ebfa1957d28d/docs/logo/chocolateyicon.gif "Chocolatey") diff --git a/nuget/chocolatey/chocolatey.nuspec b/nuget/chocolatey/chocolatey.nuspec index f66fd8806c..b4626ff510 100644 --- a/nuget/chocolatey/chocolatey.nuspec +++ b/nuget/chocolatey/chocolatey.nuspec @@ -55,6 +55,30 @@ In that mess there is a link to the [PowerShell Chocolatey module reference](htt See all - https://github.com/chocolatey/choco/blob/stable/CHANGELOG.md +## 0.9.10.2 + +### BUG FIXES + + * Fix - Chocolatey Licensed is unable to find 0.9.10.x (only 0.9.10.0) - see [#814](https://github.com/chocolatey/choco/issues/814) + * Fix - Logging is broken in some packages due to new TEMP directory - see [#813](https://github.com/chocolatey/choco/issues/813) + * [API] Fix - When performing an Install/Uninstall/Upgrade operation through the API, an error is throw for "chocolatey.resources" - see [#811](https://github.com/chocolatey/choco/issues/811) + +### IMPROVEMENTS + + * Ensure log file path exists - and fix the log file arguments if necessary - see [#758](https://github.com/chocolatey/choco/issues/758) + + +## 0.9.10.1 + +### BUG FIXES + + * Fix - Cannot bind argument to parameter 'exitCode' because it is null - see [#810](https://github.com/chocolatey/choco/issues/810) + +### IMPROVEMENTS + + * [Security] Upgrade to 7zip 16.02 to overcome CVE-2016-2334/CVE-2016-2335 - see [#812](https://github.com/chocolatey/choco/issues/812) + + ## 0.9.10 The "I got 99 problems, but a package manager ain't one" release. With the release of 0.9.10 (or if you prefer 0.9.10.0), we're about to make everything 100% better in your Windows package management world. We've addressed over 100 features and bugs in this release. We looked at how we could improve PowerShell and we've come out with a [competely internal host](https://github.com/chocolatey/choco/issues/8) that can Prompt and Read-Host in a way that times out and selects default values after a period of time. Speaking of PowerShell, how about some tab completion `choco <tab>` to `choco install node<tab>`? How about never having to [close and reopen your shell again](https://github.com/chocolatey/choco/issues/664)? diff --git a/nuget/chocolatey/tools/chocolateysetup.psm1 b/nuget/chocolatey/tools/chocolateysetup.psm1 index 50b1ebad0d..83f8a3c706 100644 --- a/nuget/chocolatey/tools/chocolateysetup.psm1 +++ b/nuget/chocolatey/tools/chocolateysetup.psm1 @@ -126,6 +126,9 @@ Creating Chocolatey folders if they do not already exist. Add-ChocolateyProfile Install-DotNet4IfMissing + if ($env:ChocolateyExitCode -eq $null -or $env:ChocolateyExitCode -eq '') { + $env:ChocolateyExitCode = 0 + } @" Chocolatey (choco.exe) is now ready. diff --git a/src/chocolatey.console/Program.cs b/src/chocolatey.console/Program.cs index 30554ce404..fee891f655 100644 --- a/src/chocolatey.console/Program.cs +++ b/src/chocolatey.console/Program.cs @@ -19,7 +19,7 @@ namespace chocolatey.console using System.Collections.Generic; using System.IO; using System.Linq; - using infrastructure.adapters; + using System.Reflection; using infrastructure.app; using infrastructure.app.builders; using infrastructure.app.configuration; @@ -31,6 +31,7 @@ namespace chocolatey.console using infrastructure.logging; using infrastructure.registration; using resources; + using Assembly = infrastructure.adapters.Assembly; using Console = System.Console; using Environment = System.Environment; using IFileSystem = infrastructure.filesystem.IFileSystem; @@ -43,6 +44,8 @@ private static void Main(string[] args) { try { + add_assembly_resolver(); + string loggingLocation = ApplicationParameters.LoggingLocation; //no file system at this point if (!Directory.Exists(loggingLocation)) Directory.CreateDirectory(loggingLocation); @@ -161,6 +164,26 @@ private static void Main(string[] args) } } + private static ResolveEventHandler _handler = null; + + private static void add_assembly_resolver() + { + _handler = (sender, args) => + { + var requestedAssembly = new AssemblyName(args.Name); + if (requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey) + && !requestedAssembly.Name.is_equal_to("chocolatey.licensed") + && !requestedAssembly.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase)) + { + return typeof(ConsoleApplication).Assembly; + } + + return null; + }; + + AppDomain.CurrentDomain.AssemblyResolve += _handler; + } + private static void report_version_and_exit_if_requested(string[] args, ChocolateyConfiguration config) { if (args == null || args.Length == 0) return; diff --git a/src/chocolatey.resources/helpers/chocolateyScriptRunner.ps1 b/src/chocolatey.resources/helpers/chocolateyScriptRunner.ps1 index 5461a05278..5acfcc5635 100644 --- a/src/chocolatey.resources/helpers/chocolateyScriptRunner.ps1 +++ b/src/chocolatey.resources/helpers/chocolateyScriptRunner.ps1 @@ -58,7 +58,7 @@ if ($env:ChocolateyExitCode -ne $null -and $env:ChocolateyExitCode -ne '') { $exitCode = $env:ChocolateyExitCode } -if ($exitCode -ne 0) { +if ($exitCode -ne $null -and $exitCode -ne '' -and $exitCode -ne 0) { Set-PowerShellExitCode $exitCode } diff --git a/src/chocolatey.resources/helpers/functions/Get-ChocolateyUnzip.ps1 b/src/chocolatey.resources/helpers/functions/Get-ChocolateyUnzip.ps1 index 27ed30fec7..90226ea38e 100644 --- a/src/chocolatey.resources/helpers/functions/Get-ChocolateyUnzip.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-ChocolateyUnzip.ps1 @@ -36,6 +36,9 @@ publicly (like on the community feed). Otherwise, please use Install-ChocolateyZipPackage to download those resources from their official distribution points. +Starting in 0.9.10, will automatically call Set-PowerShellExitCode to +set the package exit code based on 7-zip's exit code. + .PARAMETER FileFullPath This is the full path to the zip file. If embedding it in the package next to the install script, the path will be like @@ -93,7 +96,7 @@ param( } Write-Host "Extracting $fileFullPath to $destination..." - if (![System.IO.Directory]::Exists($destination)) {[System.IO.Directory]::CreateDirectory($destination)} + if (![System.IO.Directory]::Exists($destination)) { [System.IO.Directory]::CreateDirectory($destination) | Out-Null } $7zip = Join-Path "$helpersPath" '..\tools\7za.exe' if (!([System.IO.File]::Exists($7zip))) { diff --git a/src/chocolatey.resources/helpers/functions/Get-FtpFile.ps1 b/src/chocolatey.resources/helpers/functions/Get-FtpFile.ps1 index 114362a8a1..ae19ff9e24 100644 --- a/src/chocolatey.resources/helpers/functions/Get-FtpFile.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-FtpFile.ps1 @@ -26,6 +26,9 @@ FileName location specified. This is a low-level function and not recommended for use in package scripts. It is recommended you call `Get-ChocolateyWebFile` instead. +Starting in 0.9.10, will automatically call Set-PowerShellExitCode to +set the package exit code to 404 if the resource is not found. + .INPUTS None diff --git a/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 b/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 index bc6865cfbc..3a995b8778 100644 --- a/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 @@ -36,6 +36,9 @@ to the FileName location specified. This is a low-level function and not recommended for use in package scripts. It is recommended you call `Get-ChocolateyWebFile` instead. +Starting in 0.9.10, will automatically call Set-PowerShellExitCode to +set the package exit code to 404 if the resource is not found. + .INPUTS None diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 index 85a85fefb1..5cdea6f164 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyInstallPackage.ps1 @@ -197,11 +197,30 @@ Pro / Business supports a single, ubiquitous install directory option. } $overrideArguments = $env:chocolateyInstallOverride; + # remove \chocolatey\chocolatey\ + $silentArgs = $silentArgs -replace '\\chocolatey\\chocolatey\\', '\chocolatey\' + $additionalInstallArgs = $additionalInstallArgs -replace '\\chocolatey\\chocolatey\\', '\chocolatey\' + + try { + # make sure any logging folder exists + $pattern = "(?:['`"])([a-zA-Z]\:\\[^'`"]+)(?:[`"'])|([a-zA-Z]\:\\[\S]+)" + $silentArgs, $additionalInstallArgs | %{ Select-String $pattern -input $_ -AllMatches } | + % { $_.Matches } | % { + $argDirectory = $_.Groups[1] + if ($argDirectory -eq $null -or $argDirectory -eq '') { continue } + $argDirectory = [System.IO.Path]::GetFullPath([System.IO.Path]::GetDirectoryName($argDirectory)) + Write-Debug "Ensuring '$argDirectory' exists" + if (![System.IO.Directory]::Exists($argDirectory)) { [System.IO.Directory]::CreateDirectory($argDirectory) | Out-Null } + } + } catch { + Write-Debug "Error ensuring directories exist - $($_.Exception.Message)" + } + if ($fileType -like 'msi') { $msiArgs = "/i `"$file`"" if ($overrideArguments) { $msiArgs = "$msiArgs $additionalInstallArgs"; - Write-Host "Overriding package arguments with `'$additionalInstallArgs`'"; + Write-Host "Overriding package arguments with '$additionalInstallArgs'"; } else { $msiArgs = "$msiArgs $silentArgs $additionalInstallArgs"; } @@ -212,7 +231,7 @@ Pro / Business supports a single, ubiquitous install directory option. if ($fileType -like 'exe') { if ($overrideArguments) { $env:ChocolateyExitCode = Start-ChocolateyProcessAsAdmin "$additionalInstallArgs" $file -validExitCodes $validExitCodes - write-host "Overriding package arguments with `'$additionalInstallArgs`'"; + Write-Host "Overriding package arguments with '$additionalInstallArgs'"; } else { $env:ChocolateyExitCode = Start-ChocolateyProcessAsAdmin "$silentArgs $additionalInstallArgs" $file -validExitCodes $validExitCodes } @@ -222,11 +241,12 @@ Pro / Business supports a single, ubiquitous install directory option. if ($overrideArguments) { $msuArgs = "$file $additionalInstallArgs" + Write-Host "Overriding package arguments with '$additionalInstallArgs'"; } else { $msuArgs = "$file $silentArgs $additionalInstallArgs" } $env:ChocolateyExitCode = Start-ChocolateyProcessAsAdmin "$msuArgs" "$($env:SystemRoot)\System32\wusa.exe" -validExitCodes $validExitCodes } - write-host "$packageName has been installed." + Write-Host "$packageName has been installed." } diff --git a/src/chocolatey.resources/helpers/functions/Set-PowerShellExitCode.ps1 b/src/chocolatey.resources/helpers/functions/Set-PowerShellExitCode.ps1 index ad360c4d0d..a730e29038 100644 --- a/src/chocolatey.resources/helpers/functions/Set-PowerShellExitCode.ps1 +++ b/src/chocolatey.resources/helpers/functions/Set-PowerShellExitCode.ps1 @@ -41,10 +41,15 @@ Allows splatting with arguments that do not apply. Do not use directly. Set-PowerShellExitCode 3010 #> param ( - [parameter(Mandatory=$true, Position=0)][int] $exitCode, + [parameter(Mandatory=$false, Position=0)][int] $exitCode, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) + if ($exitCode -eq $null -or $exitCode -eq '') { + Write-Debug '$exitCode was passed null' + return + } + try { $host.SetShouldExit($exitCode); } catch { diff --git a/src/chocolatey.resources/helpers/functions/Start-ChocolateyProcessAsAdmin.ps1 b/src/chocolatey.resources/helpers/functions/Start-ChocolateyProcessAsAdmin.ps1 index 8aa51ba11b..377fa19d56 100644 --- a/src/chocolatey.resources/helpers/functions/Start-ChocolateyProcessAsAdmin.ps1 +++ b/src/chocolatey.resources/helpers/functions/Start-ChocolateyProcessAsAdmin.ps1 @@ -23,6 +23,12 @@ specified, it is run with PowerShell. .NOTES This command will assert UAC/Admin privileges on the machine. +Starting in 0.9.10, will automatically call Set-PowerShellExitCode to +set the package exit code in the following ways: + +- 4 if the binary turns out to be a text file. +- The same exit code returned from the process that is run. If a 3010 is returned, it will set 3010 for the package. + .INPUTS None diff --git a/src/chocolatey.resources/tools/7za.exe b/src/chocolatey.resources/tools/7za.exe index 7f6bf86bc4..3bc851d5fc 100644 Binary files a/src/chocolatey.resources/tools/7za.exe and b/src/chocolatey.resources/tools/7za.exe differ diff --git a/src/chocolatey.resources/tools/7zip.license.txt b/src/chocolatey.resources/tools/7zip.license.txt index f87b67ef11..d10eb27d6e 100644 --- a/src/chocolatey.resources/tools/7zip.license.txt +++ b/src/chocolatey.resources/tools/7zip.license.txt @@ -1,30 +1,56 @@ - 7-Zip Extra - ~~~~~~~~~~~ - License for use and distribution - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 7-Zip + ~~~~~ + License for use and distribution + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Copyright (C) 1999-2015 Igor Pavlov. + 7-Zip Copyright (C) 1999-2016 Igor Pavlov. - 7-Zip Extra files are under the GNU LGPL license. + Licenses for files are: - - Notes: - You can use 7-Zip Extra on any computer, including a computer in a commercial - organization. You don't need to register or pay for 7-Zip. + 1) 7z.dll: GNU LGPL + unRAR restriction + 2) All other files: GNU LGPL + The GNU LGPL + unRAR restriction means that you must follow both + GNU LGPL rules and unRAR restriction rules. - GNU LGPL information - -------------------- - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + Note: + You can use 7-Zip on any computer, including a computer in a commercial + organization. You don't need to register or pay for 7-Zip. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - You can receive a copy of the GNU Lesser General Public License from - http://www.gnu.org/ + GNU LGPL information + -------------------- + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You can receive a copy of the GNU Lesser General Public License from + http://www.gnu.org/ + + + unRAR restriction + ----------------- + + The decompression engine for RAR archives was developed using source + code of unRAR program. + All copyrights to original unRAR code are owned by Alexander Roshal. + + The license for original unRAR code has the following restriction: + + The unRAR sources cannot be used to re-create the RAR compression algorithm, + which is proprietary. Distribution of modified unRAR sources in separate form + or as a part of other software is permitted, provided that it is clearly + stated in the documentation and source comments that the code may + not be used to develop a RAR (WinRAR) compatible archiver. + + + -- + Igor Pavlov diff --git a/src/chocolatey/GetChocolatey.cs b/src/chocolatey/GetChocolatey.cs index 7490ec351b..fe2a30f821 100644 --- a/src/chocolatey/GetChocolatey.cs +++ b/src/chocolatey/GetChocolatey.cs @@ -52,7 +52,9 @@ private static void add_assembly_resolver() _handler = (sender, args) => { var requestedAssembly = new AssemblyName(args.Name); - if (requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey)) + if (requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey) + && !requestedAssembly.Name.is_equal_to("chocolatey.licensed") + && !requestedAssembly.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase)) { return typeof(Lets).Assembly; } diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index 064df8e6e7..a6cfae746f 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -310,13 +310,13 @@ private static void set_global_options(IList args, ChocolateyConfigurati { option_set .Add("d|debug", - "Debug - Run in Debug Mode.", + "Debug - Show debug messaging.", option => config.Debug = option != null) .Add("v|verbose", - "Verbose - See verbose messaging.", + "Verbose - Show verbose messaging.", option => config.Verbose = option != null) .Add("acceptlicense|accept-license", - "AcceptLicense - Accept license dialogs automatically.", + "AcceptLicense - Accept license dialogs automatically. Reserved for future use.", option => config.AcceptLicense = option != null) .Add("y|yes|confirm", "Confirm all prompts - Chooses affirmative answer instead of prompting. Implies --accept-license", @@ -326,10 +326,10 @@ private static void set_global_options(IList args, ChocolateyConfigurati config.AcceptLicense = option != null; }) .Add("f|force", - "Force - force the behavior", + "Force - force the behavior. Do not use force during normal operation - it subverts some of the smart behavior for commands.", option => config.Force = option != null) .Add("noop|whatif|what-if", - "NoOp - Don't actually do anything.", + "NoOp / WhatIf - Don't actually do anything.", option => config.Noop = option != null) .Add("r|limitoutput|limit-output", "LimitOutput - Limit the output to essential information", @@ -355,7 +355,7 @@ private static void set_global_options(IList args, ChocolateyConfigurati "FailOnStandardError - Fail on standard error output (stderr), typically received when running external commands during install providers. This overrides the feature failOnStandardError.", option => config.Features.FailOnStandardError = option != null) .Add("use-system-powershell", - "UseSystemPowerShell - Execute PowerShell using an external process instead of the built-in PowerShell host. Available in 0.9.10+.", + "UseSystemPowerShell - Execute PowerShell using an external process instead of the built-in PowerShell host. Should only be used when internal host is failing. Available in 0.9.10+.", option => config.Features.UsePowerShellHost = option == null) ; }, diff --git a/src/chocolatey/infrastructure.app/templates/TemplateValues.cs b/src/chocolatey/infrastructure.app/templates/TemplateValues.cs index eb265fd0e4..338ba37340 100644 --- a/src/chocolatey/infrastructure.app/templates/TemplateValues.cs +++ b/src/chocolatey/infrastructure.app/templates/TemplateValues.cs @@ -36,7 +36,7 @@ public void set_normal() InstallerType = "EXE_MSI_OR_MSU"; Url = ""; Url64 = ""; - SilentArgs = @"/qn /norestart /l*v `""$($env:TEMP)\chocolatey\$($packageName)\$($packageName).MsiInstall.log`"""; + SilentArgs = @"/qn /norestart /l*v `""$($env:TEMP)\$($packageName).$($env:chocolateyPackageVersion).MsiInstall.log`"""; AutomaticPackageNotesNuspec = ""; Checksum = ""; ChecksumType = "md5";