Просмотр исходного кода

Fix for a "spot" check error when a filename in the most recent archive contains a newline (#968).

Dan Helfman 4 месяцев назад
Родитель
Сommit
e3d40125cb
3 измененных файлов с 6 добавлено и 5 удалено
  1. 2 1
      NEWS
  2. 1 1
      borgmatic/actions/check.py
  3. 3 3
      borgmatic/borg/list.py

+ 2 - 1
NEWS

@@ -1,5 +1,6 @@
 1.9.7
- * #970: Fix for an error when a blank line occurs in the configured patterns or excludes.
+ * #968: Fix for a "spot" check error when a filename in the most recent archive contains a newline.
+ * #970: Fix for an error when there's a blank line in the configured patterns or excludes.
 
 1.9.6
  * #959: Fix an error in the Btrfs hook when a subvolume mounted at "/" is configured in borgmatic's

+ 1 - 1
borgmatic/actions/check.py

@@ -401,7 +401,7 @@ def collect_spot_check_source_paths(
 
     paths = tuple(
         path_line.split(' ', 1)[1]
-        for path_line in paths_output.split('\n')
+        for path_line in paths_output.splitlines()
         if path_line and path_line.startswith('- ') or path_line.startswith('+ ')
     )
 

+ 3 - 3
borgmatic/borg/list.py

@@ -120,7 +120,7 @@ def capture_archive_listing(
                     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
+                    format=path_format or '{path}{NUL}',  # noqa: FS003
                 ),
                 global_arguments,
                 local_path,
@@ -132,7 +132,7 @@ def capture_archive_listing(
             borg_exit_codes=config.get('borg_exit_codes'),
         )
         .strip('\n')
-        .split('\n')
+        .split('\0')
     )
 
 
@@ -230,7 +230,7 @@ def list_archive(
                 borg_exit_codes=borg_exit_codes,
             )
             .strip('\n')
-            .split('\n')
+            .splitlines()
         )
     else:
         archive_lines = (list_arguments.archive,)