Clean up zswap output leaks and missing-file reads - #20
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cosmetic follow-up from pbs/frodo's real runs — no behavior change, output only:
bash: line N: .../zpool: Permission denieddiagnostic was leaking through despite2>/dev/nullon that line, because bash reports a failed redirection-target open before that same command's2>/dev/nulltakes effect. Wrapped each write in{ ...; } 2>/dev/nullso suppression happens first..../enableddoes. On pbs and frodo,.../zpoolspecifically 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 rawcat: ... No such file or directoryinto the output. Now each parameter is read individually with an existence check.Test plan
bash -nsyntax check passes