spot check fails when archive use relative source paths #960

Closed
opened 2024-12-29 20:42:41 +00:00 by chamalulu · 3 comments

What I'm trying to do and why

I have a configuration using relative source paths including (.) segment to trigger the "slashdot hack" when borg interprets the recursion roots. The reason for including (.) segment is that borgmatic prefixes recursion roots with the working directory when calling borg create and I don't want the working directory in the paths in the archive.

spot check fails because the paths in the archive does not include path segments down to the working directory.

Steps to reproduce

Use configuration with relative source paths including a (.) segment.

source_directories:
    - ./source

working_directory: /mnt/snapshot/

Rest of configuration, including spot check configuration, is excluded for brevity.

Actual behavior

borgmatic execute borg create in /mnt/snapshot with recursion root path /mnt/snapshot/./source.

borg create add contents of /mnt/snapshot/source to archive with paths beginning with source/.

When spot check is run, borgmatic execute borg list with paths beginning with /mnt/snapshot/source/.

borg list return no hits since the paths don't match any of the paths in the archive.

Expected behavior

When spot check is run, borgmatic should execute borg list with paths beginning with source/.

Other notes / implementation ideas

The expected behavior could be accomplished by removing the prefix from spot check candidate paths if the source directory contains a (.) path segment before calling borg list.
I'm not sure why the recursion roots are prefixed with the working directory when borgmatic creates an archive. Is this necessary?

borgmatic version

1.9.3

borgmatic installation method

Debian package

Borg version

borg 1.4.0

Python version

Python 3.12.8

Database version (if applicable)

No response

Operating system and version

Debian GNU/Linux trixie/sid

### What I'm trying to do and why I have a configuration using relative source paths including (.) segment to trigger the "slashdot hack" when borg interprets the recursion roots. The reason for including (.) segment is that borgmatic prefixes recursion roots with the working directory when calling `borg create` and I don't want the working directory in the paths in the archive. spot check fails because the paths in the archive does not include path segments down to the working directory. ### Steps to reproduce Use configuration with relative source paths including a (.) segment. ``` source_directories: - ./source working_directory: /mnt/snapshot/ ``` _Rest of configuration, including spot check configuration, is excluded for brevity._ ### Actual behavior borgmatic execute `borg create` in `/mnt/snapshot` with recursion root path `/mnt/snapshot/./source`. `borg create` add contents of `/mnt/snapshot/source` to archive with paths beginning with `source/`. When spot check is run, borgmatic execute `borg list` with paths beginning with `/mnt/snapshot/source/`. `borg list` return no hits since the paths don't match any of the paths in the archive. ### Expected behavior When spot check is run, borgmatic should execute `borg list` with paths beginning with `source/`. ### Other notes / implementation ideas The expected behavior could be accomplished by removing the prefix from spot check candidate paths if the source directory contains a (.) path segment before calling `borg list`. I'm not sure why the recursion roots are prefixed with the working directory when borgmatic creates an archive. Is this necessary? ### borgmatic version 1.9.3 ### borgmatic installation method Debian package ### Borg version borg 1.4.0 ### Python version Python 3.12.8 ### Database version (if applicable) _No response_ ### Operating system and version Debian GNU/Linux trixie/sid
Owner

Thanks for taking the time to file this!

I'm not sure why the recursion roots are prefixed with the working directory when borgmatic creates an archive. Is this necessary?

No, it's not! It's an incidental path transformation in borgmatic as part of processing path globs (*). But I'll change this so borgmatic will pass the original source directory to Borg without tacking on the working directory, so it's stored in the archive without that prefix. And I'll see what can be done about the spot check issue as well.

Thanks for taking the time to file this! > I'm not sure why the recursion roots are prefixed with the working directory when borgmatic creates an archive. Is this necessary? No, it's not! It's an incidental path transformation in borgmatic as part of processing path globs (`*`). But I'll change this so borgmatic will pass the original source directory to Borg without tacking on the working directory, so it's stored in the archive without that prefix. And I'll see what can be done about the spot check issue as well.
witten added the
bug
label 2024-12-30 01:21:09 +00:00
witten referenced this issue from a commit 2024-12-30 06:00:42 +00:00
Owner

Okay, both issues should be fixed in main now. This will be part of the next release. Thanks again!

Okay, both issues should be fixed in main now. This will be part of the next release. Thanks again!
Owner

Released in borgmatic 1.9.6!

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

No dependencies set.

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