manifest: resolve the stored entry on Linux casefold directories #3138

Manually merged
github merged 1 commit from github-bot/gh-3138 into gh-pr/3138/base 2026-12-02 15:30:20 +00:00 AGit
Owner

@⁠merzleckeier on GitHub · 2026-12-02 13:35 UTC · original
merzleckeier:fix/manifest-linux-casefold-alias → main · +98 −11 · 2 files · 1 commits · merged 2026-12-02 15:25 UTC

Claimed in the coordination issue as: MANIFEST-LINUX-CASEFOLD-ALIAS

Depends on: #3087 (merged)

What and why

On a Linux directory with per-directory casefolding, realpath() can preserve the requested spelling of an existing manifest. The directory scan then lists the manifest itself as NEW, and create refuses to refresh it through that spelling.

Compare directory identity for containment and resolve the manifest's actual entry in that directory. If multiple entries share an inode, the Linux descriptor path identifies the entry used by the lookup. A separate hard link stays visible to the existing overwrite guard.

Tested

  • python -I tests/test_manifest.py -v and python -I tests/test_report_paths.py -v on CachyOS (Linux 7.3.6, Python 3.14.10), using synthetic files on tmpfs. With per-directory casefold enabled, 70 passed and 2 skipped. On ordinary tmpfs, 66 passed and 6 skipped.
  • On the original implementation the folded-directory tests report the manifest as NEW for ASCII case, Unicode composition, and a default-ignorable character. The directory alias and separate hard-link cases also fail on the original code and pass with this change.
  • tests/test_text_write_line_endings.py, scripts/check_no_game_data.py tools/manifest.py tests/test_manifest.py, and git diff --check passed.
  • Native Windows and macOS were outside this test run. The same-directory hard-link case used Linux with procfs.

GPUs tested: n/a (CPU only).

AI-assisted: OpenAI Codex with GPT-6.2, independently reviewed read-only by GPT-6.2 Sol.

Checklist

  • Based on upstream main (044339e4c).
  • One topic.
  • Synthetic fixtures only.
**@⁠merzleckeier** on GitHub · 2026-12-02 13:35 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3138) `merzleckeier:fix/manifest-linux-casefold-alias` → `main` · +98 −11 · 2 files · 1 commits · merged 2026-12-02 15:25 UTC Claimed in the coordination issue as: [MANIFEST-LINUX-CASEFOLD-ALIAS](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/2570) Depends on: #3087 (merged) ### What and why On a Linux directory with per-directory casefolding, `realpath()` can preserve the requested spelling of an existing manifest. The directory scan then lists the manifest itself as `NEW`, and `create` refuses to refresh it through that spelling. Compare directory identity for containment and resolve the manifest's actual entry in that directory. If multiple entries share an inode, the Linux descriptor path identifies the entry used by the lookup. A separate hard link stays visible to the existing overwrite guard. ### Tested - `python -I tests/test_manifest.py -v` and `python -I tests/test_report_paths.py -v` on CachyOS (Linux 7.3.6, Python 3.14.10), using synthetic files on tmpfs. With per-directory casefold enabled, 70 passed and 2 skipped. On ordinary tmpfs, 66 passed and 6 skipped. - On the original implementation the folded-directory tests report the manifest as `NEW` for ASCII case, Unicode composition, and a default-ignorable character. The directory alias and separate hard-link cases also fail on the original code and pass with this change. - `tests/test_text_write_line_endings.py`, `scripts/check_no_game_data.py tools/manifest.py tests/test_manifest.py`, and `git diff --check` passed. - Native Windows and macOS were outside this test run. The same-directory hard-link case used Linux with procfs. GPUs tested: n/a (CPU only). AI-assisted: OpenAI Codex with GPT-6.2, independently reviewed read-only by GPT-6.2 Sol. ### Checklist - [x] Based on upstream `main` (`044339e4c`). - [x] One topic. - [x] Synthetic fixtures only.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 13:38:07 +00:00
Author
Owner

@⁠aegish-zagi on GitHub · 2026-12-02 14:36 UTC · original

Verification — VERIFY-3138

PR #3138 — manifest: resolve the stored entry on Linux casefold directories (MANIFEST-LINUX-CASEFOLD-ALIAS)
Head ac2ea358ef; MERGEABLE against current main (69cd4106c)
Tests run python -I scripts/red_green.py 3138 --remote upstream --no-cargo; plus the PR's tests/test_manifest.py run standalone against (a) plain main code and (b) the PR head, in a scratch worktree
Red on main Not constructible on this machine. The PR's test file (46 tests) passes on plain main too (OK, skipped=5): the two casefold tests skip on this case-sensitive filesystem with no casefold directory available, and the one new case-sensitive test (separate case-variant hard link) already passes on main. red_green's verdict was likewise "no red", 0 regressions, 0 fail-on-both
Green on PR All 46 tests in tests/test_manifest.py pass with the PR head (OK, skipped=5 — same skips)
Diff audit tools/manifest.py: _inside now resolves by inode walk (samestat up the ancestors) instead of case-folded path prefixes; new _manifest_entry finds the stored entry by inode (with the /proc/self/fd O_PATH disambiguation for hard links) so walk excludes the manifest itself under any alias spelling. The logic reads sound and matches the stated follow-up on #3087; no game data, one topic, claim in place
Verdict PASS on green + code audit, with the red limitation stated plainly — a maintainer with a casefold filesystem (or a case-insensitive volume) can construct the red this machine cannot
Platform Linux, Python 3.12.3, no GPU (Profile Z)

