Skip to content

Clean up zswap output leaks and missing-file reads - #20

Merged
modem7 merged 1 commit into
masterfrom
fix-zswap-output-cleanup
Jul 31, 2026
Merged

Clean up zswap output leaks and missing-file reads#20
modem7 merged 1 commit into
masterfrom
fix-zswap-output-cleanup

Conversation

@modem7

@modem7 modem7 commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

Cosmetic follow-up from pbs/frodo's real runs — no behavior change, output only:

  • The raw bash: line N: .../zpool: Permission denied diagnostic was leaking through despite 2>/dev/null on that line, because bash reports a failed redirection-target open before that same command's 2>/dev/null takes effect. Wrapped each write in { ...; } 2>/dev/null so suppression happens first.
  • Step 5 read back all four zswap parameter files assuming they all exist once .../enabled does. On pbs and frodo, .../zpool specifically was gone by the time Step 5 ran (it existed at write time — that's why the write got "Permission denied" rather than "No such file or directory" — but wasn't there moments later), throwing a raw cat: ... No such file or directory into the output. Now each parameter is read individually with an existence check.

Test plan

  • bash -n syntax check passes
  • Reasoned through against pbs/frodo's actual pasted output
  • Not re-run live — no test VM currently available; this is display-only, no new mutating commands

… reads

pbs/frodo runs showed both remaining rough edges:
- "bash: line N: .../zpool: Permission denied" leaked to the terminal
  despite the 2>/dev/null on that line, because bash reports a failed
  redirection-target open before that same command's own 2>/dev/null
  takes effect. Wrapped each write in `{ ...; } 2>/dev/null` so the
  suppression applies before the inner redirect is attempted.
- Step 5 assumed every zswap parameter file exists once .../enabled
  does. On pbs and frodo, .../zpool specifically was gone by read time
  (present enough to get "Permission denied" on write, absent by Step
  5) even though compressor/max_pool_percent/enabled were all still
  there. Now reads each parameter individually with an existence
  check instead of a bare cat that can throw "No such file or
  directory" into the output.
@modem7
modem7 merged commit 33f84bc into master Jul 31, 2026
3 checks passed
@modem7
modem7 deleted the fix-zswap-output-cleanup branch July 31, 2026 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant