You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am creating my own chocolatey packages to install zip files. Since upgrading to chocolatey 0.9.10.3 the installation of my package works, but uninstalling my package fails. This used to work on 0.9.9.8.
What is Expected?
chocolatey to uninstall my package without any errors
How Did You Get This To Happen? (Steps to Reproduce)
Simplified example using MyTest as a package...
tools\chocolateyinstall.ps1
# WARNING: This file needs to be saved as UTF-8 with BOM
# Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one.
$ErrorActionPreference = 'Stop'; # stop on all errors
$packageName = 'MyTest'
$destFolder = "C:\Temp\$packageName"
if ((Test-Path $destFolder) -eq $false) {
New-Item $destFolder -itemtype directory
}
# Unzip package
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$source = "$toolsDir\$packageName.zip"
Get-ChocolateyUnzip "$source" "$destFolder" "" "$packageName"
tools\chocolateyuninstall.ps1
# WARNING: This file needs to be saved as UTF-8 with BOM
# Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one.
$ErrorActionPreference = 'Stop'; # stop on all errors
$packageName = 'MyTest'
# UnInstall files
UnInstall-ChocolateyZipPackage "$packageName" "$packageName.zip"
tools\MyTest.zip just contains one file called MyTest.txt which is just a small text file
MyTest.nuspec
<?xml version="1.0" encoding="utf-8"?>
<!-- WARNING: This file needs to be saved as UTF-8 without BOM -->
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MyTest</id>
<title>MyTest</title>
<version>$version$</version>
<authors>MyTest</authors>
<owners>MyTest</owners>
<summary>$version$ MyTest</summary>
<description>$version$ MyTest</description>
<projectUrl>ssh://mytest.net</projectUrl>
<tags>MyTest</tags>
<copyright>2016</copyright>
<licenseUrl>http://mytest.net</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes></releaseNotes>
</metadata>
<files>
<file src="tools\**" target="tools" />
</files>
</package>
Chocolatey package is created using:
choco pack --version=1.0.0
Chocolatey package installed using:
choco install MyTest --source . -y
Chocolatey package uninstalled using:
choco uninstall MyTest -y
Output Log
Uninstalling the following packages:
MyTest
MyTest v1.0.0
C:\ProgramData\chocolatey\lib\MyTest\MyTest.zip.txt
ERROR: Cannot bind argument to parameter 'Path' because it is an empty string.
mytest uninstall not successful.
Error while running 'C:\ProgramData\chocolatey\lib\MyTest\tools\chocolateyuninstall.ps1'.
See log for details.
MyTest not uninstalled. An error occurred during uninstall:
mytest uninstall not successful.
Chocolatey uninstalled 0/1 packages. 1 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures
- mytest (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\MyTest\tools\chocolateyuninstall.ps1'.
See log for details.
C:\ProgramData\chocolatey\lib\MyTest\MyTest.zip.txt contains a trailing empty line:
C:\Temp\MyTest\MyTest.txt<CR><LF>
<CR><LF>
When I remove the trailing empty line (see below), and re-run choco uninstall, the uninstall works.
So I think there's either a problem with UnInstall-ChocolateyZipPackage not handling empty lines, or Get-ChocolateyUnzip erroneously logging an extra empty line. Or am I doing something wrong?
The text was updated successfully, but these errors were encountered:
When calling Uninstall-ChocolateyZipPackage, the text file may have an
empty string at the end of the file. This line should be skipped and
not tried to remove. Even though the ErrorAction is to
SilentlyContinue, it will fail if the arguments are not correct.
What You Are Seeing?
chocolatey version: 0.9.10.3
I am creating my own chocolatey packages to install zip files. Since upgrading to chocolatey 0.9.10.3 the installation of my package works, but uninstalling my package fails. This used to work on 0.9.9.8.
What is Expected?
chocolatey to uninstall my package without any errors
How Did You Get This To Happen? (Steps to Reproduce)
Simplified example using MyTest as a package...
tools\chocolateyinstall.ps1
tools\chocolateyuninstall.ps1
tools\MyTest.zip just contains one file called MyTest.txt which is just a small text file
MyTest.nuspec
Chocolatey package is created using:
Chocolatey package installed using:
Chocolatey package uninstalled using:
Output Log
C:\ProgramData\chocolatey\lib\MyTest\MyTest.zip.txt contains a trailing empty line:
When I remove the trailing empty line (see below), and re-run choco uninstall, the uninstall works.
C:\ProgramData\chocolatey\lib\MyTest\MyTest.zip.txt (modified):
So I think there's either a problem with UnInstall-ChocolateyZipPackage not handling empty lines, or Get-ChocolateyUnzip erroneously logging an extra empty line. Or am I doing something wrong?
The text was updated successfully, but these errors were encountered: