Skip to content

Commit 4f603f7

Browse files
committed
ci: assert the committed manifest names no local directory
Two scripts in the specification's repository rewrite this manifest to name a working tree --- run-conformance.sh and run-kit-tests.sh --- and both restore it through a trap. A trap does not fire when the process is killed, and a run by hand followed by `git add -A` then publishes a path that exists on one machine: a consumer resolving from the index is handed a manifest pointing at a directory that exists nowhere. ⚠️ That has happened in this ecosystem, in openkal-musl, where it was published and had to be reverted. The working tree here has carried the same rewrite more than once since, and only an audit before committing kept it out. The step runs first, so what it examines is what the commit contains rather than what the job has since done to it. openkal-musl carries the same check for the same reason.
1 parent e51fc5f commit 4f603f7

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,31 @@ jobs:
4949
# The specification is checked out at the branch under test where it has
5050
# one, so that this run asserts what it is for: that the specification as
5151
# written there and this implementation as written here agree today.
52+
# THE COMMITTED MANIFEST NAMES NO DIRECTORY OF ANYBODY'S MACHINE.
53+
#
54+
# Two scripts in the specification's repository rewrite this manifest to
55+
# name a working tree --- run-conformance.sh and run-kit-tests.sh --- and
56+
# both restore it through a trap. A trap does not fire when the process is
57+
# killed, and a run by hand followed by `git add -A` then publishes a path
58+
# that exists on one machine: a consumer resolving from the index is handed
59+
# a manifest pointing at a directory that exists nowhere.
60+
#
61+
# ⚠️ THAT HAS HAPPENED IN THIS ECOSYSTEM, in openkal-musl, and the working
62+
# tree here has carried the same rewrite more than once since. This step
63+
# runs first, so what it examines is what the commit contains.
64+
- name: The committed manifest names no local directory
65+
run: |
66+
set -euo pipefail
67+
bad=$(grep -nE '^[a-z-]+ = \{[^}]*path = "(/|[A-Za-z]:)' mcpp.toml || true)
68+
if [ -n "$bad" ]; then
69+
echo "::error::the committed manifest names an absolute path"
70+
printf '%s\n' "$bad" | sed 's/^/ /'
71+
echo " run 'git checkout -- mcpp.toml' after using the"
72+
echo " specification's conformance or kit scripts by hand."
73+
exit 1
74+
fi
75+
echo " ok every dependency is named by version, branch or a relative path"
76+
5277
- name: The specification
5378
run: |
5479
git clone --quiet https://github.com/mcpplibs/openkal.git .spec

0 commit comments

Comments
 (0)