Skip to content

Handle permission errors when restore replaces existing files#2173

Open
kzaoaai wants to merge 1 commit into
lra:masterfrom
kzaoaai:fix/restore-permission-error
Open

Handle permission errors when restore replaces existing files#2173
kzaoaai wants to merge 1 commit into
lra:masterfrom
kzaoaai:fix/restore-permission-error

Conversation

@kzaoaai
Copy link
Copy Markdown

@kzaoaai kzaoaai commented Apr 19, 2026

Summary

Fixes a restore crash when an existing destination path cannot be deleted due to filesystem permissions.

Problem

During mackup restore, when a destination already exists and replacement is confirmed, Mackup deletes the existing path before copying from backup.
If deletion raises PermissionError (e.g. protected app-managed paths), restore currently crashes with a traceback.

Changes

  • In restore flow (ApplicationProfile.copy_files_from_mackup_folder), catch PermissionError around destination deletion.
  • Print the same user-facing permission error message format used for copy failures.
  • Skip that item and continue processing remaining files.
  • Add regression test covering delete-time PermissionError during restore replacement.

Validation

  • Full test suite passes locally.
  • New regression test included in tests/test_application.py.

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