exclude_from in config file accepts only absolute full path #1301

Closed
opened 2026-04-26 23:39:03 +00:00 by Vaderf · 3 comments

What I'm trying to do and why

Dear developers,

First, thank you for developing borgmatic. I am learning it at the moment but looks very promising.

I have followed the documentation and set up my borgmatic configuration file. I used the exclude_from section to add an exclusion file containing file paths. When I provide an exclusion file path using ~ and $HOME, borgmatic exited because it was not able to access the file. It stopped exiting only when I provided an absolute full path.

Steps to reproduce

Add the following lines in the configuration file of borgmatic after creating a $HOME/.borgmatic_excludes.list file.

exclude_from:
    - ~/.borgmatic_excludes.list

To solve the issue, the following works:

exclude_from:
    - /home/user/.borgmatic_excludes.list

Actual behavior

/home/user/.config/borgmatic/config.yaml: BORG_PASSPHRASE_FD=*** BORG_EXIT_CODES=*** borg --version --log-json --debug --show-rc
/home/user/.config/borgmatic/config.yaml: Borg 2.0.0b21
/dest_fd: Running actions for repository
/dest_fd: Running before create action command hook
/dest_fd: find ~/tmp/test2/ -type f -name "b" > ~/.borgmatic_excludes.list
/dest_fd: Creating archive
/dest_fd: Using runtime directory /run/user/2280/borgmatic
/dest_fd: [Errno 2] No such file or directory: '~/.borgmatic_excludes.list'
/dest_fd: Error running actions for repository
/dest_fd: Cannot read patterns_from/exclude_from file: ~/.borgmatic_excludes.list
/dest_fd: Retrying... attempt 1/3
/dest_fd: Running actions for repository
/dest_fd: Sleeping 600s before next retry

Expected behavior

Borgmatic should expand the ~ or $HOME variable.

Other notes / implementation ideas

No response

borgmatic version

2.1.5

borgmatic installation method

pip install

Borg version

borg 2.0.0b21

Python version

Python 3.14.4

Database version (if applicable)

No response

Operating system and version

AlmaLinux 9.7 (Moss Jungle Cat)

### What I'm trying to do and why Dear developers, First, thank you for developing borgmatic. I am learning it at the moment but looks very promising. I have followed the documentation and set up my borgmatic configuration file. I used the `exclude_from` section to add an exclusion file containing file paths. When I provide an exclusion file path using `~` and `$HOME`, borgmatic exited because it was not able to access the file. It stopped exiting only when I provided an absolute full path. ### Steps to reproduce Add the following lines in the configuration file of borgmatic after creating a `$HOME/.borgmatic_excludes.list` file. ```yaml exclude_from: - ~/.borgmatic_excludes.list ``` To solve the issue, the following works: ```yaml exclude_from: - /home/user/.borgmatic_excludes.list ``` ### Actual behavior ```yaml /home/user/.config/borgmatic/config.yaml: BORG_PASSPHRASE_FD=*** BORG_EXIT_CODES=*** borg --version --log-json --debug --show-rc /home/user/.config/borgmatic/config.yaml: Borg 2.0.0b21 /dest_fd: Running actions for repository /dest_fd: Running before create action command hook /dest_fd: find ~/tmp/test2/ -type f -name "b" > ~/.borgmatic_excludes.list /dest_fd: Creating archive /dest_fd: Using runtime directory /run/user/2280/borgmatic /dest_fd: [Errno 2] No such file or directory: '~/.borgmatic_excludes.list' /dest_fd: Error running actions for repository /dest_fd: Cannot read patterns_from/exclude_from file: ~/.borgmatic_excludes.list /dest_fd: Retrying... attempt 1/3 /dest_fd: Running actions for repository /dest_fd: Sleeping 600s before next retry ``` ### Expected behavior Borgmatic should expand the `~` or `$HOME` variable. ### Other notes / implementation ideas _No response_ ### borgmatic version 2.1.5 ### borgmatic installation method pip install ### Borg version borg 2.0.0b21 ### Python version Python 3.14.4 ### Database version (if applicable) _No response_ ### Operating system and version AlmaLinux 9.7 (Moss Jungle Cat)
Owner

Thanks for filing this! It seems like a reasonable addition to me, especially since the exclude_patterns option already supports tildes. I'll have a look at what it would take to add this.

Thanks for filing this! It seems like a reasonable addition to me, especially since the `exclude_patterns` option already supports tildes. I'll have a look at what it would take to add this.
Owner

This is implemented in main and will be part of the next release! Thanks again for the suggestion.

This is implemented in main and will be part of the next release! Thanks again for the suggestion.
Owner

Released in borgmatic 2.1.6!

Released in borgmatic 2.1.6!
Sign in to join this conversation.
No milestone
No project
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#1301
No description provided.