AI-assisted: yes (Muse Wonder, Muse by Meta)

**@⁠aegish-zagi** on GitHub · 2026-12-02 14:36 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3138#issuecomment-7348833570) Verification — VERIFY-3138 | | | |---|---| | PR | #3138 — manifest: resolve the stored entry on Linux casefold directories (MANIFEST-LINUX-CASEFOLD-ALIAS) | | Head | ac2ea358efdbf78087878b3dcd0540046f6fc424; MERGEABLE against current main (69cd4106c) | | Tests run | `python -I scripts/red_green.py 3138 --remote upstream --no-cargo`; plus the PR's `tests/test_manifest.py` run standalone against (a) plain main code and (b) the PR head, in a scratch worktree | | Red on main | **Not constructible on this machine.** The PR's test file (46 tests) passes on plain main too (OK, skipped=5): the two casefold tests skip on this case-sensitive filesystem with no casefold directory available, and the one new case-sensitive test (separate case-variant hard link) already passes on main. red_green's verdict was likewise "no red", 0 regressions, 0 fail-on-both | | Green on PR | All 46 tests in tests/test_manifest.py pass with the PR head (OK, skipped=5 — same skips) | | Diff audit | tools/manifest.py: `_inside` now resolves by inode walk (samestat up the ancestors) instead of case-folded path prefixes; new `_manifest_entry` finds the stored entry by inode (with the /proc/self/fd O_PATH disambiguation for hard links) so `walk` excludes the manifest itself under any alias spelling. The logic reads sound and matches the stated follow-up on #3087; no game data, one topic, claim in place | | Verdict | **PASS on green + code audit, with the red limitation stated plainly** — a maintainer with a casefold filesystem (or a case-insensitive volume) can construct the red this machine cannot | | Platform | Linux, Python 3.12.3, no GPU (Profile Z) | AI-assisted: yes (Muse Wonder, Muse by Meta)
Author
Owner

@⁠merzleckeier on GitHub · 2026-12-02 14:42 UTC · original

Thanks for the independent check. I reran the PR’s exact tests/test_manifest.py on current main (acc350745) and on the clean merge of ac2ea358, using the same Linux casefold filesystem for both runs.

On CachyOS 7.3.6 with Python 3.14.10, I used a private mount namespace (unshare -Ur -m), mounted a fresh tmpfs with -o casefold, set chattr +F on its empty root, and used it as TMPDIR. A differently cased lookup of a probe file confirmed actual casefolding before the tests ran.

main reproduced five failures and one error across 46 tests. Plain case differences, decomposed Unicode and the default-ignorable character caused the manifest to appear as NEW. The fallback scan also included the manifest itself when it had another hard link. With the PR, 45 manifest tests and 25 path-reporting tests passed. Each suite had one expected skip, and both of the casefold tests that skipped in your run passed here. AI-assisted with OpenAI Codex.

**@⁠merzleckeier** on GitHub · 2026-12-02 14:42 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3138#issuecomment-7349000052) Thanks for the independent check. I reran the PR’s exact `tests/test_manifest.py` on current `main` (`acc350745`) and on the clean merge of `ac2ea358`, using the same Linux casefold filesystem for both runs. On CachyOS 7.3.6 with Python 3.14.10, I used a private mount namespace (`unshare -Ur -m`), mounted a fresh `tmpfs` with `-o casefold`, set `chattr +F` on its empty root, and used it as `TMPDIR`. A differently cased lookup of a probe file confirmed actual casefolding before the tests ran. `main` reproduced five failures and one error across 46 tests. Plain case differences, decomposed Unicode and the default-ignorable character caused the manifest to appear as `NEW`. The fallback scan also included the manifest itself when it had another hard link. With the PR, 45 manifest tests and 25 path-reporting tests passed. Each suite had one expected skip, and both of the casefold tests that skipped in your run passed here. AI-assisted with OpenAI Codex.
Author
Owner

@⁠MoonEyes on GitHub · 2026-12-02 15:12 UTC · original

Merging. Head ac2ea358e merges cleanly with main 83046a713 and does not force a rebase of #2566. Independent check on head ac2ea358e: aegish-zagi's verification on this head (green on the merge plus a code audit; red not constructible on their case-sensitive filesystem), comment 7348833570; CI green incl. no-game-data; no open review or question. Merged by MoonEyes.

AI-assisted (Claude Code).

**@⁠MoonEyes** on GitHub · 2026-12-02 15:12 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3138#issuecomment-7349935854) Merging. Head `ac2ea358e` merges cleanly with `main` `83046a713` and does not force a rebase of #2566. Independent check on head ac2ea358e: aegish-zagi's verification on this head (green on the merge plus a code audit; red not constructible on their case-sensitive filesystem), comment 7348833570; CI green incl. no-game-data; no open review or question. Merged by MoonEyes. AI-assisted (Claude Code).
github-bot changed target branch from main to gh-pr/3138/base 2026-12-02 15:29:34 +00:00
github manually merged commit ac2ea358ef into gh-pr/3138/base 2026-12-02 15:30:20 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
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
github/ubiquitarianism--leonida!3138
No description provided.