From 424cc6b66cb72af499c773e8659b9d967dcf46d4 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Thu, 25 Jul 2024 11:34:09 -0700 Subject: [PATCH] Fix for a "bad character" Borg error in which the "spot" check fed Borg an invalid pattern (#899). --- NEWS | 1 + borgmatic/actions/restore.py | 3 ++- borgmatic/borg/list.py | 11 ++++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index b023aad1..05159e48 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ 1.8.14.dev0 * #896: Fix an error in borgmatic rcreate/init on an empty repository directory with Borg 1.4. + * #899: Fix for a "bad character" Borg error in which the "spot" check fed Borg an invalid pattern. * #900: Fix for a potential traceback (TypeError) during the handling of another error. * Add a recent contributors section to the documentation, because credit where credit's due! See: https://torsion.org/borgmatic/#recent-contributors diff --git a/borgmatic/actions/restore.py b/borgmatic/actions/restore.py index 93c99649..88fa5dab 100644 --- a/borgmatic/actions/restore.py +++ b/borgmatic/actions/restore.py @@ -147,7 +147,8 @@ def collect_archive_data_source_names( local_borg_version, global_arguments, list_paths=[ - os.path.expanduser( + 'sh:' + + os.path.expanduser( borgmatic.hooks.dump.make_data_source_dump_path(borgmatic_source_directory, pattern) ) for pattern in ('*_databases/*/*',) diff --git a/borgmatic/borg/list.py b/borgmatic/borg/list.py index 18369751..1e2a9f50 100644 --- a/borgmatic/borg/list.py +++ b/borgmatic/borg/list.py @@ -100,10 +100,11 @@ def capture_archive_listing( remote_path=None, ): ''' - Given a local or remote repository path, an archive name, a configuration dict, the local Borg - version, global arguments as an argparse.Namespace, the archive paths in which to list files, - the Borg path format to use for the output, and local and remote Borg paths, capture the output - of listing that archive and return it as a list of file paths. + Given a local or remote repository path, an archive name, a configuration + dict, the local Borg version, global arguments as an argparse.Namespace, + the archive paths (or Borg patterns) in which to list files, the Borg path + format to use for the output, and local and remote Borg paths, capture the + output of listing that archive and return it as a list of file paths. ''' borg_environment = environment.make_environment(config) @@ -116,7 +117,7 @@ def capture_archive_listing( argparse.Namespace( repository=repository_path, archive=archive, - paths=[f'sh:{path}' for path in list_paths] if list_paths else None, + paths=[path for path in list_paths] if list_paths else None, find_paths=None, json=None, format=path_format or '{path}{NL}', # noqa: FS003