Skip to content

Log ComSpec and add diagnostic to validate it #16692

Description

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 Karthik Nadig (@karthiknadig) in #16684 (comment)

Activity

  1. karthiknadig commented on Dec 9, 2021

    @karthiknadig
    MemberAuthor

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

    /cc Kartik Raj (@karrtikr) Just FYI.

  2. karrtikr commented on Dec 10, 2021

    @karrtikr

    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.

  3. karrtikr commented on Mar 31, 2022

    @karrtikr

    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.

  4. changed the title [-]Check and log ComSpec [/-] [+]Log ComSpec and add diagnostic[/+] on Mar 31, 2022
  5. changed the title [-]Log ComSpec and add diagnostic[/-] [+]Log ComSpec and add diagnostic to validate it[/+] on Mar 31, 2022
  6. changed the title [-]Log ComSpec and add diagnostic to validate it[/-] [+]Log `ComSpec` and add diagnostic to validate it[/+] on Apr 4, 2022
  7. added
    debtCode quality issues
    and removed
    feature-requestRequest for new features or functionality
    on Mar 3, 2023
  8. karrtikr commented on Mar 28, 2023

    @karrtikr

    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.
  9. karrtikr commented on Mar 28, 2023

    @karrtikr

    Verification steps:

    ONLY ON WINDOWS

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

    image

  10. locked as resolved and limited conversation to collaborators on Apr 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-editor-*User-facing catch-alldebtCode quality issuesneeds PRReady to be worked on

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions