Extracting a directory from a remote repository fails if working_directory defined #1037
Labels
No labels
blocked
breaking
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
borgmatic-collective/borgmatic#1037
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
I have a config which has a remote ssh repository and a working directory configured. I'm trying to extract a directory which fails because the ssh path is appended to the working directory even though it should be absolute.
Steps to reproduce
Prepare a config containing something like this:
Then (after initializing, creating a backup, ...) try:
Actual behavior
Repository /home/user/apps/foo/ssh:/storagebox/borg-backups/foo.borg does not exist.
backup: Error running actions for repository
backup: Command 'borg extract --info --strip-components 5 /home/user/apps/foo/ssh://storagebox/./borg-backups/foo.borg::host-2025-03-20T21:40:24.258741 /home/user/apps/foo/data/storage' returned non-zero exit status 2.
/home/user/.config/borgmatic.d/foo.yaml: An error occurred
Expected behavior
The subfolder is extracted to the ~/restore directory.
Other notes / implementation ideas
In
projects.torsion.org/borgmatic-collective/borgmatic/blame@c2409d9968/borgmatic/borg/extract.py (L138)do the same check like inif ':' not in repository:E.g. add an optional parameter to
normalize_repository_pathwhich could be the base repository and ONLY join the base path in the first 2 branches.borgmatic version
1.9.14
borgmatic installation method
pipx install borgmatic
Borg version
borg 1.2.8
Python version
Python 3.10.12
Database version (if applicable)
No response
Operating system and version
Ubuntu 22.04.5 LTS
Extraction a directory from a remote repository fails if working_directory definedto Extracting a directory from a remote repository fails if working_directory definedThanks so much for filing this and submitting a PR as well! It definitely looks like an oversight in the existing code.
Released in borgmatic 2.0.0!