chocolatey / chocolatey/choco

Choco fails to write zipExtractLogFullPath for certain packages

Open
#2,095 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've made a custom internal package that fails to install. Other packages of the same type and layout works. Running with `--verbose --debug` shows the following stack trace:

```
ERROR: A parameter cannot be found that matches parameter name 'Encoding'.
at Get-ChocolateyUnzip, C:\ProgramData\chocolatey\helpers\functions\Get-ChocolateyUnzip.ps1: line 222
at Install-ChocolateyZipPackage, C:\ProgramData\chocolatey\helpers\functions\Install-ChocolateyZipPackage.ps1: line 212
at , C:\ProgramData\chocolatey\lib\microsoftgdk\tools\chocolateyinstall.ps1: line 11
at , C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1: line 49
at , : line 1
```

### What is Expected?

Install without errors, or provide a less generic error message so I know what to do.

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

This is where it's get tricky since the zip I'm installing is internal so the log currently needs some serious scrubbing. I cant publicly share it in it's current state. Thought I'm rather looking for a better repro so I can share a custom package that exhibit this problem.

This is the failing line: https://github.com/chocolatey/choco/blob/3564dfb83782d9a02504ad2c89c5c978fb65f4ca/src/chocolatey.resources/helpers/functions/Get-ChocolateyUnzip.ps1#L222
And if I read that correctly, if I can manage to not provide the Get-ChocolateyUnzip method with a package name, it wont log those details. Which might be a viable workaround.

I also have a hunch that moving the content parameter last on that line would also fix it, some quoting issue going on or something. So doing that and building a custom choco to test with is an option.

Is this at all valuable? Or is the scrubbed log necessary? Or would the minimal package that repros be a better approach?

Contributor guide

Open the contributing guide

Research direction

Start with src/chocolatey.resources/helpers/functions/Get-ChocolateyUnzip.ps1 at line 222 and inspect how the Encoding parameter is passed. Build or use a minimal package that reproduces the failure, then verify whether installation succeeds or produces an actionable error message.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.