Browse Source

Fix for a "bad character" Borg error in which the "spot" check fed Borg an invalid pattern (#899).

Dan Helfman 11 months ago
parent
commit
424cc6b66c
3 changed files with 9 additions and 6 deletions
  1. 1 0
      NEWS
  2. 2 1
      borgmatic/actions/restore.py
  3. 6 5
      borgmatic/borg/list.py

+ 1 - 0
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

+ 2 - 1
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/*/*',)

+ 6 - 5
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