From 9b84a2c23511a4d76507abed27234b33ce43dac3 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 aad1e8d55a..c370f1f79e 100644 --- a/src/borg/compress.pyx +++ b/src/borg/compress.pyx @@ -600,8 +600,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 261705c4c17de7301a30ff9c59aac4e0551c85ef 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.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/borg/testsuite/compress.py b/src/borg/testsuite/compress.py index 160f250fc5..719c80f0d8 100644 --- a/src/borg/testsuite/compress.py +++ b/src/borg/testsuite/compress.py @@ -215,7 +215,7 @@ def test_obfuscate(): ], ) def test_padme_obfuscation(data_length, expected_padding): - compressor = Compressor(name="obfuscate", level=250, compressor=Compressor("none")) + compressor = CompressionSpec("obfuscate,250,none").compressor # The inner compressor will add an inner header of 2 bytes, so we reduce the data length by 2 bytes # to be able to use (almost) the same test cases as in the master branch. data = b"x" * (data_length - 2)