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

Wildcard extraction does not work #8589

Open
Atemu opened this issue Dec 20, 2024 · 5 comments · May be fixed by #8590
Open

Wildcard extraction does not work #8589

Atemu opened this issue Dec 20, 2024 · 5 comments · May be fixed by #8590

Comments

@Atemu
Copy link

Atemu commented Dec 20, 2024

Have you checked borgbackup docs, FAQ, and open GitHub issues?

Yes

Is this a BUG / ISSUE report or a QUESTION?

BUG

System information. For client/server mode post info for both machines.

Your borg version (borg -V).

borg 1.4.0

Operating system (distribution) and version.

NixOS/nixpkgs@5d67ea6

Hardware / network configuration, and filesystems used.

tmpfs

How much data is handled by borg?

kilobytes

Full borg commandline that lead to the problem (leave away excludes and passwords)

borg extract --dry-run --list /var/tmp/borg/::foo 'a*'

Describe the problem you're observing.

I tried to extract multiple files that have the same prefix. The simplest method to achieve this in my mind would be to use a wildcard. According to #361, wildcards should be supported by borg but there is no documentation on it (:/) and they evidently do not work.

Am I doing something wrong? Are users expected to understand and create borg-specific patterns instead to achieve this sort of thing?

Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.

  1. touch a aa aaa
  2. borg create /var/tmp/borg/::foo .
  3. borg extract --dry-run --list /var/tmp/borg/::foo 'a*'

Include any warning/errors/backtraces from the system logs

Include pattern 'a*' never matched.
@Atemu
Copy link
Author

Atemu commented Dec 20, 2024

borg extract --dry-run --list /var/tmp/borg/::foo --pattern '+ a*' --pattern '- *' appears to work but that is not at all ergonomical.

@infectormp
Copy link
Contributor

You should use --pattern to define what you want to include/exclude. IMHO it is clearly documented. If not feel free to do PR to improve documentation.

@ThomasWaldmann ThomasWaldmann added this to the 1.4.1 milestone Dec 20, 2024
@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Dec 20, 2024

Maybe the docs need to be improved there. I had a look at the 1.4.0 source and this is what it does:

The PATHS list from the command line is processed as "include paths" and the default pattern style used is PathPrefixPattern (pp:), which just implements a simple prefix matching, but not wildcards.

If one wants another style, e.g. sh: or re: or fm:, that needs to be explicitly prefixed. The docs about this can be obtained by borg help patterns or online using the same search terms.

This works:

borg extract --list ::archive 'sh:a*'    

See also the comment in the commit that implemented this:

ceae4a9

@Atemu
Copy link
Author

Atemu commented Dec 20, 2024

Indeed that works.

I'd personally advocate for that to be made the default pattern interpretation because that is the least surprising IMHO.

I'd also be okay with the fact that you need to prepend sh: to path declarations in order to have wildcards work as expected being documented and ideally used in an example.

@Atemu
Copy link
Author

Atemu commented Dec 20, 2024

#8590

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants