Skip to content

Handle permission denied errors gracefully#52

Open
nealmcb wants to merge 1 commit into
jb2170:masterfrom
nealmcb:skip-errors
Open

Handle permission denied errors gracefully#52
nealmcb wants to merge 1 commit into
jb2170:masterfrom
nealmcb:skip-errors

Conversation

@nealmcb
Copy link
Copy Markdown

@nealmcb nealmcb commented May 5, 2025

When syncing Android storage, permission denied errors are common when accessing app-specific directories like Android/data/*/. Previously these errors would trigger a fatal error and crash the sync process.

This change:

  1. Adds proper detection of "Permission denied" errors via regex pattern matching
  2. Handles these errors gracefully by:
    • Logging warnings when permission errors occur
    • Skipping inaccessible paths instead of crashing
    • Continuing the sync process for accessible files/directories
  3. Adds more detailed error logging to help diagnose issues

The approach handles permissions at the filesystem level rather than adding a new CLI flag. This maintains the existing interface while making the tool more robust against common Android permission restrictions.

Thanks to @Sebbb for #27 and related work on the same problem, and thanks to Cursor for this particular approach based on these issues.

Fixes #11

When syncing Android storage, permission denied errors are common when accessing
app-specific directories like Android/data/*/. Previously these errors would
trigger a fatal error and crash the sync process.

This change:
1. Adds proper detection of "Permission denied" errors via regex pattern matching
2. Handles these errors gracefully by:
   - Logging warnings when permission errors occur
   - Skipping inaccessible paths instead of crashing
   - Continuing the sync process for accessible files/directories
3. Adds more detailed error logging to help diagnose issues

The approach handles permissions at the filesystem level rather than adding a new
CLI flag. This maintains the existing interface while making the tool more robust
against common Android permission restrictions.

Fixes jb2170#11
This was referenced May 5, 2025
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.

Skip Files with Errors

1 participant