Fixed bug where tmp dir incorrectly set for Snap package manager #10372
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #10407
Background info:
The original issue was that starting minikube installed via Snap (package manager) would result in the error:
This is due to Snap only allowing packages to see their own view of the
/tmp
folder. In this case minikube copies a memory asset to the/tmp
folder for Docker to later copy. Snap prevents Docker from seeing minikubes file and the above error occurs.This PR:
This issue was attempted to be fixed in #10042, the correct way to solve this issue is to check if the binary is installed via Snap, and if it is, writes the memory asset to the users home directory instead. However, there was a bug included in the PR where instead of setting the tmp directory to the users home directory, it would try to find an env variable by the name of the users home directory and set that as the tmp directory. This env was not found and would return an empty string, passing an empty string to the function would fallback to using the default tmp directory and would fail. This fix simply removes the env check and sets the tmp directory to the users home directory.