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

[API] Chocolatey file cache adds a 'chocolatey' directory on each install #1210

Closed
mwrock opened this issue Mar 28, 2017 · 2 comments
Closed

Comments

@mwrock
Copy link
Member

mwrock commented Mar 28, 2017

Note that this only occurs when using the chocolatey.dll and installing multiple packages in a single process. Choco creates the CacheLocation by appending a chocolatey directory to the TEMP environment variable (https://github.com/chocolatey/choco/blob/master/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs#L198). Then later it sets the PATH environment variable from the CacheLocation (https://github.com/chocolatey/choco/blob/master/src/chocolatey/infrastructure.app/configuration/EnvironmentSettings.cs#L79). If one installs multiple packages in the same process, each install will cache to a deeper chocolatey directory until eventually path too long errors start failing packages. This is common in an application leveraging chocolatey as a library such as Boxstarter. This addresses the issue submitted at chocolatey/boxstarter#241.

Soon to follow I will submit a PR tha twill only append a chocolatey directory if one does not already exist.

mwrock added a commit to mwrock/choco that referenced this issue Mar 28, 2017
…ation

This ensures that the CacheLocation only appends chocolatey to the TEMP variable if it has not already been added. Otherwise multiple package installs in the same process result in an ever deeper nested chocolatey cache folders.
@ferventcoder ferventcoder added this to the 0.10.4 milestone Mar 28, 2017
@ferventcoder ferventcoder self-assigned this Mar 28, 2017
@ferventcoder
Copy link
Member

Let's get this fixed in 0.10.4.

@ferventcoder ferventcoder changed the title Chocolatey file cache adds a 'chocolatey' directory on each install [API] Chocolatey file cache adds a 'chocolatey' directory on each install Mar 28, 2017
ferventcoder pushed a commit that referenced this issue Mar 28, 2017
This ensures that the CacheLocation only appends chocolatey to the TEMP variable
if it has not already been added. Otherwise multiple package installs in the
same process result in an ever deeper nested chocolatey cache folders, resulting
in eventual `PATH too long` errors. This appears to affect only API usage of
Chocolatey.
ferventcoder added a commit that referenced this issue Mar 28, 2017
* pr1211:
  (GH-1210) CacheLocation - Prevent nested chocolatey directories
ferventcoder added a commit that referenced this issue Mar 28, 2017
* stable:
  (GH-1210) CacheLocation - Prevent nested chocolatey directories
  (GH-1209) Add Chocolatey Software to copyright
  (GH-1180) Ensure values are escaped for regex
  (maint) note about removing section
  (GH-797) Conditionally remember execution timeout
  (GH-1208) auto uninstaller - split by quotes
  (maint) formatting
  (GH-797) Use remembered arguments when upgrading
  (GH-797) Encrypt & remember certain arguments
  (GH-797) OptionSet available globally
  (GH-797) Move check for sensitive data to function
  (maint) update tab expansion for 0.10.4 & licensed
  (GH-797) Add remembered arguments parameters
  (doc) update CHANGELOG/nuspec
  (docs) update licensed changelog
@ferventcoder
Copy link
Member

This will be in 0.10.4

mwrock added a commit to mwrock/choco that referenced this issue Apr 3, 2017
The former fix (chocolateyGH-1210) fails when the CacheLocation ends with a slash. This uses a DirectoryInfo instance to examine the last directory in the path in a more robust manner
mwrock added a commit to mwrock/choco that referenced this issue Apr 3, 2017
The former fix (chocolateyGH-1210) fails when the CacheLocation ends with a slash. This uses a DirectoryInfo instance to examine the last directory in the path in a more robust manner
mwrock added a commit to mwrock/choco that referenced this issue Apr 3, 2017
The former fix (chocolateyGH-1210) fails when the CacheLocation ends with a slash. This uses a DirectoryInfo instance to examine the last directory in the path in a more robust manner
mwrock added a commit to mwrock/choco that referenced this issue Apr 4, 2017
The former fix (chocolateyGH-1210) fails when the CacheLocation ends with a slash. This uses a DirectoryInfo instance to examine the last directory in the path in a more robust manner
mwrock added a commit to mwrock/choco that referenced this issue Apr 4, 2017
The former fix (chocolateyGH-1210) fails when the CacheLocation ends with a slash. This uses a DirectoryInfo instance to examine the last directory in the path in a more robust manner
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

3 participants