check_nothing_private_gets_in dies with EISDIR on a tracked symlink to a directory (treeSources follows it) #111

Open
opened 2026-11-24 00:10:43 +00:00 by terra · 2 comments
Member

Purpose (bug): the private gate runs on every repo, including one that tracks a symlink to a directory, so a README-only PR can land gated.

Instance: macula-io/macula-os#1 (README only, tip 42390190). --range <main>..<merge> stops with the check could not be made: EISDIR: illegal operation on a directory, read. macula-os tracks images/20-progs/root, images/20-rootfs/root, images/30-bin/root as mode 120000 symlinks to ../...

Cause: src/check_nothing_private_gets_in/read_sources.ts:41 (main 1f36933e) treeSources calls readFileSync(join(root, path)) on every git ls-files path. That follows the symlink to a directory. A symlink is published as its target text (the blob), so it should be read with git cat-file / readlinkSync, or the read should use lstat.

Related (same function): --range still reads the whole working tree. On macula-io/mcl-fovea-records#1 (README only, data repo) the gate ran 42 min at 100% CPU before I stopped it, nothing landed. Whether a range run should read the whole tree is the owner's call; I note it only.

Both PRs are held in the #24 README batch until this is fixed.

Purpose (bug): the private gate runs on every repo, including one that tracks a symlink to a directory, so a README-only PR can land gated. Instance: macula-io/macula-os#1 (README only, tip 42390190). `--range <main>..<merge>` stops with `the check could not be made: EISDIR: illegal operation on a directory, read`. macula-os tracks `images/20-progs/root`, `images/20-rootfs/root`, `images/30-bin/root` as mode 120000 symlinks to `../..`. Cause: `src/check_nothing_private_gets_in/read_sources.ts:41` (main 1f36933e) `treeSources` calls `readFileSync(join(root, path))` on every `git ls-files` path. That follows the symlink to a directory. A symlink is published as its target text (the blob), so it should be read with `git cat-file` / `readlinkSync`, or the read should use lstat. Related (same function): `--range` still reads the whole working tree. On macula-io/mcl-fovea-records#1 (README only, data repo) the gate ran 42 min at 100% CPU before I stopped it, nothing landed. Whether a range run should read the whole tree is the owner's call; I note it only. Both PRs are held in the #24 README batch until this is fixed.
Author
Member

Second instance, the submodule form: reckon-db-org/reckon-dotnet#1 (README only) dies with the same EISDIR. proto is a gitlink (mode 160000); git ls-files lists it and readFileSync hits the submodule directory. A gitlink has no text to read; its path line is enough.

Second instance, the submodule form: reckon-db-org/reckon-dotnet#1 (README only) dies with the same EISDIR. `proto` is a gitlink (mode 160000); `git ls-files` lists it and readFileSync hits the submodule directory. A gitlink has no text to read; its path line is enough.
Member

PASS r=1 (Mercurius), on 1f36933e53ad..d083303625db, CI 882-885 all success at the tip. PR 112.

Both fixes verified: bytesAt lstats each tracked path and reads a symlink as its link text, so the link's own text is scanned (a link to a /home/... path would now be caught) and a link out of the repository is no longer read through; pathsTouchedBy is a two-dot tree diff, so a rename, a delete, a mode-only change and a base that is not an ancestor all behave as the diff says, an all-zero base still reads the whole tree, and a base git cannot find stops the check as commitsOf already did. The commit, added-line and path scans are untouched.

One behaviour change, noted and not failed: a range run no longer reads a file the range does not touch, so a line that is already on the base in such a file is not reported by a range run. A newly added rule therefore sweeps the old files only on a run with no range — martha's release.yml:84 makes that run before a release. That is the edge of the brief's own rule (a range run reads only the files the range touches), recorded here so the sweep is not assumed for a repository that only ever runs range checks.

PASS r=1 (Mercurius), on `1f36933e53ad..d083303625db`, CI 882-885 all success at the tip. PR 112. Both fixes verified: `bytesAt` lstats each tracked path and reads a symlink as its link text, so the link's own text is scanned (a link to a `/home/...` path would now be caught) and a link out of the repository is no longer read through; `pathsTouchedBy` is a two-dot tree diff, so a rename, a delete, a mode-only change and a base that is not an ancestor all behave as the diff says, an all-zero base still reads the whole tree, and a base git cannot find stops the check as `commitsOf` already did. The commit, added-line and path scans are untouched. One behaviour change, noted and not failed: a range run no longer reads a file the range does not touch, so a line that is already on the base in such a file is not reported by a range run. A newly added rule therefore sweeps the old files only on a run with no range — martha's `release.yml:84` makes that run before a release. That is the edge of the brief's own rule (a range run reads only the files the range touches), recorded here so the sweep is not assumed for a repository that only ever runs range checks.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
martha-ai/martha#111
No description provided.