`--glob-archive` does not work with regexp in borg list
Not sure, may be not 1.2 version specific, but --glob-archive does not working with regexp:
borg list user123.mysql --prefix user123-2 | awk '{print $1}'
user123-2022-03-20-065449
...
user123-2022-03-28-031228
borg list user123.mysql -a "re:^user123"
# empty output
In my scenario I have to select snapshots to prune with filter based on prefix (exact match) and suffix (regexp), Seems to be not possible now.
From https://borgbackup.readthedocs.io/en/stable/usage/list.html:
only consider archive names matching the glob. sh: rules apply, see “borg help patterns”.
There is nothing about other patterns should not work in case they are specified, and there is definitely should be the way to select snapshots by prefix AND suffix, and both regexp.
I'm using borg 1.2.0 from compiled github releases, "linuxold" version.
Originally posted by @knutov in https://github.com/borgbackup/borg/discussions/6337#discussioncomment-2452748
Is that a regression / did that work with 1.1.x?
Just checked now, with 1.1.17 it also does not work.
manifest.Archives.list only supports shell pattern style. regex is not implemented there (yet?).
Guess it would be easy to implement via borg.patterns.parse_pattern.
Just the default needs to stay as is for compatibility.
@knutov have a look at PR #7028.
@ThomasWaldmann looks great! Will it be released in 1.2 branch?
Guess I rather won't backport that:
- widespread changes
- changing the option name would break scripts
- master patches likely can't be cherry-picked easily due to master now being formatted by
blackand due to the code being split into many modules
If somebody else wants to do a backport to 1.2-maint branch, I guess it would be acceptable if:
- all the renaming i did in master branch is not done (== keep
globfunc param, keep--glob-archivesoption name) - keep the default behaviour of using shell patterns (no prefix means same as
sh:prefix), so no existing scripts break - use other code and tests similar as in PR #7028