Skip to content

Harden Resource Hogs quit and scanner lstat failure (1.21.0) - #178

Merged
iliyami merged 1 commit into
mainfrom
fix/audit-hardenings
Sep 22, 2026
Merged

iliyami merged 1 commit into
mainfrom
fix/audit-hardenings

Conversation

@iliyami

@iliyami iliyami commented Sep 22, 2026

Copy link
Copy Markdown
Owner

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 NSRunningApplication by 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

makeFileItem reads (st_dev, st_ino) via lstat so DuplicateDetection can collapse hard links. Previously a failed lstat (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. DuplicateDetection already 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).

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.
@iliyami
iliyami merged commit 54423e8 into main Sep 22, 2026
2 checks passed
@iliyami
iliyami deleted the fix/audit-hardenings branch September 22, 2026 00:10
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