Skip to content

PATH is overridden causing issues with homebrew executables #22743

Closed
@Stausssi

Description

@Stausssi

Type: Bug

Behaviour

Expected vs. Actual

The built-in terminal should use the same executables as a standalone terminal.
However, loading up a built-in terminal causes /usr/bin, /bin and so on to be added to the path before {env.PATH}. This results in system executables being preferred over e.g. homebrew ones.

A concrete problem being caused by this is scripts failing, because the system bash (v3 on macOS) is used over homebrews bash (v5). Same goes for homebrew gnu-sed taking precedence over macOS sed.

Steps to reproduce:

  1. Prepend a custom directory containing any executable overriding the system defaults to your path in your .zshrc (or similar)
  2. Open a terminal window outside VS Code and run which bash -> Should output the custom directory bash
  3. Open the built-in terminal in VS Code and run which bash -> Should output /bin/bash
  4. Show environment contributions of the VS Code terminal also shows that /bin is added to the path before env:PATH is considered.

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.1
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Pyenv
  • Value of the python.languageServer setting: Pylance
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2024-01-12 07:55:56.432 [info] Experiment 'pythonREPLSmartSend' is active
2024-01-12 07:55:56.432 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-01-12 07:55:56.432 [info] Experiment 'pythonTestAdapter' is active
2024-01-12 07:55:56.477 [info] Default formatter is set to ms-python.black-formatter for workspace /Users/simon/code/foobar
2024-01-12 07:55:56.480 [info] Test server listening.
2024-01-12 07:55:56.484 [info] Python interpreter path: ~/.pyenv/versions/3.12.1/envs/foobar/bin/python
2024-01-12 07:55:56.596 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-01-12 07:55:56.659 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-01-12 07:55:56.659 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-01-12 07:55:56.659 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-01-12 07:55:56.659 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-01-12 07:55:56.659 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-01-12 07:55:56.667 [info] Send text to terminal: echo /bin/zsh
2024-01-12 07:55:56.837 [warning] Retry failed, storage update failed for key PYTHON_GLOBAL_STORAGE_KEYS
2024-01-12 07:55:58.078 [info] Starting Pylance language server.
2024-01-12 07:55:59.716 [info] Shell integration is not working for zsh
2024-01-12 07:55:59.717 [warning] Shell integration is not active, environment activated maybe overriden by the shell.
2024-01-12 07:56:00.651 [info] > /usr/bin/python3 ~/.vscode/extensions/ms-python.python-2023.22.1/pythonFiles/printEnvVariables.py
2024-01-12 07:56:00.651 [info] shell: zsh
2024-01-12 07:56:00.843 [info] Send text to terminal: /usr/bin/python3 /Users/simon/.vscode/extensions/ms-python.python-2023.22.1/pythonFiles/printEnvVariablesToFile.py /Users/simon/.vscode/extensions/ms-python.python-2023.22.1/pythonFiles/deactivate/zsh/envVars.txt

User Settings


venvPath: "<placeholder>"

languageServer: "Pylance"

testing
• pytestEnabled: true
• unittestEnabled: true

Extension version: 2023.22.1
VS Code version: Code 1.85.1 (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:48:16.874Z)
OS version: Darwin arm64 23.2.0
Modes:

System Info
Item Value
CPUs Apple M1 Pro (10 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 5, 6, 7
Memory (System) 32.00GB (0.10GB free)
Process Argv --crash-reporter-id 8ecf6c19-f4a2-48d0-8fea-82dc29f155ef
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:30899288
vscaat:30438848
vsclangdc:30486549
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30933248
pythongtdpath:30769146
i26e3531:30792625
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
2e7ec940:30885897
pythontbext0:30879054
accentitlementsc:30887149
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
aa_t_chat:30882232

Metadata

Metadata

Assignees

Labels

area-terminalbugIssue identified by VS Code Team member as probable bugexperimentingFeature is part of an experimentneeds PRReady to be worked onverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions