Repository: borgbackup/borg

Issue:
2.0.0b3: TypeError in borg benchmark cpu (compression section)
<!--
Thank you for reporting an issue.

*IMPORTANT* -  *before* creating a new issue please look around:
 - Borgbackup documentation: http://borgbackup.readthedocs.io/en/stable/index.html
 - FAQ: https://borgbackup.readthedocs.io/en/stable/faq.html
 and
 - open issues in Github tracker: https://github.com/borgbackup/borg/issues
  
If you cannot find a similar problem, then create a new issue.

Please fill in as much of the template as possible.
-->

## Have you checked borgbackup docs, FAQ, and open Github issues?

Yes

## Is this a BUG / ISSUE report or a QUESTION?

BUG

## System information. For client/server mode post info for both machines.

#### Your borg version (borg -V).
> ./borg.exe -V
borg.exe 2.0.0b3

#### Operating system (distribution) and version.
> uname -a
FreeBSD NomadBSD 13.1-RELEASE-p2 FreeBSD 13.1-RELEASE-p2 #0 releng/13.1-n250158-752f813d6cc-dirty: Tue Sep 27 22:49:04 CEST 2022     root@NomadBSD:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64

#### Hardware / network configuration, and filesystems used.
tested on
1) Laptop Lenovo ThiinkPad T450 with /ZFS
2) Server Dell PowerEdge R710 with ZFS
#### How much data is handled by borg?
None with this version
#### Full borg commandline that lead to the problem (leave away excludes and passwords)
On the laptop:
```
> ./borg.exe benchmark cpu
Chunkers =======================================================
buzhash,19,23,21,4095    1GB        4.832s
fixed,1048576            1GB        0.242s
Non-cryptographic checksums / hashes ===========================
xxh64                    1GB        0.233s
crc32 (zlib)             1GB        0.775s
Cryptographic hashes / MACs ====================================
hmac-sha256              1GB        8.055s
blake2b-256              1GB        7.411s
Encryption =====================================================
aes-256-ctr-hmac-sha256  1GB        11.497s
aes-256-ctr-blake2b      1GB        9.507s
aes-256-ocb              1GB        2.196s
chacha20-poly1305        1GB        2.752s
KDFs (slow is GOOD, use argon2!) ===============================
pbkdf2                   5          0.874s
argon2                   5          0.920s
Compression ====================================================
Local Exception
Traceback (most recent call last):
  File "borg/archiver/__init__.py", line 594, in main
  File "borg/archiver/__init__.py", line 522, in run
  File "borg/archiver/benchmark_cmd.py", line 208, in do_benchmark_cpu
  File "timeit.py", line 233, in timeit
  File "timeit.py", line 177, in timeit
  File "<timeit-src>", line 6, in inner
  File "borg/archiver/benchmark_cmd.py", line 208, in <lambda>
  File "src/borg/compress.pyx", line 172, in borg.compress.DecidingCompressor.compress
TypeError: compress() takes exactly 2 positional arguments (1 given)

Platform: FreeBSD NomadBSD 13.1-RELEASE-p2 FreeBSD 13.1-RELEASE-p2 #0 releng/13.1-n250158-752f813d6cc-dirty: Tue Sep 27 22:49:04 CEST 2022     root@NomadBSD:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
Borg: 2.0.0b3  Python: CPython 3.9.14 msgpack: 1.0.4 fuse: llfuse 1.4.2 [pyfuse3,llfuse]
PID: 12021  CWD: /usr/local/borg2-dir
sys.argv: ['./borg.exe', 'benchmark', 'cpu']
SSH_ORIGINAL_COMMAND: None

```
## Describe the problem you're observing.
The command gives a Local Exception
#### Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.
Yes, run the `borg benchmark cpu` command in FreeBSD





Discussion:

Resolving patch:
diff --git a/src/borg/archiver/benchmark_cmd.py b/src/borg/archiver/benchmark_cmd.py
--- a/src/borg/archiver/benchmark_cmd.py
+++ b/src/borg/archiver/benchmark_cmd.py
@@ -205,7 +205,7 @@ def chunkit(chunker_name, *args, **kwargs):
         ]:
             compressor = CompressionSpec(spec).compressor
             size = "0.1GB"
-            print(f"{spec:<12} {size:<10} {timeit(lambda: compressor.compress(random_10M), number=10):.3f}s")
+            print(f"{spec:<12} {size:<10} {timeit(lambda: compressor.compress({}, random_10M), number=10):.3f}s")
 
         print("msgpack ========================================================")
         item = Item(path="/foo/bar/baz", mode=660, mtime=1234567)


Test patch: