Repository navigation
Keep hibernation resume offset in sync with the swapfile - #13768
rand0mdud3 wants to merge 2 commits into
Conversation
Tested commit Verification Summary
Verification outputThe fix directly addresses #13583 with clean teardown, reliable offset recomputation, and thorough test coverage.
|
|
Thanks for the thorough independent verification — base reproduction, all four test assertions, plus the command-metadata and whitespace checks. Good to have the defect and the fix both confirmed outside my own environment. Nothing to change from my side; this one is awaiting maintainer review. |
|
Reviewed at 6e3991d and verified on an Omarchy worker VM (real btrfs root, Limine, hibernation already configured), against Reproduction. On Suite. Review. Claude Opus 5.5 and Codex Medium, as a second opinion, both read the diff and its callers, including Related. It overlaps with #13908 (empty resume device), which rewrites the same block of Nothing is needed from the author. This waits on the maintainer, and on the unrelated |
|
Heads-up from #14379: I'm planning to pick up the complementary half — a boot-time consistency check that catches a swapfile whose live offset drifted from what |
|
No overlap from my side — welcome complement. This diff only touches the setup/remove sync path ( On the path question: the swapfile path is not recorded anywhere. It's a hardcoded Your real-world case (configured 1630758 vs actual 1894950 after a move outside the tooling) is precisely the hole this PR can't cover — glad it's being picked up. |
6e3991d to
9d5c0a6
Compare
Removing hibernation deleted the swapfile, fstab entry, and mkinitcpio hook but left /etc/limine-entry-tool.d/resume.conf behind, and setup kept any existing file. A later setup then resumed from a stale offset and silently lost the session. Remove now deletes the resume kernel parameters with the rest of the teardown; setup always recomputes device and offset from the current swapfile.
|
Rebased onto current Conflict and resolution: upstream added Unchanged in intent: remove still deletes Verification on the rebased head (9d5c0a6): Scope note for #14360 and #11437: this covers the stale-offset-on-setup and remove paths only. The empty |
[Medium impact] The PR appears safe to merge, with a non-blocking test isolation fix recommended. Findings
SummaryRemoves leftover resume parameters during hibernation teardown and recomputes them during fresh setup.
Reviews (2) · Last reviewed commit: "Fold the regression cases into the hiber..." · Reviewed by Greptile |
Greptile asked for both: the new file repeated the setup stubs in hibernation-setup-test.sh, and AGENTS.md says to extend the area's existing test rather than add another *-test.sh. The two setup cases become one (a fresh setup was already covered), the stub for gum can now confirm removal, and the build stub tolerates the drop-in remove has just deleted. Each added case fails on the base branch for the reason the fix exists: the leftover resume.conf keeps its stale offset, and remove leaves the kernel parameters behind.
|
Both Greptile findings addressed in Test depended on host settings (P1). Correct: the separate file only stubbed the helpers it thought it needed, so on a host with sleep disabled, or an Apple Silicon Mac, the real New test duplicated the existing setup (P2). Correct per What the merge changed, and why it is smaller than a straight move:
Verification, each case failing on the base branch for the reason the fix exists:
|
| printf '#!/bin/bash\nexit 0\n' >"$rtmp/bin/swaplabel" | ||
| printf '#!/bin/bash\n[[ $1 == --show ]] && echo "$SWAP_FILE_PATH"\nexit 0\n' >"$rtmp/bin/swapon" | ||
| printf '#!/bin/bash\n[[ $1 == inspect-internal ]] && echo 4242\nexit 0\n' >"$rtmp/bin/btrfs" | ||
| printf '#!/bin/bash\n[[ $1 == subvolume ]] && exit 1\n[[ $1 == inspect-internal ]] && echo 4242\nexit 0\n' >"$rtmp/bin/btrfs" |
There was a problem hiding this comment.
Test reaches the host directory
The new btrfs stub makes fresh setup enter the subvolume-creation branch, which calls the real chattr +C /swap. The setup copy rewrites /swap/swapfile but leaves SWAP_SUBVOLUME="/swap" unchanged, and the fake sudo simply runs the command.
Ordinary runs hide the resulting permission error. If the test runs as root, it can change the real directory's flags. Rewrite "/swap" in the setup copy too, and stub chattr.
|
Re-reviewed at 409200d, against Why #8199. By default the oldest fix wins. A newer one wins only when it is clearly better, and this one isn't. #8199 makes the same setup change: it always recomputes the device and offset with
Nothing here needs to be folded into #8199. Its tests already cover the leftover-drop-in setup case, and its remove test checks that the drop-in is gone when the boot image is rebuilt. Two problems in this branch's test, for the record:
What was checked: the diff and both scripts at this head, read against The choice between the competing fixes belongs to the maintainer, so this waits on them. @rand0mdud3, thank you for the careful rebase onto |
|
Checked #8199 against ours: the assessment is right, and I'd rather it be the one carried. Verified in #8199's diff, the three cases this branch does not handle:
Both test findings are real, and both are mine — they came in with the fold-in at 409200d, not with the original change:
That is enough to say this branch should not be merged as it stands: the test as written can touch the host, which is worse than the coverage it adds. Nothing here needs folding into #8199. The choice stays with the maintainer. If #8199 is the one, I'll close this as superseded; if you'd rather keep this branch, I'll fix the two test defects and add the missing cases rather than leave it as is. |
|
Closing as superseded by #8199. It covers the same fix for #13583 and the three cases this branch missed (stale drop-in left by an older remove, an empty offset lookup, a failed delete), and it has been open since 25 August. The test in this branch can touch the host through the Nothing to fold in; #8199's own tests cover the leftover-drop-in setup case. Reopen if the maintainer ever prefers this branch, and I'll fix the two test defects first. |
Fixes #13583.
Removing hibernation deleted the swapfile, fstab entry, and mkinitcpio hook but left
/etc/limine-entry-tool.d/resume.confbehind — and setup kept any existing file ([[ ! -f ]]guard). A later setup then resumed from a stale offset and silently lost the session.omarchy-hibernation-removenow deletes the resume kernel parameters with the rest of the teardown.omarchy-hibernation-setupalways recomputes device and offset from the current swapfile instead of keeping a leftover file.Verified: new
test/shell.d/hibernation-resume-conf-test.sh4/4 (fails on base, passes with the fix), style suite green,./test/cliandunowned-system-paths-testshow only failures that reproduce identically on pristine base.