Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support no path changes #5

Closed
ferventcoder opened this issue Jan 6, 2015 · 1 comment
Closed

Support no path changes #5

ferventcoder opened this issue Jan 6, 2015 · 1 comment

Comments

@ferventcoder
Copy link
Member

ferventcoder commented Jan 6, 2015

Is Your Feature Request Related To A Problem? Please describe.

I don't want packages to change my PATH.

Describe The Solution. Why is it needed?

Packages can change the PATH environment variable that may cause issues for some users. We should provide a way to disable this.

There are three ways that installing a Chocolatey package can change the path:

  1. The package code may update the PATH environment variable directly.
    Many packages already update the PATH environment variable directly. The only way to change those would be when a new package version is submitted, and the moderator to flag this up. However, there are potentially Trusted packages, unmaintained packages and packages that are not released frequently. This would still leave a lot of packages with that code change being required.
  2. The package may use Install-ChocolateyPath.
    This is something we could control by checking a feature, for example disablePATHChanges.
  3. If the package installs software, the installer may amend the path.
    This is not something we can control.

Additional Context.

If we add this, it should be controlled with a switch and a feature.

Related Issues

N/A

@pauby
Copy link
Member

pauby commented Nov 24, 2022

The vast majority of changes to a PATH are left to the installer, which Chocolatey CLI cannot prevent. The rest of the packages that update the path are a combination of direct PATH environment variable changes and the Chocolatey PowerShell helper Install-ChocolateyPath. Updating the packages that directly amend the PATH will take some time to accomplish and won't see benefits from any prevention for some time.

Recent functionality was added in the form of package hooks. A hook could be set up to store the PATH before a package is installed, and restore it afterwards. If software is installed as part of the package, this may affect how it is intended to work, but that would be a decision for the user.

This would be much more effective for the user installing the package as it would cover any changes to the PATH no matter what made them.

See the hooks documentation for more information and this hooks package as an example. In the meantime I have opened this issue.

I'm going to go ahead and close this now, but we can always reopen if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants