Skip to content

Placeholder for bash.exe messes with CreateProcess #13277

Closed

Description

Windows Version

Microsoft Windows [Version 10.0.20348.3932]

WSL Version

0.0.0.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

No response

Distro Version

No response

Other Software

No response

Repro Steps

Just run bash with the system directory at the beginning of the path:

$env:Path = "C:/Windows/System32;$env:Path"
bash --version

This is similar to what CreateProcess does: the 32-bit system directory takes precedence:

Expected Behavior

The appropriate bash command should run.

Actual Behavior

The wrong bash command (C:/Windows/System32/bash.exe) is run:

Windows Subsystem for Linux has no installed distributions.

Distributions can be installed by visiting the Microsoft Store:

https://aka.ms/wslstore

Diagnostic Logs

No response

Activity

  1. github-actions commented on Jul 23, 2025

    @github-actions
    Contributor

    Logs are required for review from WSL team

    If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
    Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

    How to collect WSL logs

    Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

    Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
    Set-ExecutionPolicy Bypass -Scope Process -Force
    .\collect-wsl-logs.ps1
    

    The script will output the path of the log file once done.

    If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here

    Once completed please upload the output files to this Github issue.

    Click here for more info on logging
    If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

  2. felipec commented on Jul 23, 2025

    @felipec
    Author
  3. github-actions commented on Jul 23, 2025

    @github-actions
    Contributor
    Diagnostic information
    Appx package is not installed
    
  4. sirredbeard commented on Jul 24, 2025

    @sirredbeard
    Contributor

    The wrong bash command (C:/Windows/System32/bash.exe) is run:

    What would you consider the right bash command? Are you using Git Bash?

  5. felipec commented on Jul 24, 2025

    @felipec
    Author

    The wrong bash command (C:/Windows/System32/bash.exe) is run:

    What would you consider the right bash command? Are you using Git Bash?

    Whatever is the first bash in the PATH environment variable. In the case of GitHub runner-images, yeah, it would be Git's bash.

  6. OneBlue commented on Oct 17, 2025

    @OneBlue
    Collaborator

    Repro Steps

    Just run bash with the system directory at the beginning of the path:

    $env:Path = "C:/Windows/System32;$env:Path"
    bash --version
    

    Actual Behavior

    The wrong bash command (C:/Windows/System32/bash.exe) is run:

    This is the expected behavior. If C:/Windows/System32 is the first entry in $PATH, then C:/Windows/System32/bash.exe being invoked is the expected behavior.

    Besides WSL doesn't control how PowerShell handles its $PATH logic. Closing since this is the expected behavior.

  7. felipec commented on Oct 18, 2025

    @felipec
    Author

    This is the expected behavior. If C:/Windows/System32 is the first entry in $PATH, then C:/Windows/System32/bash.exe being invoked is the expected behavior.

    No this is not the expected behavior. The expected behavior is that C:/Windows/System32/bash.exe doesn't exist.

    Besides WSL doesn't control how PowerShell handles its $PATH logic. Closing since this is the expected behavior.

    This has nothing to do with PowerShell. As I very clearly explained, the command is just an example of how to reproduce the issue that happens with CreateProcess, and therefore everything is affected.

    Do I need to open another issue using CreateProcess because you didn't read it correctly?

  8. joffrey-bion commented on Jul 5, 2026

    @joffrey-bion

    I'm facing issues with this on GitHub Windows runners as well. Why is this issue closed? Any chance we could get bash.exe removed unless a distro is installed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions