chocolatey / chocolatey/choco

UnInstall-ChocolateyZipPackage removes folders that contain other files

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

Description

### What You Are Seeing?

I'm using `Install-ChocolateyZipPackage` to install an OBS plugin directly into `c:\Program files\obs-studio`, which was created earlier by installing the `obs-studio` package.

When I call `UnInstall-ChocolateyZipPackage`, it deletes folders that had files installed by the original OBS package in addition to the files installed by my plugin package.

### What is Expected?
Delete files previously installed, but don't delete folders if there are other files remaining.

### Example

Installing using `Install-ChocolateyZipPackage` created a file `obs-ndi-4.9.0-Windows.zip.txt` with the following contents:

```text
C:\Program Files\obs-studio\data
C:\Program Files\obs-studio\data\obs-plugins
C:\Program Files\obs-studio\data\obs-plugins\obs-ndi
C:\Program Files\obs-studio\data\obs-plugins\obs-ndi\locale
C:\Program Files\obs-studio\data\obs-plugins\obs-ndi\locale\ca-ES.ini
C:\Program Files\obs-studio\data\obs-plugins\obs-ndi\locale\en-US.ini
C:\Program Files\obs-studio\data\obs-plugins\obs-ndi\locale\es-ES.ini
C:\Program Files\obs-studio\data\obs-plugins\obs-ndi\locale\fr-FR.ini
C:\Program Files\obs-studio\data\obs-plugins\obs-ndi\locale\ru-RU.ini
C:\Program Files\obs-studio\obs-plugins
C:\Program Files\obs-studio\obs-plugins\32bit
C:\Program Files\obs-studio\data\obs-plugins\obs-ndi\locale\zh-CN.ini
C:\Program Files\obs-studio\obs-plugins\32bit\obs-ndi.dll
C:\Program Files\obs-studio\obs-plugins\32bit\obs-ndi.pdb
C:\Program Files\obs-studio\obs-plugins\64bit
C:\Program Files\obs-studio\obs-plugins\64bit\obs-ndi.dll
C:\Program Files\obs-studio\obs-plugins\64bit\obs-ndi.pdb
```

The current implementation deletes all the directories, even though many of these contained files installed by the obs-studio package.

Contributor guide

Open the contributing guide

Research direction

Start by locating the Install-ChocolateyZipPackage and UnInstall-ChocolateyZipPackage implementations and any tests covering archive installation cleanup, then reproduce the shared-directory case described here. Done means uninstall removes files recorded for the plugin while retaining directories that still contain files from another package.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.