Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PICARD-2991: Handle statvfs errors on file rename #2555

Merged
merged 2 commits into from
Dec 2, 2024

Conversation

phw
Copy link
Member

@phw phw commented Dec 1, 2024

Summary

  • This is a…
    • Bug fix
    • Feature addition
    • Refactoring
    • Minor / simple change (like a typo)
    • Other
  • Describe this change in 1-2 sentences:

Problem

make_short_filename runs _get_filename_limit on the basedir, which in turn tries to get filename limits by calling statvfs. statvfs can fail with FileNotFoundError or PermissionError.

To reproduce:

  • In Options > File naming set the target dir to something on which os.statvfs fails. On my Linux system this is e.g. /run/user/1000/doc
  • Save options and reopen the options dialog

=> File naming failed to load, exception is logged

Solution

  1. If in _get_filename_limit the call to os.statvfs fails, retry on the parent path
  2. Do not fail to load the options dialog on FileNotFoundError or PermissionError when updating the examples

@phw phw requested a review from zas December 1, 2024 14:43
Copy link
Collaborator

@zas zas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

picard/util/filenaming.py Show resolved Hide resolved
@phw phw added the Bug fix label Dec 2, 2024
@phw phw merged commit 1c509a2 into metabrainz:master Dec 2, 2024
43 checks passed
@phw phw deleted the PICARD-2991-handle_statvfs_errors branch December 2, 2024 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants