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.
Current Behavior
When using csh or tcsh only
After using "conda activate env" for the first time issuing "conda env list" adds the conda/bin directory as a prefix to the PATH variable causeing future python execution to use a non-intended python version.
Even worse: every time "conda env list is issued a new "conda/bin" is prefixed to the PATH variable.
The same issue happens when an conda command is executed the results in an error e.g "conda activate non_existing".
Steps to Reproduce
Expected Behavior
"conda env list" or any informational or invalid conda com and should not affect the PATH variable
Cause
This problem is caused by conda.csh line 29
conda/conda/shell/etc/profile.d/conda.csh
Line 29 in aed799b
It modifies the path environment variable. That change is reversed in cases when the
eval statements are executed (line 33,38 or 44) but if an error happens in lines (32, 37 or 43)
or if the "default:" statement is executed the path variable is left unchanged with the altered value.
Solution
The proposed solution stores the value of the Path variable and restores it in case of error or in the default branch of the switch statement when no "eval" statement is executed that would set the PATH variable correctly.