regression: An empty line in a patterns_from file causes error ('Invalid pattern:', '') #970

Closed
opened 2025-01-18 14:19:54 +00:00 by jinnatar · 3 comments

What I'm trying to do and why

Run backups based on a separate patterns file injected with patterns_from. For clarity, separate "sections" in my pattern file have had an empty line between them. This empty line is now as of today interpreted as a pattern which causes borgmatic to exit with ('Invalid pattern:', '')

Steps to reproduce

Use a patterns.lst file such as:

- *.tmp
- *.pyc
! **/.cache/
! **/Cache/
! **/cache/
! **/.noindex
! **/__pycache__
! **/_cacache

R ./
! esphome/.esphome/build/
! esphome/.esphome/platformio/

Run it via a config containing:

patterns_from:
  - /local/patterns.lst

Actual behavior

summary:
/etc/borgmatic.d/borgmatic.yaml: An error occurred
localserver: Error running actions for repository
('Invalid pattern:', '')

Expected behavior

Ignore the empty pattern line as before.

Other notes / implementation ideas

Based on timing I'm betting this came with release 1.9.6.

borgmatic version

1.9.6

borgmatic installation method

ghcr.io/borgmatic-collective/borgmatic:latest

Borg version

N/A

Python version

N/A

Database version (if applicable)

N/A

Operating system and version

N/A

### What I'm trying to do and why Run backups based on a separate patterns file injected with `patterns_from`. For clarity, separate "sections" in my pattern file have had an empty line between them. This empty line is now as of today interpreted as a pattern which causes borgmatic to exit with `('Invalid pattern:', '')` ### Steps to reproduce Use a patterns.lst file such as: ``` - *.tmp - *.pyc ! **/.cache/ ! **/Cache/ ! **/cache/ ! **/.noindex ! **/__pycache__ ! **/_cacache R ./ ! esphome/.esphome/build/ ! esphome/.esphome/platformio/ ``` Run it via a config containing: ```yaml patterns_from: - /local/patterns.lst ``` ### Actual behavior > summary: /etc/borgmatic.d/borgmatic.yaml: An error occurred localserver: Error running actions for repository ('Invalid pattern:', '') ### Expected behavior Ignore the empty pattern line as before. ### Other notes / implementation ideas Based on timing I'm betting this came with release `1.9.6`. ### borgmatic version 1.9.6 ### borgmatic installation method ghcr.io/borgmatic-collective/borgmatic:latest ### Borg version N/A ### Python version N/A ### Database version (if applicable) N/A ### Operating system and version N/A
Owner

Yeah, this is definitely a regression introduced by 1.9.6 and specifically by #962. Thanks for taking the time to file it! I can work on a fix, but in the meantime, you can either downgrade to borgmatic 1.9.5 or replace your blank lines with comments (just # by itself on a line would do it).

Yeah, this is definitely a regression introduced by 1.9.6 and specifically by #962. Thanks for taking the time to file it! I can work on a fix, but in the meantime, you can either downgrade to borgmatic 1.9.5 or replace your blank lines with comments (just `#` by itself on a line would do it).
Owner

This is fixed in main now and will be part of the next release. (For the record, the same problem also applied to excludes.) Thanks again!

This is fixed in main now and will be part of the next release. (For the record, the same problem also applied to excludes.) Thanks again!
Owner

Released in borgmatic 1.9.7!

Released in borgmatic 1.9.7!
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#970