Skip to content
This repository has been archived by the owner on Feb 19, 2019. It is now read-only.

Uninstall-ChocolateyPath.ps1 #542

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rchiav
Copy link

@rchiav rchiav commented Aug 11, 2014

I was writing the uninstall for a zip file and wanted to make sure the path was cleaned up. Thought I'd write it to be usable by Chocolatey. Reused a lot of Install-ChocolateyPath.ps1 to keep them similar.

I was writing the uninstall for a zip file and wanted to make sure the path was cleaned up. Thought I'd write it to be usable by Chocolatey. Reused a lot of Install-ChocolateyPath.ps1 to keep them similar.
@DarwinJS
Copy link

DarwinJS commented Jan 7, 2016

I believe the code submitted may accidentally expand unrelated EMBEDDED environment variables in the PATH environment variable and it won't catch targets that are actually EMBEDDED environment variables because this code "$envPath = $env:PATH" retrieves the path where it is already expanded. I'm not sure if Get-EnvironmentVariable and Set-EnvironmentVariable also deal with expanded environment variables

[Environment]::GetEnvironmentVariable("PATH","User_or_Machine") and [Environment]::SetEnvironmentVariable("PATH","User_or_Machine") keep embedded environment variables intact - for [a] removing an embedded environment variable, [b] not touching other embedded environment variables and for both path retrieval and re-write.

I have some code to do this while preserving environment variables.

@DarwinJS
Copy link

DarwinJS commented Jan 7, 2016

It's probably self evident - but mucking up the system path on choco machines could bring a lot of rage it's way :( Might be good to review whether "Install-ChocolateyPath" accidentally expands unrelated environment variables embedded in the path as well?

@ferventcoder
Copy link
Contributor

@DarwinJS This is already a known issue and also already has a PR to fix it up. I've also added notes on how this would be fixed in the powershell function file related to install-chocolateypath.

@ferventcoder
Copy link
Contributor

Let's continue discussion in the actual ticket over on Choco.

@chocolatey-archive chocolatey-archive locked and limited conversation to collaborators Jan 7, 2016
@ferventcoder
Copy link
Contributor

chocolatey/choco#310

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

Successfully merging this pull request may close these issues.

3 participants