Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot uninstall packages with uppercase package IDs on Mono #2409

Closed
TheCakeIsNaOH opened this issue Oct 16, 2021 · 3 comments · Fixed by #2957
Closed

Cannot uninstall packages with uppercase package IDs on Mono #2409

TheCakeIsNaOH opened this issue Oct 16, 2021 · 3 comments · Fixed by #2957
Labels
3 - Review Bug Priority_LOW Requires NuGet.Client Change This issue requires a modification to something in referenced NuGet.Client library.

Comments

@TheCakeIsNaOH
Copy link
Member

TheCakeIsNaOH commented Oct 16, 2021

What You Are Seeing?

When running on Mono on Linux (Mac probably also affected), choco fails to uninstall packages with package IDs that contain uppercase characters.

What is Expected?

Choco is able to uninstall all packages.

How Did You Get This To Happen? (Steps to Reproduce)

On a system with docker with linux containers:

docker run --rm -it chocolatey/choco /bin/bash
choco install wget 
choco uninstall wget

I'm thinking that packageManager.LocalRepository.FindPackage is the issue, could be wrong though.

Output Log

Full Log Output with uninstall wget

root@c1ab833bcdc0:~# choco uninstall wget --debug --verbose
Chocolatey v0.11.2-51-g43132590
Chocolatey is running on Linux v 5.10.0.0
Attempting to delete file "/opt/chocolatey/chocolatey.dll.old".
Attempting to delete file "/opt/chocolatey/choco.exe.old".
Command line: /opt/chocolatey/choco.exe uninstall wget --debug --verbose
Received arguments: uninstall wget --debug --verbose
RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
Sending message 'PreRunMessage' out if there are subscribers...
[Pending] Removing all pending packages that should not be considered installed...
Performing validation checks.
Global Configuration Validation Checks:
 - Package Exit Code / Exit On Reboot = Checked
System State Validation Checks:
The source 'https://community.chocolatey.org/api/v2/' evaluated to a 'normal' source type

NOTE: Hiding sensitive configuration data! Please double and triple
 check to be sure no sensitive data is shown, especially if copying
 output to a gist for review.
Configuration: CommandName='uninstall'|CacheLocation='/tmp/chocolatey'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources='https://community.chocolatey.org/api/v2/'|SourceType='normal'|
Debug='True'|Verbose='True'|Trace='False'|Force='False'|Noop='False'|
HelpRequested='False'|UnsuccessfulParsing='False'|RegularOutput='True'|
QuietOutput='False'|PromptForConfirmation='True'|AcceptLicense='False'|
AllowUnofficialBuild='False'|Input='wget'|AllVersions='False'|
SkipPackageInstallProvider='False'|PackageNames='wget'|
Prerelease='False'|ForceX86='False'|OverrideArguments='False'|
NotSilent='False'|ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
AllowMultipleVersions='False'|AllowDowngrade='False'|
ForceDependencies='False'|Information.PlatformType='Linux'|
Information.PlatformVersion='5.10.0.0'|
Information.PlatformName='Linux'|
Information.ChocolateyVersion='0.12.0.0'|
Information.ChocolateyProductVersion='0.11.2-51-g43132590'|
Information.FullName='chocolatey, Version=0.12.0.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|

Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='False'|
Information.UserName='root'|Information.UserDomainName='c1ab833bcdc0'|
Information.IsUserAdministrator='False'|
Information.IsUserSystemAccount='False'|
Information.IsUserRemoteDesktop='False'|
Information.IsUserRemote='True'|
Information.IsProcessElevated='False'|
Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|
Information.CurrentDirectory='/root'|Features.AutoUninstaller='True'|
Features.ChecksumFiles='True'|Features.AllowEmptyChecksums='False'|
Features.AllowEmptyChecksumsSecure='True'|
Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.LogWithoutColor='False'|
Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseEnhancedExitCodes='False'|
Features.UseFipsCompliantChecksums='False'|
Features.ShowNonElevatedWarnings='True'|
Features.ShowDownloadProgress='True'|
Features.StopOnFirstPackageFailure='False'|
Features.UseRememberedArgumentsForUpgrades='False'|
Features.IgnoreUnfoundPackagesOnUpgradeOutdated='False'|
Features.SkipPackageUpgradesWhenNotInstalled='False'|
Features.RemovePackageInformationOnUninstall='False'|
Features.ExitOnRebootDetected='False'|
Features.LogValidationResultsOnWarnings='True'|
Features.UsePackageRepositoryOptimizations='True'|
Features.ScriptsCheckLastExitCode='False'|
ListCommand.LocalOnly='False'|
ListCommand.IdOnly='False'|ListCommand.IncludeRegistryPrograms='False'|
ListCommand.PageSize='25'|ListCommand.Exact='False'|
ListCommand.ByIdOnly='False'|ListCommand.ByTagOnly='False'|
ListCommand.IdStartsWith='False'|ListCommand.OrderByPopularity='False'|
ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|
ListCommand.IncludeVersionOverrides='False'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
UpgradeCommand.ExcludePrerelease='False'|
NewCommand.AutomaticPackage='False'|
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|
SourceCommand.AllowSelfService='False'|
SourceCommand.VisibleToAdminsOnly='False'|
FeatureCommand.Command='unknown'|ConfigCommand.Command='unknown'|
ApiKeyCommand.Remove='False'|PinCommand.Command='unknown'|
OutdatedCommand.IgnorePinned='False'|
ExportCommand.IncludeVersionNumbers='False'|Proxy.BypassOnLocal='True'|
_ Chocolatey:ChocolateyUninstallCommand - Normal Run Mode _
Uninstalling the following packages:
wget
Running list with the following filter = ''
--- Start of List ---
Wget 1.21.2
--- End of List ---
wget is not installed. Cannot uninstall a non-existent package.

Chocolatey uninstalled 0/1 packages. 1 packages failed.
 See the log for details (/opt/chocolatey/logs/chocolatey.log).

Failures
 - wget - wget is not installed. Cannot uninstall a non-existent package.

If a package uninstall is failing and/or you've already uninstalled the
 software outside of Chocolatey, you can attempt to run the command
 with `-n` to skip running a chocolateyUninstall script, additionally
 adding `--skip-autouninstaller` to skip an attempt to automatically
 remove system-installed software. Only the packaging files are removed
 and not things like software installed to Programs and Features.

If a package is failing because it is a dependency of another package
 or packages, then you may first need to consider if it needs to be
 removed as packages have dependencies for a reason. If
 you decide that you still want to remove it, head into
 `$env:ChocolateyInstall\lib` and find the package folder you want to
 be removed. Then delete the folder for the package. You should use
 this option only as a last resort.

Sending message 'PostRunMessage' out if there are subscribers...
Exiting with 1

Full Log Output with uninstall Wget (Capitalized)

root@c1ab833bcdc0:~# choco uninstall Wget --debug --verbose
Chocolatey v0.11.2-51-g43132590
Chocolatey is running on Linux v 5.10.0.0
Attempting to delete file "/opt/chocolatey/chocolatey.dll.old".
Attempting to delete file "/opt/chocolatey/choco.exe.old".
Command line: /opt/chocolatey/choco.exe uninstall Wget --debug --verbose
Received arguments: uninstall Wget --debug --verbose
RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
Sending message 'PreRunMessage' out if there are subscribers...
[Pending] Removing all pending packages that should not be considered installed...
Performing validation checks.
Global Configuration Validation Checks:
 - Package Exit Code / Exit On Reboot = Checked
System State Validation Checks:
The source 'https://community.chocolatey.org/api/v2/' evaluated to a 'normal' source type

NOTE: Hiding sensitive configuration data! Please double and triple
 check to be sure no sensitive data is shown, especially if copying
 output to a gist for review.
Configuration: CommandName='uninstall'|CacheLocation='/tmp/chocolatey'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources='https://community.chocolatey.org/api/v2/'|SourceType='normal'|
Debug='True'|Verbose='True'|Trace='False'|Force='False'|Noop='False'|
HelpRequested='False'|UnsuccessfulParsing='False'|RegularOutput='True'|
QuietOutput='False'|PromptForConfirmation='True'|AcceptLicense='False'|
AllowUnofficialBuild='False'|Input='Wget'|AllVersions='False'|
SkipPackageInstallProvider='False'|PackageNames='Wget'|
Prerelease='False'|ForceX86='False'|OverrideArguments='False'|
NotSilent='False'|ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
AllowMultipleVersions='False'|AllowDowngrade='False'|
ForceDependencies='False'|Information.PlatformType='Linux'|
Information.PlatformVersion='5.10.0.0'|
Information.PlatformName='Linux'|
Information.ChocolateyVersion='0.12.0.0'|
Information.ChocolateyProductVersion='0.11.2-51-g43132590'|
Information.FullName='chocolatey, Version=0.12.0.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|

Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='False'|
Information.UserName='root'|Information.UserDomainName='c1ab833bcdc0'|
Information.IsUserAdministrator='False'|
Information.IsUserSystemAccount='False'|
Information.IsUserRemoteDesktop='False'|
Information.IsUserRemote='True'|
Information.IsProcessElevated='False'|
Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|
Information.CurrentDirectory='/root'|Features.AutoUninstaller='True'|
Features.ChecksumFiles='True'|Features.AllowEmptyChecksums='False'|
Features.AllowEmptyChecksumsSecure='True'|
Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.LogWithoutColor='False'|
Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseEnhancedExitCodes='False'|
Features.UseFipsCompliantChecksums='False'|
Features.ShowNonElevatedWarnings='True'|
Features.ShowDownloadProgress='True'|
Features.StopOnFirstPackageFailure='False'|
Features.UseRememberedArgumentsForUpgrades='False'|
Features.IgnoreUnfoundPackagesOnUpgradeOutdated='False'|
Features.SkipPackageUpgradesWhenNotInstalled='False'|
Features.RemovePackageInformationOnUninstall='False'|
Features.ExitOnRebootDetected='False'|
Features.LogValidationResultsOnWarnings='True'|
Features.UsePackageRepositoryOptimizations='True'|
Features.ScriptsCheckLastExitCode='False'|
ListCommand.LocalOnly='False'|
ListCommand.IdOnly='False'|ListCommand.IncludeRegistryPrograms='False'|
ListCommand.PageSize='25'|ListCommand.Exact='False'|
ListCommand.ByIdOnly='False'|ListCommand.ByTagOnly='False'|
ListCommand.IdStartsWith='False'|ListCommand.OrderByPopularity='False'|
ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|
ListCommand.IncludeVersionOverrides='False'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
UpgradeCommand.ExcludePrerelease='False'|
NewCommand.AutomaticPackage='False'|
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|
SourceCommand.AllowSelfService='False'|
SourceCommand.VisibleToAdminsOnly='False'|
FeatureCommand.Command='unknown'|ConfigCommand.Command='unknown'|
ApiKeyCommand.Remove='False'|PinCommand.Command='unknown'|
OutdatedCommand.IgnorePinned='False'|
ExportCommand.IncludeVersionNumbers='False'|Proxy.BypassOnLocal='True'|
_ Chocolatey:ChocolateyUninstallCommand - Normal Run Mode _
Uninstalling the following packages:
Wget
Running list with the following filter = ''
--- Start of List ---
Wget 1.21.2
--- End of List ---
Attempting to create directory "/opt/chocolatey/lib-bkp".
Backing up existing Wget prior to operation.
Moving '/opt/chocolatey/lib/Wget'
 to '/opt/chocolatey/lib-bkp/Wget'
Attempting to create directory "/opt/chocolatey/lib/Wget".
Attempting to copy "/opt/chocolatey/lib-bkp/Wget/Wget.nuspec"
 to "/opt/chocolatey/lib/Wget/Wget.nuspec".
Attempting to copy "/opt/chocolatey/lib-bkp/Wget/Wget.nupkg"
 to "/opt/chocolatey/lib/Wget/Wget.nupkg".
Attempting to create directory "/opt/chocolatey/lib/Wget/tools".
Attempting to copy "/opt/chocolatey/lib-bkp/Wget/tools/wget-1.21.2-win64_x64.zip"
 to "/opt/chocolatey/lib/Wget/tools/wget-1.21.2-win64_x64.zip".
Attempting to copy "/opt/chocolatey/lib-bkp/Wget/tools/chocolateyinstall.ps1"
 to "/opt/chocolatey/lib/Wget/tools/chocolateyinstall.ps1".
Attempting to copy "/opt/chocolatey/lib-bkp/Wget/tools/wget-1.21.2-win32_x32.zip"
 to "/opt/chocolatey/lib/Wget/tools/wget-1.21.2-win32_x32.zip".
Attempting to create directory "/opt/chocolatey/lib/Wget/legal".
Attempting to copy "/opt/chocolatey/lib-bkp/Wget/legal/VERIFICATION.txt"
 to "/opt/chocolatey/lib/Wget/legal/VERIFICATION.txt".
Attempting to copy "/opt/chocolatey/lib-bkp/Wget/legal/LICENSE.txt"
 to "/opt/chocolatey/lib/Wget/legal/LICENSE.txt".
Wget not uninstalled. An error occurred during uninstall:
 Unable to find package 'wget'.

Chocolatey uninstalled 0/1 packages. 1 packages failed.
 See the log for details (/opt/chocolatey/logs/chocolatey.log).

Failures
 - wget (exited 1) - Wget not uninstalled. An error occurred during uninstall:
 Unable to find package 'wget'.

If a package uninstall is failing and/or you've already uninstalled the
 software outside of Chocolatey, you can attempt to run the command
 with `-n` to skip running a chocolateyUninstall script, additionally
 adding `--skip-autouninstaller` to skip an attempt to automatically
 remove system-installed software. Only the packaging files are removed
 and not things like software installed to Programs and Features.

If a package is failing because it is a dependency of another package
 or packages, then you may first need to consider if it needs to be
 removed as packages have dependencies for a reason. If
 you decide that you still want to remove it, head into
 `$env:ChocolateyInstall\lib` and find the package folder you want to
 be removed. Then delete the folder for the package. You should use
 this option only as a last resort.

Sending message 'PostRunMessage' out if there are subscribers...
Exiting with 1

@TheCakeIsNaOH TheCakeIsNaOH added 0 - _Triaging Bug Priority_LOW Requires NuGet.Client Change This issue requires a modification to something in referenced NuGet.Client library. labels Feb 5, 2022
@TheCakeIsNaOH
Copy link
Member Author

After some poking around, it does look like this is caused by an issue within nuget core. I don't think this is worth trying to fix in the current version of nuget core, as it might be a huge amount of work depending on what is going on, and this only affects uninstalls. I will revisit this after nuget core is upgraded; #508

As a workaround to this issue, remove the $env:ChocolateyInstall/lib/<package> folder, and if it happens to be a template package also remove $env:ChocolateyInstall/template/<package> folder. This is an acceptable workaround on non-Windows system because the auto uninstaller and uninstall script are not run, so the package and possibly template folders are sufficient to uninstall the package manually.

@TheCakeIsNaOH
Copy link
Member Author

Seems to be fixed by the current code in #2740, so this should be fixed as a part of #508

@TheCakeIsNaOH
Copy link
Member Author

Was fixed by #2740, and tests will be added in #2957

TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Jan 5, 2023
This adds integration tests to ensure that packages that have IDs
with uppercase character(s) can be installed, upgraded, listed,
and uninstalled.
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Jan 5, 2023
This adds integration tests to ensure that packages that have IDs
with uppercase character(s) can be installed, upgraded, listed,
and uninstalled.
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Jan 5, 2023
This adds integration tests to ensure that packages that have IDs
with uppercase character(s) can be installed, upgraded, listed,
and uninstalled.
gep13 pushed a commit to TheCakeIsNaOH/choco that referenced this issue Jan 6, 2023
This adds integration tests to ensure that packages that have IDs
with uppercase character(s) can be installed, upgraded, listed,
and uninstalled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Review Bug Priority_LOW Requires NuGet.Client Change This issue requires a modification to something in referenced NuGet.Client library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant