From 77c9ac7ddb41da0a73d4fffa5d6fb621ef40f925 Mon Sep 17 00:00:00 2001 From: Shaun Walbridge Date: Wed, 8 May 2024 00:01:15 -0400 Subject: [PATCH] Remove empty PATH entry on Windows With the Windows 10 release, Microsoft added an interactive editor for the PATH variable e.g. [the workflow described here](https://learn.microsoft.com/en-us/dotnet/core/install/windows?tabs=net80#no-net-sdk-was-found). This normalizes the PATH entry by appending a `;` at the end of all entries. Here, because we split on the `;`, we'll end up with an empty entry. Later in the activation code, the paths are normalized with `os.path.normpath` which will expand this to `.` which can affect downstream code and can cause users concern since `.` has a special meaning on POSIX based systems. --- conda/activate.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conda/activate.py b/conda/activate.py index 57b6237f294..05fd5989a8d 100644 --- a/conda/activate.py +++ b/conda/activate.py @@ -611,6 +611,9 @@ def _get_starting_path_list(self): "PATH", clean_paths[sys.platform] if sys.platform in clean_paths else "/usr/bin", ) + if sys.platform == "win32": + # Windows 10+ has a trailing semicolon by default, remove it to prevent empty entry + path = path.strip(os.pathsep) path_split = path.split(os.pathsep) return path_split