Skip to content

Commit d3ac917

Browse files
committed
Test setting symlink type via CYGWIN env var
1 parent 49f298a commit d3ac917

File tree

3 files changed

+61
-6
lines changed

3 files changed

+61
-6
lines changed

.github/workflows/test.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ jobs:
114114
with:
115115
install-dir: "${{ matrix.install-dir }}"
116116

117-
- name: Check working directory
117+
- name: Check install directory
118118
run: |
119119
if [[ "$(cygpath -aw /)" == '${{ matrix.install-dir }}' ]]; then
120120
echo "Installed in $(cygpath -aw /)"
@@ -133,6 +133,31 @@ jobs:
133133
env:
134134
SHELLOPTS: igncr
135135

136+
symlink-test:
137+
runs-on: windows-latest
138+
name: 'Check symlink type control'
139+
140+
strategy:
141+
matrix:
142+
include:
143+
- symlink-type: native
144+
- symlink-type: sys
145+
- symlink-type: wsl
146+
147+
env:
148+
CYGWIN: winsymlinks:${{ matrix.symlink-type }}
149+
150+
steps:
151+
- run: git config --global core.autocrlf input
152+
153+
- uses: actions/checkout@v2
154+
155+
- name: Install Cygwin
156+
uses: ./
157+
158+
- name: Check symlink
159+
run: bash tests/symlink.sh
160+
136161
time-machine:
137162
runs-on: windows-latest
138163
strategy:

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,16 @@ or,
7272
Symlinks
7373
--------
7474

75-
Unfortunately, Cygwin's `setup` doesn't (currently) honour
76-
`CYGWIN=winsymlinks:native` or offer an option to control the kind of symlinks
77-
created, so some executables (e.g. `python`) are created as Cygwin-style
78-
symlinks. Since CMD and PowerShell don't understand those symlinks, you cannot
79-
run those executables directly in a `run:` in your workflow. Execute them via
75+
Cygwin's `setup` creates Cygwin-style symlinks by default, and some
76+
executables (e.g. `python`) are symlinks.
77+
78+
Since CMD and PowerShell don't understand those symlinks, you cannot run
79+
those executables directly in a `run:` in your workflow. Execute them via
8080
`bash` or `env` instead.
8181

82+
Alternatively, putting e.g. `CYGWIN=winsymlinks:native` into the workflow's
83+
environment works, since setup now honours that.
84+
8285
Mirrors and signatures
8386
----------------------
8487

tests/symlink.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/bash
2+
3+
TEST_FILE="/usr/bin/apropos"
4+
echo "cygpath -w ${TEST_FILE} returns $(cygpath -w ${TEST_FILE})"
5+
# don't convert using cygpath -w, as that canonicalizes symlinks ?!?
6+
TEST_FILE_W="C:\cygwin\bin\apropos"
7+
8+
# check the symlink we're going to do checks on exists
9+
if [ ! -L ${TEST_FILE} ]; then
10+
echo "This test assumes ${TEST_FILE} exists and is a symlink"
11+
exit 1
12+
fi
13+
14+
# check the symlink was created in the way expected
15+
case ${CYGWIN} in
16+
*sys*)
17+
cmd /c "dir /AS ${TEST_FILE_W}" | grep "21"
18+
;;
19+
20+
*native*)
21+
cmd /c "dir /AL ${TEST_FILE_W}" | grep "<SYMLINK>"
22+
;;
23+
24+
*wsl*)
25+
fsutil reparsepoint query ${TEST_FILE_W} | grep "0xa000001d"
26+
;;
27+
esac

0 commit comments

Comments
 (0)