choco icon indicating copy to clipboard operation
choco copied to clipboard

Failing to install dependencies does not always fail packages which require them, leaving chocolatey in a broken state

Open vexx32 opened this issue 1 year ago • 1 comments

Checklist

  • [X] I confirm there are no unresolved issues reported on the Chocolatey Status page.
  • [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?

When a dependency fails to install, the failure does not prevent other packages which depend on it from installing.

What is Expected?

Failing to install a dependency should not permit anything that depends on it to still install.

How Did You Get This To Happen?

  1. Download download.zip and extract to C:\packages
  2. choco upgrade rootpackageA rootpackageB -y -s c:\packages
  3. The reported failure is rootpackageB despite it not actually depending on the failing dependency nested-dependencyA-failing, and rootpackageA is permitted to install, despite this placing Chocolatey in a broken state where you cannot install any more packages until you rip out all the installed packages further up in the dependency chain.

System Details

  • Operating System: Win10
  • Windows PowerShell version: 5.1
  • Chocolatey CLI Version: 2.3.0
  • Chocolatey Licensed Extension version: 6.2.1
  • Chocolatey License type: Business
  • Terminal/Emulator: PowerShell

Installed Packages

N/A, this reproduces purely with the given test packages.

Output Log

https://gist.github.com/vexx32/26e3a315109a15f897de3ef12f803eff

Additional Context

No response

vexx32 avatar Jul 16 '24 18:07 vexx32

I have also experienced this issue when installing/upgrading a package with git version >=2.45.0 and <2.46.0 as dependency. git.install fails to install (likely because git 2.46 was already installed) but the git installation and the installation of the package that requires git succeed:

By upgrading, you accept licenses for the packages.
Downloading package from source 'https://community.chocolatey.org/api/v2/'

git.install v2.45.2 (forced) [Approved]
git.install package files upgrade completed. Performing other installation steps.
Using Git LFS
Installing 64-bit git.install...
ERROR: Running ["C:\ProgramData\chocolatey\lib\git.install\tools\Git-2.45.2-64-bit.exe" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /NOCANCEL /SP- /LOG /COMPONENTS="icons,assoc,assoc_sh,ext,ext\shellhere,ext\guihere,gitlfs,icons\quicklaunch"] was not successful. Exit code was '1'. See log for possible error messages.
The upgrade of git.install was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\git.install\tools\chocolateyInstall.ps1'.
 See log for details.
Downloading package from source 'https://community.chocolatey.org/api/v2/'

git v2.45.2 (forced) [Approved]
git package files upgrade completed. Performing other installation steps.
 The upgrade of git was successful.
  Deployed to 'C:\ProgramData\chocolatey\lib\git'

After that packages that are completely unrelated fail to install with:

[NuGet] One or more unresolved package dependency constraints detected in the Chocolatey lib folder. All dependency constraints must be resolved to add or update packages. If these packages are being updated this message may be ignored, if not the following error(s) may be blocking the current package operation: '<package_name> <package_version> constraint: git (>= 2.45.0 && < 2.46.0)'

git should fail to install if git.install fails to install

Ana06 avatar Aug 27 '24 09:08 Ana06

:tada: This issue has been resolved in version 2.4.0 :tada:

The release is available on:

vexx32 avatar Nov 12 '24 22:11 vexx32