Skip to content

Segfault on Windows git bash (msys) when using bash tool with cwd #11043

Closed

Description

@pschiel

Steps to reproduce

  • use git bash
  • ask agent to run bash tool, given an absolute path
  • bash will fail with ENOENT and bun crashing

Root cause

In a Windows environment with mixed paths (Windows, MSYS/GitBash), bun spawn will crash with segfault when cwd is passed using backslashes

#6763 solves this via path normalization

Activity

  1. github-actions commented on Jan 28, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    The root cause appears to be related to Windows path handling (backslashes) in the bash tool's cwd parameter. Issue #10871 specifically addresses path handling issues with Git Bash on Windows that could be related.

    Feel free to ignore if none of these address your specific case.

  2. pschiel commented on Jan 31, 2026

    @pschiel
    ContributorAuthor

    details:

    • segfault occurs in spawn() via Node's child_process module
    • libuv layer: when spawn() tries to change to a non-existent directory, the underlying uv_spawn call dereferences a null pointer
    • Bun doesn't validate cwd exists before attempting the spawn operation
    • Segfault at 0x0: The null pointer dereference causes immediate segfault at address 0x0

    added isDir checks in bash tool, pty and lsp (where user/agent input could happen) to avoid this

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwindows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions