Repository navigation
fix(octop): guard Path.stat() with OSError in backup store (three call sites) - #2667
Closed
TrueFurina wants to merge 1 commit into
Closed
TrueFurina wants to merge 1 commit into
TrueFurina wants to merge 1 commit into
Conversation
…tes) Three bare Path.stat() calls in the backup store module. On Windows, stat() can raise PermissionError from ACL restrictions or antivirus file locks even after is_file()/is_dir() gates pass. All three are on user-data paths under the backups directory. 1. resolve_backup_created_at(): stat().st_birthtime fallback after filename stamp. On OSError default birth=None and fall through to mtime. 2. list_backup_files(): sorted key function p.stat().st_mtime plus the iterdir() call. Wrap both in try/except OSError and return empty list. 3. backup_file_info(): stat() after is_file() check. On OSError raise OctopError(NOT_FOUND) with 'unreadable' message.
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
Wrap three bare Path.stat() calls in infra/backup/store.py with try/except OSError. One file, one commit.
Changes
Context
All three paths gate stat() with is_file()/is_dir() checks. On Windows these only verify directory entry existence, not read permission. ACL restrictions, antivirus file locks, or transient handles can all raise PermissionError during stat() — the exact same failure mode fixed for iterdir(), glob(), and read_text()/read_bytes() in preceding rounds.