chocolatey / chocolatey/choco

[API] chocolatey.lib clobbers TMP and TEMP environment variables,

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

Description

### What You Are Seeing?

I use `List()` to retrieve the installation status of some packages within my application and it modifies the `TMP` environment variable for the whole application because `set_environment_variables()` is called.

As a result, any process launched by my application get the wrong temporary directory.

### What is Expected?
`TMP` or `TEMP` should not be modified by a library; if subprocesses need them, maybe use `ProcessStartInfo.EnvironmentVariables`?

### How Did You Get This To Happen? (Steps to Reproduce)
```c#
m_choco = Lets.GetChocolatey();
```
```c#
m_choco.Set(conf =>
{
conf.CommandName = "info";
conf.ListCommand.LocalOnly = local;
conf.Input = package_name;
conf.RegularOutput = false; // disable messages about pro/business version (QuietOutput does not work)
}).List()
/* ... */
```

Contributor guide

Open the contributing guide

Research direction

Start at the implementation reached by Lets.GetChocolatey().Set(...).List(), then locate where set_environment_variables() is called. Review whether ProcessStartInfo.EnvironmentVariables can scope subprocess values, and verify that calling List() leaves the application's TMP and TEMP unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.