Harden Resource Hogs quit and scanner lstat failure (1.21.0) - #178
Merged
Merged
Conversation
Two defensive follow-ups to the audited PR batch (#176, #172): - Resource Hogs: before Force Quit, re-resolve the live NSRunningApplication by PID and confirm its bundle identifier still matches the row (and is still quittable) before terminating. A recycled PID can no longer take down a different app between the snapshot and the click. - Scanner: if lstat fails (transient permission or race), keep the file with inode/deviceID 0 instead of dropping it. inode 0 is already treated as "unknown, never a hard-link match" by DuplicateDetection, so the file still appears in the six non-dedup modules and is simply never collapsed. Bump version to 1.21.0.
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.
Two small, defensive follow-ups to the audited PR batch that just landed (#176 Resource Hogs, #172 hard-link dedup). Both are edge-case hardenings, not bug fixes for anything users hit today.
Resource Hogs: PID-reuse guard before Force Quit
The quit row is captured from an earlier snapshot. Between the snapshot and the user clicking Force Quit, the target process can exit and the OS can hand its PID to a different app. Now, right before terminating, we re-resolve the live
NSRunningApplicationby PID and confirm its bundle identifier still matches the row (and is still on the quittable list). If it changed or is gone, we show "That process is no longer running" and do nothing. A recycled PID can no longer take down the wrong app.Scanner: keep files when lstat fails
makeFileItemreads (st_dev, st_ino) vialstatsoDuplicateDetectioncan collapse hard links. Previously a failedlstat(transient permission error or a race) dropped the file from the scan entirely, which would silently hide it from all six non-dedup modules. Now we keep the file with inode/deviceID 0.DuplicateDetectionalready treats inode 0 as "unknown, never a hard-link match", so the file shows up normally and is simply never collapsed as a duplicate.Version bumped to 1.21.0. Full gate green locally (
check-version-sync+swift build+ 879 tests, 0 failures).