Skip to content

fix: handle missing cygpath when Git Bash invoked from PowerShell#60

Merged
BrettKinny merged 2 commits into
mainfrom
claude/new-session-0ZytP
Apr 10, 2026
Merged

fix: handle missing cygpath when Git Bash invoked from PowerShell#60
BrettKinny merged 2 commits into
mainfrom
claude/new-session-0ZytP

Conversation

@BrettKinny
Copy link
Copy Markdown
Collaborator

When install.ps1 invokes Git Bash non-interactively (& bash.exe script),
/etc/profile isn't sourced and cygpath may not be on PATH. The fallback
echo "$USERPROFILE" passes the raw MSYS2 POSIX path (/c/Users/...)
which Docker can't resolve because MSYS_NO_PATHCONV=1 suppresses
automatic conversion.

Two-pronged fix:

  • install.ps1: add --login so bash sources /etc/profile (primary fix)
  • install.sh: add manual POSIX-to-mixed-mode fallback when cygpath is
    unavailable (/c/Users/... → C:/Users/...), as defense in depth

Also reuse the already-resolved USER_HOME for the git config fallback
path instead of calling cygpath a second time.

https://claude.ai/code/session_01GMPR7m8zbe6WTF7qQf6N8y

claude added 2 commits April 10, 2026 05:27
When install.ps1 invokes Git Bash non-interactively (& bash.exe script),
/etc/profile isn't sourced and cygpath may not be on PATH. The fallback
`echo "$USERPROFILE"` passes the raw MSYS2 POSIX path (/c/Users/...)
which Docker can't resolve because MSYS_NO_PATHCONV=1 suppresses
automatic conversion.

Two-pronged fix:
- install.ps1: add --login so bash sources /etc/profile (primary fix)
- install.sh: add manual POSIX-to-mixed-mode fallback when cygpath is
  unavailable (/c/Users/... → C:/Users/...), as defense in depth

Also reuse the already-resolved USER_HOME for the git config fallback
path instead of calling cygpath a second time.

https://claude.ai/code/session_01GMPR7m8zbe6WTF7qQf6N8y
Users may try `irm ... | iex -Edge` expecting it to pass -Edge to the
downloaded script, but PowerShell interprets it as an argument to
Invoke-Expression. Add a note explaining the limitation and show the
local .\install.ps1 form for -Edge and -Verbose.

https://claude.ai/code/session_01GMPR7m8zbe6WTF7qQf6N8y
Copilot AI review requested due to automatic review settings April 10, 2026 05:53
@BrettKinny BrettKinny merged commit 7f513bc into main Apr 10, 2026
3 checks passed
@BrettKinny BrettKinny deleted the claude/new-session-0ZytP branch April 10, 2026 05:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Windows installation reliability when install.ps1 invokes Git Bash non-interactively, ensuring MSYS2 tooling (notably cygpath) is available and providing a defensive path conversion fallback in install.sh when it isn’t.

Changes:

  • Invoke Git Bash with --login from install.ps1 so /etc/profile is sourced and MSYS2 utilities are on PATH.
  • Add a manual Windows/MSYS path-to-mixed-mode fallback in install.sh when cygpath is unavailable.
  • Update README Windows instructions to clarify re-running locally for -Edge / -Verbose flags.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
README.md Clarifies PowerShell install usage and how to pass flags after initial install.
install.sh Adds cygpath-missing fallback path conversion and reuses resolved USER_HOME for gitconfig lookup.
install.ps1 Runs Git Bash with --login to ensure /etc/profile is sourced in non-interactive invocation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread install.sh
USER_HOME="${USERPROFILE//\\//}"
# /c/Users/... → C:/Users/...
if [[ "$USER_HOME" =~ ^/([a-zA-Z])(/.*)$ ]]; then
USER_HOME="${BASH_REMATCH[1]^}:${BASH_REMATCH[2]}"
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

USER_HOME="${BASH_REMATCH[1]^}:..." uses the ${var^} uppercase expansion, which requires Bash 4+. Since this installer is invoked on macOS via | bash (often Bash 3.2), this introduces a compatibility risk ("bad substitution") if the conversion branch is hit. Consider dropping the uppercasing (drive letter case is irrelevant) or using a Bash-3-compatible approach (e.g., tr) so the script remains portable.

Suggested change
USER_HOME="${BASH_REMATCH[1]^}:${BASH_REMATCH[2]}"
USER_HOME="$(printf '%s' "${BASH_REMATCH[1]}" | tr '[:lower:]' '[:upper:]'):${BASH_REMATCH[2]}"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants