Skip to content

Commit

Permalink
Workaround Cygwin bash's buggy behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Jun 11, 2024
1 parent 01c63d2 commit e626313
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/.cspell/project-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ almalinux
archlinux
bindgen
binstall
choco
coreutils
cyclonedx
cygdrive
deepsource
distro
doas
Expand All @@ -23,6 +25,7 @@ pwsh
quickinstall
rclone
rdme
requirechecksums
sccache
syft
udeps
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ jobs:
# https://github.com/taiki-e/install-action/pull/518#issuecomment-2160736760
- os: windows-2022
bash: msys64
- os: windows-2022
bash: cygwin
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
Expand All @@ -70,6 +72,13 @@ jobs:
echo "C:\msys64\mingw32\bin" >> $GITHUB_PATH
echo "C:\msys64\usr\bin" >> $GITHUB_PATH
if: matrix.bash == 'msys64'
- run: |
set -eEuxo pipefail
choco install --no-progress --requirechecksums cygwin
echo "C:\tools\cygwin\bin" >> $GITHUB_PATH
echo "C:\tools\cygwin\usr\bin" >> $GITHUB_PATH
if: matrix.bash == 'cygwin'
- run: env
- uses: ./
with:
tool: ${{ steps.tool-list.outputs.tool }}
Expand Down Expand Up @@ -100,6 +109,7 @@ jobs:
if [[ "$(cargo binstall -V)" != "$(jq -r '.latest.version' manifests/cargo-binstall.json)" ]]; then
exit 1
fi
if: matrix.bash != 'cygwin'
test-container:
strategy:
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com

## [Unreleased]

- Workaround Cygwin bash's buggy behavior. ([#534](https://github.com/taiki-e/install-action/pull/534))
This fixes an installation issue when default bash was overridden like the following:

```sh
echo "C:\tools\cygwin\bin" >> $GITHUB_PATH
```

## [2.38.3] - 2024-06-11

- Workaround msys64 bash's buggy behavior. ([#533](https://github.com/taiki-e/install-action/pull/533))
- Workaround MSYS64 bash's buggy behavior. ([#533](https://github.com/taiki-e/install-action/pull/533))
This fixes an installation issue when default bash was overridden like the following:
```sh
Expand Down
6 changes: 4 additions & 2 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ init_install_action_bin_dir() {
}
canonicalize_windows_path() {
case "${host_os}" in
windows) sed <<<"$1" 's/^\/c\//C:\\/; s/\//\\/g' ;;
windows) sed <<<"$1" 's/^\/cygdrive\//\//; s/^\/c\//C:\\/; s/\//\\/g' ;;
*) echo "$1" ;;
esac
}
Expand Down Expand Up @@ -521,8 +521,10 @@ if [[ "${host_os}" == "windows" ]]; then
if [[ -d "${home/\/home\//\/c\/Users\/}" ]]; then
# MSYS2 https://github.com/taiki-e/install-action/pull/518#issuecomment-2160736760
home="${home/\/home\//\/c\/Users\/}"
elif [[ -d "${home/\/home\//\/cygdrive\/c\/Users\/}" ]]; then
# Cygwin https://github.com/taiki-e/install-action/issues/224#issuecomment-1720196288
home="${home/\/home\//\/cygdrive\/c\/Users\/}"
else
# TODO: Cygwin https://github.com/taiki-e/install-action/issues/224#issuecomment-1720196288
warn "\$HOME starting /home/ (${home}) on Windows bash is usually fake path, this may cause installation issue"
fi
fi
Expand Down

0 comments on commit e626313

Please sign in to comment.