Fix for the "spot" check's "xxh64sum_command" option erroring on commands containing spaces (#1095).

This commit is contained in:
Dan Helfman
2025-05-14 14:09:19 -07:00
parent d83c444d9e
commit 7f3e9c5347
3 changed files with 11 additions and 3 deletions
+2
View File
@@ -6,6 +6,8 @@
* #1093: Fix for the LVM hook erroring when the "--dry-run" flag is used.
* #1094: Fix incorrect documentation about customizing Borg exit codes:
https://torsion.org/borgmatic/docs/how-to/customize-warnings-and-errors/
* #1095: Fix for the "spot" check's "xxh64sum_command" option erroring on commands containing
spaces.
* Add support for Borg 2's "s3:" and "b2:" repository URLs, so you can backup to S3 or B2 cloud
storage services even without using Rclone.
+5 -1
View File
@@ -6,6 +6,7 @@ import logging
import os
import pathlib
import random
import shlex
import shutil
import borgmatic.actions.pattern
@@ -512,7 +513,10 @@ def compare_spot_check_hashes(
break
hash_output = borgmatic.execute.execute_command_and_capture_output(
(spot_check_config.get('xxh64sum_command', 'xxh64sum'),)
tuple(
shlex.quote(part)
for part in shlex.split(spot_check_config.get('xxh64sum_command', 'xxh64sum'))
)
+ tuple(
path for path in source_sample_paths_subset if path in hashable_source_sample_path
),
+4 -2
View File
@@ -1071,7 +1071,9 @@ def test_compare_spot_check_hashes_uses_xxh64sum_command_option():
flexmock(module.os.path).should_receive('islink').and_return(False)
flexmock(module.borgmatic.execute).should_receive(
'execute_command_and_capture_output'
).with_args(('/usr/local/bin/xxh64sum', '/foo', '/bar'), working_directory=None).and_return(
).with_args(
('/usr/local/bin/xxhsum', '-H64', '/foo', '/bar'), working_directory=None
).and_return(
'hash1 /foo\nhash2 /bar'
)
flexmock(module.borgmatic.borg.list).should_receive('capture_archive_listing').and_return(
@@ -1086,7 +1088,7 @@ def test_compare_spot_check_hashes_uses_xxh64sum_command_option():
{
'name': 'spot',
'data_sample_percentage': 50,
'xxh64sum_command': '/usr/local/bin/xxh64sum',
'xxh64sum_command': '/usr/local/bin/xxhsum -H64',
},
]
},