chocolatey / chocolatey/choco

During upgrade of a package not all files in the lib folder are present

Open
#3,375 1 comment 0 reactions 0 assignees View on GitHub
Bug Priority - High
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?

When performing an upgrade of a package, files that are created during the installation/usage of the software that the package installs, and placed into the package lib folder, are not present during the upgrade of the package.

For example, let's say you have a package that during installation, creates a file in the lib folder to store "stuff". This could be configuration information for example. During an upgrade, you may want to use the information in this file, to do other "stuff". However, this file that was placed there during installation, or after installation, isn't present in the lib folder during the upgrade.

### What is Expected?

Any files that are added to the lib folder during installation, or after, should be present in the lib folder during installation. This is how things worked in 1.x of Chocolatey CLI.

See the testing steps below for more information on this regression.

### How Did You Get This To Happen?

Run the following commands in 1.x and 2.x of Chocolatey CLI, and you should get the following results:

```
choco install retain-package-files-on-upgrade --version 0.1.0 --source . -y
```

```
choco upgrade retain-package-files-on-upgrade --source . -y
```

![image](https://github.com/chocolatey/choco/assets/1271146/8e1294e9-c8dc-4cdf-82b9-bec65ce39d0c)

![image](https://github.com/chocolatey/choco/assets/1271146/fd2edcc2-7ad2-4bc7-a977-680b64686cd6)

Notice that the "The file doesn't exist, but it likely should..." message appears both during install and upgrade when run through 2.x, but only appears once when installed via 1.x.

[retain-package-files-on-upgrade.0.2.0.zip](https://github.com/chocolatey/choco/files/13742419/retain-package-files-on-upgrade.0.2.0.zip)
[retain-package-files-on-upgrade.0.1.0.zip](https://github.com/chocolatey/choco/files/13742420/retain-package-files-on-upgrade.0.1.0.zip)

### System Details

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

### Installed Packages

```bash
N/A
```

### Output Log

```bash
N/A
```

### Additional Context

N/A

Contributor guide

Open the contributing guide

Research direction

Reproduce the regression with the retain-package-files-on-upgrade 0.1.0 and 0.2.0 packages using the install and upgrade commands in the issue, comparing Chocolatey CLI 1.x and 2.x. Trace the upgrade workflow that prepares the package lib folder and add regression coverage showing that files created during or after installation remain available during upgrade.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.