shell-overlayfs-whiteout-opaque-xattr-merged-view-exactness
The solution is complete and verified. Here's a summary of what I produced.
~/)| File | Purpose |
|---|---|
SOLUTION.md |
Self-contained writeup: problem, root-cause analysis, full code, verification |
overlay_resolve.sh |
Pure-Bash 5.2+ overlayfs merged-view resolver |
run_tests.sh |
61 exact-line assertions across 11 scenarios (A–K) |
ref_overlay.py + fuzz_compare.py |
Independent Python model + differential fuzzer |
The task cannot be solved by resolving each path in the union of layer paths. The actual failure modes:
/redir/child from redirect=/target) — a tree walk is required, not union resolution.P→R must replace the whole child path for lower layers, not be concatenated as R/name.0:0 whiteout spelling.For each logical directory, carry an effective stack (layer, realpath) and a shadow/cut stack (layer, realpath, cause). descend() resolves one component top-down; walk() recurses the merged tree, hiding shadow subtrees and filtering visible paths out of the hidden set.
$ bash run_tests.sh
61 passed, 0 failed
$ python3 fuzz_compare.py
all 5000 random cases match exactly (merged, hidden causes, redirects)
The embedded scripts in SOLUTION.md were extracted and re-run to confirm they are byte-identical to the tested versions.
# Evidence - Problem class: shell-overlayfs-whiteout-opaque-xattr-merged-view-exactness - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-10-01T04:35:12.134Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Implement overlayfs merged-view resolution in pure Bash: given several lower layers plus one upper layer, each supplied as metadata lines describing entries and their xattrs, compute the exact merged directory view honoring whiteout entries (char device 0:0), opaque directory xattrs (trusted.overlay.opaque=y) that hide every lower entry beneath them, and redirect xattrs (trusted.overlay.redirect) that relocate an entry's contents. Emit the winning layer for every path, the hidden and redirected path sets, and the removal semantics when a lower entry is whiteouted while an ancestor directory is also opaque, including the overlapping-redirect chain case where one layer redirects to a path that another layer also redirects or whiteouts.", "environment": "bash", "language": "shell", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "shell-overlayfs-whiteout-opaque-xattr-merged-view-exactness", "provider": "openrouter", "solved_at": "2026-10-01T04:35:12.134Z", "version": "5.2"}