From 74f5faba964cae8f9fc1e47bc026c14c1e877378 Mon Sep 17 00:00:00 2001 From: MultisampledNight <80128916+MultisampledNight@users.noreply.github.com> Date: Mon, 9 Feb 2026 22:24:51 +0100 Subject: [PATCH 1/2] =?UTF-8?q?compress:=20expose=20Padm=C3=A9=20size=20ob?= =?UTF-8?q?fuscation=20via=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #9286. Tested manually via: = export BORG_REPO=repo = alias b='python -m borg' = echo meow > file = b create ::test ./file -C obfuscate,250,none = b info Archive name: ::test Archive fingerprint: 2c67ba6c04faa6d911b5dd02b99593ea2cf6ebe7c38e2e6fca90afad47a7095e [...] Command line: /home/user/c/d0/software/backup/borg/src/borg/__main__.py create ::test ./file -C obfuscate,250,none [...] Number of files: 1 Original size: 40 B = rm file = b list ::test -rw-r--r-- user users 5 Mon, 2026-02-09 22:41:54 +0100 file = b extract ::test file = cat file meow = # Yup, all good. Let's go for something nontrivial to make sure it's stripped accordingly. = dd if=/dev/urandom of=file bs=1M count=4 = b create ::test ./file -C obfuscate,250,zstd = mv file original = b info Archive name: ::test Archive fingerprint: 2c67ba6c04faa6d911b5dd02b99593ea2cf6ebe7c38e2e6fca90afad47a7095e [...] Command line: /home/user/c/d0/software/backup/borg/src/borg/__main__.py create ::test ./file -C obfuscate,250,none Working Directory: /home/user/l/bug/borg Number of files: 1 Original size: 40 B Archive name: ::test Archive fingerprint: 01014345dd1187f014f19ac59a2313a4e6d644532b287d806fe87882ca47ea0d [...] Command line: /home/user/c/d0/software/backup/borg/src/borg/__main__.py create ::test ./file -C obfuscate,250,zstd Working Directory: /home/user/l/bug/borg Number of files: 1 Original size: 4.19 MB = b extract aid:01014345dd1187f014f19ac59a2313a4e6d644532b287d806fe87882ca47ea0d = sha256sum file original d74be01406764ef11f5aa3ee27033bdced2c9573c0b3ed980fcfb2116c7d84de file d74be01406764ef11f5aa3ee27033bdced2c9573c0b3ed980fcfb2116c7d84de original = --- src/borg/compress.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/borg/compress.pyx b/src/borg/compress.pyx index d7c4f5f36f..e78821ec93 100644 --- a/src/borg/compress.pyx +++ b/src/borg/compress.pyx @@ -713,8 +713,8 @@ class CompressionSpec: elif self.name == 'obfuscate': if 3 <= count <= 5: level = int(values[1]) - if not ((1 <= level <= 6) or (110 <= level <= 123)): - raise ArgumentTypeError("level must be >= 1 and <= 6 or >= 110 and <= 123") + if not ((1 <= level <= 6) or (110 <= level <= 123) or (level == 250)): + raise ArgumentTypeError("level must be (inclusively) within 1...6, 110...123 or equal to 250") self.level = level compression = ','.join(values[2:]) else: From 245a46842ddc5be78609ccc84822142ba608aad6 Mon Sep 17 00:00:00 2001 From: MultisampledNight <80128916+MultisampledNight@users.noreply.github.com> Date: Mon, 9 Feb 2026 23:19:20 +0100 Subject: [PATCH 2/2] test(compress): roundtrip through UI parsing --- src/borg/testsuite/compress_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/borg/testsuite/compress_test.py b/src/borg/testsuite/compress_test.py index c7d45444a1..9ec9f1046e 100644 --- a/src/borg/testsuite/compress_test.py +++ b/src/borg/testsuite/compress_test.py @@ -232,7 +232,7 @@ def test_invalid_compression_level(invalid_spec): ], ) def test_padme_obfuscation(data_length, expected_padding): - compressor = Compressor(name="obfuscate", level=250, compressor=Compressor("none")) + compressor = CompressionSpec("obfuscate,250,none").compressor data = b"x" * data_length meta, compressed = compressor.compress(dict(type=ROBJ_FILE_STREAM), data) @@ -251,7 +251,7 @@ def test_padme_obfuscation(data_length, expected_padding): ], ) def test_robj_specific_obfuscation(data_length, expected_padding, robj_type): - compressor = Compressor(name="obfuscate", level=250, compressor=Compressor("none")) + compressor = CompressionSpec("obfuscate,250,none").compressor data = b"x" * data_length meta, compressed = compressor.compress(dict(type=robj_type), data)