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

Log ComSpec and add diagnostic to validate it #16692

Closed
karthiknadig opened this issue Jul 15, 2021 · 5 comments · Fixed by #20927
Closed

Log ComSpec and add diagnostic to validate it #16692

karthiknadig opened this issue Jul 15, 2021 · 5 comments · Fixed by #20927
Assignees
Labels
area-editor-* User-facing catch-all debt Covers everything internal: CI, testing, refactoring of the codebase, etc. needs PR Ready to be worked on
Milestone

Comments

@karthiknadig
Copy link
Member

We see this often where ComSpec env variable is some how set to invalid path. We should detect this and log. This happens way too often.

Essentially the ENOENT (-4058) error with -c " " error usually means that Node exec tried to get default shell on Windows using ComSpec and since ComSpec was wrong it was failing while trying to shell execute python commands.

Originally posted by @karthiknadig in #16684 (comment)

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jul 15, 2021
@karthiknadig karthiknadig added area-editor-* User-facing catch-all needs PR feature-request Request for new features or functionality and removed triage-needed Needs assignment to the proper sub-team labels Jul 15, 2021
@karthiknadig
Copy link
Member Author

This should also log if PATH does not have C:\Windows\System32. see related issue: #18138

/cc @karrtikr Just FYI.

@karrtikr
Copy link

karrtikr commented Dec 10, 2021

For that user ComSpec was set #18138 (comment), I don't understand why node ran using cmd.exe instead of the value in the env variable. The fact whether C:\Windows\System32 is not PATH should not matter as long as it was set.

Documentation says cmd.exe is only used as a fallback: https://nodejs.org/api/child_process.html#default-windows-shell.

@karrtikr
Copy link

karrtikr commented Mar 31, 2022

Perhaps it'll be sufficient to make sure it carries:

  • A path that exists.
  • It's a file and not a folder.

Note according to https://postgrespro.com/list/thread-id/1529515 it may also end with a semicolon, so some investigation may also be required to double check the possibilities of the values it can carry.

@karrtikr karrtikr changed the title Check and log ComSpec Log ComSpec and add diagnostic Mar 31, 2022
@karrtikr karrtikr changed the title Log ComSpec and add diagnostic Log ComSpec and add diagnostic to validate it Mar 31, 2022
@karrtikr karrtikr changed the title Log ComSpec and add diagnostic to validate it Log ComSpec and add diagnostic to validate it Apr 4, 2022
@karrtikr karrtikr self-assigned this Jun 10, 2022
@github-actions github-actions bot removed the needs PR label Aug 9, 2022
@karrtikr karrtikr added the needs PR Ready to be worked on label Aug 9, 2022
@karrtikr karrtikr added debt Covers everything internal: CI, testing, refactoring of the codebase, etc. and removed feature-request Request for new features or functionality labels Mar 3, 2023
@karrtikr
Copy link

karrtikr commented Mar 28, 2023

Few known causes for such an error:

  • Try setting the "ComSpec" environment variable to a valid Command Prompt path in your system to fix it: https://aka.ms/AAk3djo.
  • Please edit "Path" environment it to make sure it contains the "SystemRoot" subdirectories: https://aka.ms/AAk744c.

@karrtikr karrtikr added this to the April 2023 milestone Mar 28, 2023
@karrtikr
Copy link

karrtikr commented Mar 28, 2023

Verification steps:

ONLY ON WINDOWS

  • Set ComSpec to an invalid value and load Python extension:

image

karrtikr pushed a commit that referenced this issue Mar 29, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-editor-* User-facing catch-all debt Covers everything internal: CI, testing, refactoring of the codebase, etc. needs PR Ready to be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants