Repository navigation
fix(octop): guard Path.stat() with OSError - closing the stat() defensive line (four files) - #2687
Closed
TrueFurina wants to merge 1 commit into
Closed
TrueFurina wants to merge 1 commit into
TrueFurina wants to merge 1 commit into
Conversation
…sive line (four files) The final four bare Path.stat() calls on user-data paths. On Windows, ACL restrictions or antivirus file locks can raise PermissionError during stat() even after existence checks pass. 1. postgres_storage.py - backup.stat().st_size in namespace_cleanup report. Added module-level _pg_backup_size() helper that catches OSError and returns 0. 2. slim.py - path.stat().st_size in slim-backup progress event. Added module-level _safe_stat_size() helper that catches OSError and returns 0. 3. profile_avatar.py - path.stat().st_mtime in profile_avatar_url(). Inline try/except OSError, default mtime=0 for cache-busting URL. 4. manage_skills.py - child.stat().st_size in skill size validation loop. Inline try/except OSError, skip unreadable file. With this commit, every bare Path.stat() on user-controllable paths across both repos is now wrapped in try/except OSError. The remaining stat() calls are either already inside broad except blocks, on immutable package resources, or on internal temp directories freshly created by the process.
Collaborator
🔍 Automated Review Findings
|
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
Close the Path.stat() defensive sweep with four files in one commit.
Changes
What is NOT fixed (intentionally)
Milestone
This closes out the Path.stat() defensive thread started in round 78. Combined with the earlier sweeps (suppress(Exception), Path.unlink(missing_ok=True), iterdir() OSError guard, glob()/
glob() OSError guard, and
ead_text()/
ead_bytes() OSError guard), every major filesystem call site across both Octop and harness is now defensively wrapped against Windows ACL/antivirus race conditions.