Borgbmatic errors out when system-wide configuration dir is not readable #350

Closed
opened 2020-08-08 08:51:47 +00:00 by apollo13 · 4 comments

What I'm trying to do and why

I am trying to create a backup :)

Steps to reproduce (if a bug)

Put any config into ~/.config/borgmatic/...

Actual behavior (if a bug)

Run as non-root user and get greated by:

Traceback (most recent call last):
  File "/usr/bin/borgmatic", line 11, in <module>
    load_entry_point('borgmatic==1.5.9', 'console_scripts', 'borgmatic')()
  File "/usr/lib/python3.8/site-packages/borgmatic/commands/borgmatic.py", line 743, in main
    config_filenames = tuple(collect.collect_config_filenames(global_arguments.config_paths))
  File "/usr/lib/python3.8/site-packages/borgmatic/config/collect.py", line 47, in collect_config_filenames
    for filename in sorted(os.listdir(path)):
PermissionError: [Errno 13] Permission denied: '/etc/borgmatic.d'

Expected behavior (if a bug)

When run as normal user, borgmatic should skip non-readable folders. System wide configuration files are often for root, especially since the config file can contain sensitive data (especially the passphrase). So Fedora chose to package the configuration directory with restrictive permissions.

Other notes / implementation ideas

Either completly skip non-readable directories or issue a warning instead of a hard error

Environment

borgmatic version: 1.5.9

borgmatic installation method: Fedora

Borg version: 1.1.13

Python version: 3.8.5

operating system and version: Fedora 32

#### What I'm trying to do and why I am trying to create a backup :) #### Steps to reproduce (if a bug) Put *any* config into *~/.config/borgmatic/...* #### Actual behavior (if a bug) Run as non-root user and get greated by: ``` Traceback (most recent call last): File "/usr/bin/borgmatic", line 11, in <module> load_entry_point('borgmatic==1.5.9', 'console_scripts', 'borgmatic')() File "/usr/lib/python3.8/site-packages/borgmatic/commands/borgmatic.py", line 743, in main config_filenames = tuple(collect.collect_config_filenames(global_arguments.config_paths)) File "/usr/lib/python3.8/site-packages/borgmatic/config/collect.py", line 47, in collect_config_filenames for filename in sorted(os.listdir(path)): PermissionError: [Errno 13] Permission denied: '/etc/borgmatic.d' ``` #### Expected behavior (if a bug) When run as normal user, borgmatic should skip non-readable folders. System wide configuration files are often for root, especially since the config file can contain sensitive data (especially the passphrase). So Fedora chose to package the configuration directory with restrictive permissions. #### Other notes / implementation ideas Either completly skip non-readable directories or issue a warning instead of a hard error #### Environment **borgmatic version:** 1.5.9 **borgmatic installation method:** Fedora **Borg version:** 1.1.13 **Python version:** 3.8.5 **operating system and version:** Fedora 32
Owner

Totally agree that this looks like a bug! Ideally, borgmatic should never present an error to a user as a traceback. And your suggestion about skipping non-readable directories sounds reasonable to me. Thank you for bringing this to my attention.

Totally agree that this looks like a bug! Ideally, borgmatic should never present an error to a user as a traceback. And your suggestion about skipping non-readable directories sounds reasonable to me. Thank you for bringing this to my attention.
witten added the
bug
label 2020-08-08 19:22:37 +00:00
Owner

This is fixed in master now! Non-readable configuration directories are silently skipped. This fix will be part of the next release. Thanks again!

This is fixed in master now! Non-readable configuration directories are silently skipped. This fix will be part of the next release. Thanks again!
Author

Lovely, thank you for the quick fix -- now I no longer have to remove /etc/borgmatic.d after every fedora update :)

Lovely, thank you for the quick fix -- now I no longer have to remove `/etc/borgmatic.d` after every fedora update :)
Owner

Just released in borgmatic 1.5.10!

Just released in borgmatic 1.5.10!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#350
No description provided.