Skip to content

Commit 766cce1

Browse files
EliahKaganclaude
andcommitted
DIAG v3: controlled chown experiment for Cygwin trust check
Third diagnostic to test the differential-ACL-inheritance hypothesis. After `init-tests-after-clone.sh`, prints baseline `stat` (uid/owner) for the candidate paths, then strips the gitdb/smmap entries from `safe.directory` to reproduce the failing state, and runs three experiments: 1. Baseline: `git rev-parse` on gitdb and smmap. Expected: gitdb fails, smmap passes. 2. After `chown -R $(id -u):$(id -g) <pwd>/git/ext/gitdb`: `git rev-parse` on both. If the hypothesis is right, gitdb should now pass too. 3. After also `chown -R` on `<pwd>/.git/modules/gitdb`: re-test. Confirms whether both worktree and gitdir need fixing or just one. Strips the 256-job `reproduce-safe-dir` matrix to keep CI burden minimal. This branch should be deleted once the data is captured. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8f1348d commit 766cce1

1 file changed

Lines changed: 76 additions & 31 deletions

File tree

.github/workflows/cygwin-test.yml

Lines changed: 76 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,82 @@ jobs:
6767
run: |
6868
./init-tests-after-clone.sh
6969
70+
- name: Diagnose v3 — controlled experiment (chown gitdb's parents and re-test)
71+
run: |
72+
set +e -x
73+
echo "==================================================================="
74+
echo "Baseline ownership: list st_uid for the candidate paths"
75+
echo "==================================================================="
76+
for path in \
77+
"$(pwd)/git" \
78+
"$(pwd)/git/ext" \
79+
"$(pwd)/git/ext/gitdb" \
80+
"$(pwd)/git/ext/gitdb/.git" \
81+
"$(pwd)/.git" \
82+
"$(pwd)/.git/modules" \
83+
"$(pwd)/.git/modules/gitdb" \
84+
"$(pwd)/git/ext/gitdb/gitdb" \
85+
"$(pwd)/git/ext/gitdb/gitdb/ext" \
86+
"$(pwd)/git/ext/gitdb/gitdb/ext/smmap" \
87+
"$(pwd)/git/ext/gitdb/gitdb/ext/smmap/.git" \
88+
"$(pwd)/.git/modules/gitdb/modules/smmap"; do
89+
echo "$(stat -c '%u %U' "$path" 2>&1) $path"
90+
done
91+
echo
92+
echo "Cygwin user uid: $(id -u) ($(id -un))"
93+
echo
94+
echo "==================================================================="
95+
echo "Strip gitdb/smmap entries from safe.directory (simulate failing state)"
96+
echo "==================================================================="
97+
SAVED="$(git config --global --get-all safe.directory)"
98+
git config --global --unset-all safe.directory
99+
echo "$SAVED" | grep -v 'git/ext/gitdb' | while read -r entry; do
100+
[ -n "$entry" ] && git config --global --add safe.directory "$entry"
101+
done
102+
git config --global --get-all safe.directory
103+
echo
104+
echo "==================================================================="
105+
echo "Test 1: rev-parse on each fixture WITHOUT any chown (baseline failure)"
106+
echo "==================================================================="
107+
for fixture in "$(pwd)/git/ext/gitdb" "$(pwd)/git/ext/gitdb/gitdb/ext/smmap"; do
108+
echo "--- $fixture"
109+
git -C "$fixture" rev-parse --show-toplevel 2>&1
110+
echo "(rc=$?)"
111+
done
112+
echo
113+
echo "==================================================================="
114+
echo "Test 2: chown gitdb's worktree to current user, then re-test"
115+
echo "==================================================================="
116+
chown -R "$(id -u):$(id -g)" "$(pwd)/git/ext/gitdb" 2>&1 | head -10
117+
echo "After chown, gitdb's worktree owner: $(stat -c '%u %U' "$(pwd)/git/ext/gitdb")"
118+
echo
119+
for fixture in "$(pwd)/git/ext/gitdb" "$(pwd)/git/ext/gitdb/gitdb/ext/smmap"; do
120+
echo "--- $fixture"
121+
git -C "$fixture" rev-parse --show-toplevel 2>&1
122+
echo "(rc=$?)"
123+
done
124+
echo
125+
echo "==================================================================="
126+
echo "Test 3: chown gitdb's gitdir at .git/modules/gitdb to current user"
127+
echo "==================================================================="
128+
chown -R "$(id -u):$(id -g)" "$(pwd)/.git/modules/gitdb" 2>&1 | head -10
129+
echo "After chown, gitdb's gitdir owner: $(stat -c '%u %U' "$(pwd)/.git/modules/gitdb")"
130+
echo
131+
for fixture in "$(pwd)/git/ext/gitdb" "$(pwd)/git/ext/gitdb/gitdb/ext/smmap"; do
132+
echo "--- $fixture"
133+
git -C "$fixture" rev-parse --show-toplevel 2>&1
134+
echo "(rc=$?)"
135+
done
136+
echo
137+
echo "==================================================================="
138+
echo "Restore safe.directory"
139+
echo "==================================================================="
140+
git config --global --unset-all safe.directory
141+
echo "$SAVED" | while read -r entry; do
142+
[ -n "$entry" ] && git config --global --add safe.directory "$entry"
143+
done
144+
true
145+
70146
- &git-identity
71147
name: Set git user identity and command aliases for the tests
72148
run: |
@@ -103,34 +179,3 @@ jobs:
103179
- name: Test with pytest (${{ matrix.additional-pytest-args }})
104180
run: |
105181
pytest --color=yes -p no:sugar --instafail -vv ${{ matrix.additional-pytest-args }}
106-
107-
reproduce-safe-dir:
108-
strategy:
109-
matrix:
110-
run: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256]
111-
fail-fast: false
112-
113-
runs-on: windows-latest
114-
115-
env: *cygwin-env
116-
117-
defaults: *cygwin-defaults
118-
119-
steps:
120-
- *force-lf
121-
- *checkout
122-
- *install-cygwin
123-
- *verbose-output
124-
- *safe-directory
125-
- *prepare-repo
126-
- *git-identity
127-
- *setup-venv
128-
- *update-pypa
129-
- *install-deps
130-
131-
- name: Run submodule tests
132-
run: |
133-
python -m pytest -vv \
134-
test/test_docs.py::Tutorials::test_submodules \
135-
test/test_repo.py::TestRepo::test_submodules \
136-
test/test_submodule.py::TestSubmodule::test_root_module

0 commit comments

Comments
 (0)