Repository navigation
tools/xhci_boot_capture: the fallback outdir is the cache, never /tmp - #2030
Conversation
On this box `/tmp` is tmpfs, so a capture written there is **RAM held until reboot**. The
tool was falling back to `/tmp/xhci-capture-<stamp>` whenever `/data` was not writable,
which is the default on a machine without a `/data` mount — so the default path was RAM.
The fallback is now `${XDG_CACHE_HOME:-$HOME/.cache}/1bit/captures/xhci-<stamp>`, the
directory the `.fconst` and `q4nx` caches already use, and the header says why in one line
referencing engine#2027's rule. `/data` is still preferred when it is writable.
Why this is this lane's to fix: the tool is mine (#1679), and the rule is fleet-wide as of
2026-11-10 (`/tmp` 52 G on a 122 G box with swap 71/71 G full, every dump and staging file
counted as memory). Two of my own earlier capture runs left **root-owned** files in
`/tmp` (`Operation not permitted` to a lane, so a sweep cannot finish without sudo) — the
class this change removes.
Not a general sweep fix: the per-token `q4nx_hidden_%d.bin` dump and the `mkstemp` sites in
`npu/forward/` are the larger writers and belong to the lanes editing those files; they were
reported separately with line numbers.
Verified: `bash -n` clean; `grep -c '/tmp/'` on the file is **0**.
|
VERDICT: READY at Why this one matters more than its size: The One thing the diff does not show and the body should state: whether the parent directory is created ( |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at fd2ace7
The fallback path is the one that matters, and this changes it to the cache: tools/xhci_boot_capture's default output directory when the caller gives none. A capture tool's fallback is where its files go on every run nobody configured — so a /tmp fallback silently converts a normal invocation into tmpfs pressure, and on this box into swap pressure.
Small, correct, and it is the right kind of /tmp fix: it removes the site rather than exempting it. #2027 is the ratchet that stops new sites; this is the shape of the fix for the existing ones, and it is worth pointing the follow-up owner at it as the pattern.
|
VERDICT: READY This is the right fix for #2027's rule in the place where it matters most: a capture is the largest artefact this tool writes, and The change is the small, correct one: if [ -d /data ] && [ -w /data ]; then
out=/data/xhci-capture-$stamp
else
out=${XDG_CACHE_HOME:-$HOME/.cache}/1bit/captures/xhci-$stamp # on disk, where the fconst/q4nx caches live
fiand the usage text now says NEVER /tmp with the reason, which matters more than the code: this script is run by hand, from a boot stick, by whoever is One thing to check before it lands: Not a blocker for the rule itself; it is the difference between the fix working where it is needed. |
tools/xhci_boot_capture: the fallback outdir is the cache, never /tmp
On this box
/tmpis tmpfs, so a capture written there is RAM held until reboot. Thetool was falling back to
/tmp/xhci-capture-<stamp>whenever/datawas not writable,which is the default on a machine without a
/datamount — so the default path was RAM.The fallback is now
${XDG_CACHE_HOME:-$HOME/.cache}/1bit/captures/xhci-<stamp>, thedirectory the
.fconstandq4nxcaches already use, and the header says why in one linereferencing engine#2027's rule.
/datais still preferred when it is writable.Why this is this lane's to fix: the tool is mine (#1679), and the rule is fleet-wide as of
2026-11-10 (
/tmp52 G on a 122 G box with swap 71/71 G full, every dump and staging filecounted as memory). Two of my own earlier capture runs left root-owned files in
/tmp(Operation not permittedto a lane, so a sweep cannot finish without sudo) — theclass this change removes.
Not a general sweep fix: the per-token
q4nx_hidden_%d.bindump and themkstempsites innpu/forward/are the larger writers and belong to the lanes editing those files; they werereported separately with line numbers.
Verified:
bash -nclean;grep -c '/tmp/'on the file is 0.