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

parsing of .env truncates before equal sign #22792

Closed
maximiliank opened this issue Jan 26, 2024 · 3 comments
Closed

parsing of .env truncates before equal sign #22792

maximiliank opened this issue Jan 26, 2024 · 3 comments
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@maximiliank
Copy link

Type: Bug

Behaviour

Expected vs. Actual

Environment settings in the .env file which contain an equal sign in the value are truncated, e.g.

ASAN_OPTIONS="detect_leaks=0"

ends up as ASAN_OPTIONS=detect_leaks in the environemt inside the terminal. I would expect that the complete value is passed as an environment variable. The same happens if I remove the quotes.

Steps to reproduce:

  1. Create an .env file with the following content
ASAN_OPTIONS="detect_leaks=0"
  1. Start a terminal
  2. Check the environment variables
$ env | grep ASAN_OPTIONS
ASAN_OPTIONS=detect_leaks

Diagnostic data

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

2024-01-26 11:05:45.398 [info] Experiment 'pythonaacf' is active
2024-01-26 11:05:45.398 [info] Experiment 'pythonRecommendTensorboardExtcf' is active
2024-01-26 11:05:45.398 [info] Experiment 'pythonREPLSmartSend' is active
2024-01-26 11:05:45.398 [info] Experiment 'pythonSurveyNotificationcf' is active
2024-01-26 11:05:45.398 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-01-26 11:05:45.398 [info] Experiment 'pythonTestAdapter' is active
2024-01-26 11:05:45.398 [info] Default formatter is set to ms-python.black-formatter for workspace <folder>
2024-01-26 11:05:45.398 [info] Test server listening.
2024-01-26 11:05:45.398 [info] Python interpreter path: ./.venv/bin/python
2024-01-26 11:05:45.878 [info] Send text to terminal: echo /bin/bash
2024-01-26 11:05:47.143 [info] > . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode-server/extensions/ms-python.python-2023.22.1/pythonFiles/printEnvVariables.py
2024-01-26 11:05:47.143 [info] shell: bash
2024-01-26 11:05:47.189 [info] > /bin/python3 ~/.vscode-server/extensions/ms-python.python-2023.22.1/pythonFiles/printEnvVariables.py
2024-01-26 11:05:47.189 [info] shell: bash
2024-01-26 11:05:47.217 [info] Send text to terminal: /bin/python3 <HOME>/.vscode-server/extensions/ms-python.python-2023.22.1/pythonFiles/printEnvVariablesToFile.py <HOME>/.vscode-server/extensions/ms-python.python-2023.22.1/pythonFiles/deactivate/bash/envVars.txt
2024-01-26 11:05:47.548 [info] Starting Pylance language server.

User Settings


languageServer: "Pylance"

testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true

Extension version: 2023.22.1
VS Code version: Code 1.85.2 (8b3775030ed1a69b13e4f4c628c612102e30a681, 2024-01-18T06:40:10.514Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Remote OS version: Linux x64 4.18.0-513.9.1.el8_9.x86_64

System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 2995)
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) undefined
Memory (System) 31.69GB (18.18GB free)
Process Argv --crash-reporter-id 6958cdb7-8098-4f70-9b5c-0413382c0a56
Screen Reader no
VM 0%
Item Value
Remote SSH:
OS Linux x64 4.18.0-513.9.1.el8_9.x86_64
CPUs Intel(R) Xeon(R) Gold 6143 CPU @ 2.80GHz (64 x 2800)
Memory (System) 251.03GB (237.00GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:30899288
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30933248
pythongtdpath:30769146
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
dsvsc019a:30933241

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jan 26, 2024
@maximiliank maximiliank changed the title parsing of .env trunctes before equal sign parsing of .env truncates before equal sign Jan 27, 2024
@karrtikr
Copy link

Closing as duplicate of microsoft/vscode#197603. I encourage you to interact with the other issue, as that could help with prioritizing it.

@karrtikr karrtikr closed this as not planned Won't fix, can't repro, duplicate, stale Jan 29, 2024
@shjohnson-pi
Copy link

shjohnson-pi commented Jan 30, 2024

As a workaround, you can set "python.envFile": "" in workspace/.vscode/settings.json and then reload the window. That should stop VS code from looking at the .env file.
Reference: https://code.visualstudio.com/docs/python/environments#_environment-variables

@maximiliank
Copy link
Author

Actually, I need it when debugging tests from python. The extension is build with sanitizers. This implies that the sanitizer library has to be LD_PRELOADed before starting the debugging session. Since the leak sanitizer detects also memory leaks within in python I have to disable leak detection. My .env file looks like this:

LD_PRELOAD=/lib64/libasan.so.8
# Disable leak detection from python modules since asan detects leaks when numpy is loaded
ASAN_OPTIONS=detect_leaks=0

and when debugging python everything works as expected. But the terminal is not useable since the trailing = is cut out, hence it complains AddressSanitizer: ERROR: expected '=' in ASAN_OPTIONS and no command in the terminal works. Which is clear, since libasan.so.8 is preloaded and the configuration for ASAN_OPTIONS is incomplete.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

3 participants