chocolatey / chocolatey/choco

Attempting to upgrade a package that requires upgrading a pinned dependency results in dependency resolution failure and confusing error message

Open
#3,358 0 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

### Checklist

- [X] I have verified this is the correct repository for opening this issue.
- [X] I have verified no other issues exist related to my problem.
- [X] I have verified this is not an issue for a specific package.
- [X] I have verified this issue is not security related.
- [X] I confirm I am using **official**, and **not** unofficial, or modified, Chocolatey products.

### What You Are Seeing?

If you install a package (`b`) with a dependency (`a`) and provide the `--pin` parameter, the dependency will also be pinned. If you later attempt to upgrade the package, and it requires an upgrade of the package, you receive the message: `Unable to resolve dependency 'a': Unable to resolve dependencies. 'a 0.1.0' is not compatible with 'b 0.2.0 constraint: a (>= 0.2.0)'.`

### What is Expected?

I would expect a message something like `Unable to resolve dependency 'a': Unable to resolve dependencies. 'a 0.1.0' is pinned and not compatible with 'b 0.2.0 constraint: a (>= 0.2.0)'.`

### How Did You Get This To Happen?

1. Create new Chocolatey packages a and b (`choco new a --version 0.1.0`, and `choco new b --version 0.1.0`)
2. Remove all of the scripts from package `b` and add a dependency for `a` exact version `0.1.0`
3. Remove all of the scripts from package `a` except `chocolateyInstall.ps1` and update it to be a simple `Write-Host`
4. Choco pack both packages
5. Run `choco install b --source . --pin`
6. Update `b.nuspec` to take a dependency on `a` version `0.2.0`
7. Run `choco pack --version 0.2.0`
8. Run `choco pack --version 0.2.0`
9. Run `choco upgrade b --source .`
10. Note the output that `b` is pinned.
11. Run `choco pin remove --name b`
12. Run `choco upgrade b --source .`
13. Receive error `Unable to resolve dependency 'a': Unable to resolve dependencies. 'a 0.1.0' is not compatible with 'b 0.2.0 constraint: a (>= 0.2.0)'.`

### System Details

* Operating System: Windows 10
* Windows PowerShell version: 5.1
* Chocolatey CLI Version: 2.2.2
* Chocolatey Licensed Extension version:N/A
* Chocolatey License type:N/A
* Terminal/Emulator:conhost

### Installed Packages

```bash
a 0.1.0
b 0.1.0
chocolatey 2.2.2
```

### Output Log

```bash
2023-11-09 11:46:42,969 3744 [DEBUG] - XmlConfiguration is now operational
2023-11-09 11:46:43,126 3744 [DEBUG] - Adding new type 'CygwinService' for type 'IAlternativeSourceRunner' from assembly 'choco'
2023-11-09 11:46:43,126 3744 [DEBUG] - Adding new type 'CygwinService' for type 'IInstallSourceRunner' from assembly 'choco'
2023-11-09 11:46:43,126 3744 [DEBUG] - Adding new type 'PythonService' for type 'IAlternativeSourceRunner' from assembly 'choco'
2023-11-09 11:46:43,126 3744 [DEBUG] - Adding new type 'PythonService' for type 'IListSourceRunner' from assembly 'choco'
2023-11-09 11:46:43,126 3744 [DEBUG] - Adding new type 'PythonService' for type 'IInstallSourceRunner' from assembly 'choco'
2023-11-09 11:46:43,126 3744 [DEBUG] - Adding new type 'PythonService' for type 'IUninstallSourceRunner' from assembly 'choco'
2023-11-09 11:46:43,126 3744 [DEBUG] - Adding new type 'RubyGemsService' for type 'IAlternativeSourceRunner' from assembly 'choco'
2023-11-09 11:46:43,126 3744 [DEBUG] - Adding new type 'RubyGemsService' for type 'IListSourceRunner' from assembly 'choco'
2023-11-09 11:46:43,126 3744 [DEBUG] - Adding new type 'RubyGemsService' for type 'IInstallSourceRunner' from assembly 'choco'
2023-11-09 11:46:43,126 3744 [DEBUG] - Adding new type 'SystemStateValidation' for type 'IValidation' from assembly 'choco'
2023-11-09 11:46:43,126 3744 [DEBUG] - Adding new type 'CacheFolderLockdownValidation' for type 'IValidation' from assembly 'choco'
2023-11-09 11:46:43,485 3744 [DEBUG] - Adding new type 'EmptyOrInvalidUrlMetadataRule' for type 'IMetadataRule' from assembly 'choco'
2023-11-09 11:46:43,485 3744 [DEBUG] - Adding new type 'FrameWorkReferencesMetadataRule' for type 'IMetadataRule' from assembly 'choco'
2023-11-09 11:46:43,501 3744 [DEBUG] - Adding new type 'IconMetadataRule' for type 'IMetadataRule' from assembly 'choco'
2023-11-09 11:46:43,501 3744 [DEBUG] - Adding new type 'LicenseMetadataRule' for type 'IMetadataRule' from assembly 'choco'
2023-11-09 11:46:43,501 3744 [DEBUG] - Adding new type 'PackageTypesMetadataRule' for type 'IMetadataRule' from assembly 'choco'
2023-11-09 11:46:43,501 3744 [DEBUG] - Adding new type 'ReadmeMetadataRule' for type 'IMetadataRule' from assembly 'choco'
2023-11-09 11:46:43,501 3744 [DEBUG] - Adding new type 'RepositoryMetadataRule' for type 'IMetadataRule' from assembly 'choco'
2023-11-09 11:46:43,501 3744 [DEBUG] - Adding new type 'RequireLicenseAcceptanceMetadataRule' for type 'IMetadataRule' from assembly 'choco'
2023-11-09 11:46:43,501 3744 [DEBUG] - Adding new type 'ServicableMetadataRule' for type 'IMetadataRule' from assembly 'choco'
2023-11-09 11:46:43,501 3744 [DEBUG] - Adding new type 'VersionMetadataRule' for type 'IMetadataRule' from assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'cache' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'list' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'template' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'export' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'info' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'help' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'config' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'feature' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'new' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'outdated' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'pack' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'pin' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'push' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'apikey' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'source' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'uninstall' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'upgrade' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'search' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'unpackself' in assembly 'choco'
2023-11-09 11:46:43,516 3744 [DEBUG] - Registering new command 'install' in assembly 'choco'
2023-11-09 11:46:44,454 3744 [INFO ] - ============================================================
2023-11-09 11:46:45,235 3744 [INFO ] - Chocolatey v2.2.2
2023-11-09 11:46:45,251 3744 [DEBUG] - Chocolatey is running on Windows v 10.0.19041.0
2023-11-09 11:46:45,251 3744 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
2023-11-09 11:46:45,251 3744 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
2023-11-09 11:46:45,266 3744 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" upgrade b -s .
2023-11-09 11:46:45,266 3744 [DEBUG] - Received arguments: upgrade b -s .
2023-11-09 11:46:45,329 3744 [DEBUG] - RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
2023-11-09 11:46:45,376 3744 [DEBUG] - Sending message 'PreRunMessage' out if there are subscribers...
2023-11-09 11:46:45,376 3744 [DEBUG] - [Pending] Removing all pending packages that should not be considered installed...
2023-11-09 11:46:45,438 3744 [DEBUG] - Performing validation checks.
2023-11-09 11:46:45,438 3744 [DEBUG] - Global Configuration Validation Checks:
2023-11-09 11:46:45,438 3744 [DEBUG] - - Package Exit Code / Exit On Reboot = Checked
2023-11-09 11:46:45,438 3744 [DEBUG] - System State Validation Checks:
2023-11-09 11:46:45,438 3744 [DEBUG] - Reboot Requirement Checks:
2023-11-09 11:46:45,438 3744 [DEBUG] - - Pending Computer Rename = Checked
2023-11-09 11:46:45,438 3744 [DEBUG] - - Pending Component Based Servicing = Checked
2023-11-09 11:46:45,454 3744 [DEBUG] - - Pending Windows Auto Update = Checked
2023-11-09 11:46:45,454 3744 [DEBUG] - - Pending File Rename Operations = Checked
2023-11-09 11:46:45,454 3744 [DEBUG] - - Pending Windows Package Installer = Checked
2023-11-09 11:46:45,454 3744 [DEBUG] - - Pending Windows Package Installer SysWow64 = Checked
2023-11-09 11:46:45,454 3744 [DEBUG] - Cache Folder Lockdown Checks:
2023-11-09 11:46:45,454 3744 [DEBUG] - - Elevated State = Checked
2023-11-09 11:46:45,454 3744 [DEBUG] - - Folder Exists = Checked
2023-11-09 11:46:45,469 3744 [DEBUG] - - Folder lockdown = Checked
2023-11-09 11:46:45,469 3744 [INFO ] - 3 validations performed. 3 success(es), 0 warning(s), and 0 error(s).
2023-11-09 11:46:45,485 3744 [DEBUG] - The source '.' evaluated to a 'normal' source type
2023-11-09 11:46:45,485 3744 [DEBUG] -
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.
2023-11-09 11:46:45,501 3744 [DEBUG] - Configuration: CommandName='upgrade'|
CacheLocation='C:\Users\WDAGUtilityAccount\AppData\Local\Temp\chocolatey'|

CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources='.'|SourceType='normal'|ShowOnlineHelp='False'|Debug='False'|
Verbose='False'|Trace='False'|Force='False'|Noop='False'|
HelpRequested='False'|UnsuccessfulParsing='False'|RegularOutput='True'|
QuietOutput='False'|PromptForConfirmation='True'|
DisableCompatibilityChecks='False'|AcceptLicense='False'|
AllowUnofficialBuild='False'|Input='b'|AllVersions='False'|
SkipPackageInstallProvider='False'|SkipHookScripts='False'|
PackageNames='b'|Prerelease='False'|ForceX86='False'|
OverrideArguments='False'|NotSilent='False'|
ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
CacheExpirationInMinutes='30'|AllowDowngrade='False'|
ForceDependencies='False'|PinPackage='False'|
Information.PlatformType='Windows'|
Information.PlatformVersion='10.0.19041.0'|
Information.PlatformName='Windows 10'|
Information.ChocolateyVersion='2.2.2.0'|
Information.ChocolateyProductVersion='2.2.2'|
Information.FullName='choco, Version=2.2.2.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|

Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='True'|
Information.UserName='WDAGUtilityAccount'|
Information.UserDomainName='D15AA2A6-B4A9-4'|
Information.IsUserAdministrator='True'|
Information.IsUserSystemAccount='False'|
Information.IsUserRemoteDesktop='False'|
Information.IsUserRemote='False'|Information.IsProcessElevated='True'|
Information.IsLicensedVersion='False'|
Information.IsLicensedAssemblyLoaded='False'|
Information.LicenseType='Foss'|
Information.CurrentDirectory='C:\Users\WDAGUtilityAccount'|
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'|
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'|
ListCommand.ExplicitPageSize='False'|
ListCommand.ExplicitSource='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.Command='Unknown'|PinCommand.Command='Unknown'|
OutdatedCommand.IgnorePinned='False'|
ExportCommand.IncludeVersionNumbers='False'|Proxy.BypassOnLocal='True'|
TemplateCommand.Command='unknown'|CacheCommand.Command='Unknown'|
CacheCommand.RemoveExpiredItemsOnly='False'|
2023-11-09 11:46:45,501 3744 [DEBUG] - _ Chocolatey:ChocolateyUpgradeCommand - Normal Run Mode _
2023-11-09 11:46:45,501 3744 [INFO ] - Upgrading the following packages:
2023-11-09 11:46:45,501 3744 [INFO ] - b
2023-11-09 11:46:45,501 3744 [INFO ] - By upgrading, you accept licenses for the packages.
2023-11-09 11:46:45,657 3744 [DEBUG] - Updating Source path from . to C:\Users\WDAGUtilityAccount
2023-11-09 11:46:45,719 3744 [DEBUG] - Running list with the following filter = ''
2023-11-09 11:46:45,719 3744 [DEBUG] - --- Start of List ---
2023-11-09 11:46:45,751 3744 [DEBUG] - Resolving resource PackageSearchResource for source C:\ProgramData\chocolatey\lib
2023-11-09 11:46:46,094 3744 [DEBUG] - a 0.1.0
2023-11-09 11:46:46,110 3744 [DEBUG] - b 0.1.0
2023-11-09 11:46:46,110 3744 [DEBUG] - chocolatey 2.2.2
2023-11-09 11:46:46,110 3744 [DEBUG] - --- End of List ---
2023-11-09 11:46:46,266 3744 [DEBUG] - Resolving resource ListResource for source C:\Users\WDAGUtilityAccount
2023-11-09 11:46:46,282 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\Application Data' is denied.
2023-11-09 11:46:46,297 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\Cookies' is denied.
2023-11-09 11:46:46,297 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\Local Settings' is denied.
2023-11-09 11:46:46,297 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\My Documents' is denied.
2023-11-09 11:46:46,313 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\NetHood' is denied.
2023-11-09 11:46:46,313 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\PrintHood' is denied.
2023-11-09 11:46:46,313 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\Recent' is denied.
2023-11-09 11:46:46,313 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\SendTo' is denied.
2023-11-09 11:46:46,313 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\Start Menu' is denied.
2023-11-09 11:46:46,313 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\Templates' is denied.
2023-11-09 11:46:46,329 3744 [WARN ] -
You have b v0.1.0 installed. Version 0.2.0 is available based on your source(s).
2023-11-09 11:46:46,329 3744 [DEBUG] - Resolving resource DependencyInfoResource for source C:\Users\WDAGUtilityAccount
2023-11-09 11:46:46,360 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\Application Data' is denied.
2023-11-09 11:46:46,376 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\Cookies' is denied.
2023-11-09 11:46:46,376 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\Local Settings' is denied.
2023-11-09 11:46:46,376 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\My Documents' is denied.
2023-11-09 11:46:46,376 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\NetHood' is denied.
2023-11-09 11:46:46,391 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\PrintHood' is denied.
2023-11-09 11:46:46,391 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\Recent' is denied.
2023-11-09 11:46:46,391 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\SendTo' is denied.
2023-11-09 11:46:46,391 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\Start Menu' is denied.
2023-11-09 11:46:46,391 3744 [WARN ] - [NuGet] Access to the path 'C:\Users\WDAGUtilityAccount\Templates' is denied.
2023-11-09 11:46:46,516 3744 [WARN ] - Re-attempting package dependency resolution using additional available package information...
2023-11-09 11:46:46,516 3744 [ERROR] - Unable to resolve dependency 'a': Unable to resolve dependencies. 'a 0.1.0' is not compatible with 'b 0.2.0 constraint: a (>= 0.2.0)'.
2023-11-09 11:46:46,532 3744 [WARN ] -
Chocolatey upgraded 0/1 packages. 1 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
2023-11-09 11:46:46,548 3744 [INFO ] -
2023-11-09 11:46:46,548 3744 [ERROR] - Failures
2023-11-09 11:46:46,548 3744 [ERROR] - - b - Unable to resolve dependency 'a': Unable to resolve dependencies. 'a 0.1.0' is not compatible with 'b 0.2.0 constraint: a (>= 0.2.0)'.
2023-11-09 11:46:46,548 3744 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2023-11-09 11:46:46,548 3744 [DEBUG] - Exiting with 1
```

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure using the listed choco install, pin, pack, pin remove, and upgrade commands with the a and b nuspec files. Trace the upgrade dependency-resolution and pin handling entry points, then verify that the error identifies a as pinned and incompatible while the upgrade scenario completes or reports the clearer reason.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.