Repository: borgbackup/borg

Issue:
2.0.0b6 - `borg benchmark cpu` results in a local exception
While testing borgbackup-2.0.0b6 on OpenBSD:

```
$ borg benchmark cpu
Chunkers =======================================================
buzhash,19,23,21,4095    1GB        8.041s
fixed,1048576            1GB        0.134s
Non-cryptographic checksums / hashes ===========================
xxh64                    1GB        0.215s
crc32 (zlib)             1GB        0.432s
Cryptographic hashes / MACs ====================================
hmac-sha256              1GB        4.095s
blake2b-256              1GB        5.756s
Encryption =====================================================
aes-256-ctr-hmac-sha256  1GB        8.008s
aes-256-ctr-blake2b      1GB        9.651s
aes-256-ocb              1GB        2.697s
chacha20-poly1305        1GB        2.998s
KDFs (slow is GOOD, use argon2!) ===============================
pbkdf2                   5          1.566s
argon2                   5          1.256s
Compression ====================================================
lz4          0.1GB      0.040s
zstd,1       0.1GB      0.046s
zstd,3       0.1GB      0.058s
zstd,5       0.1GB      0.119s
zstd,10      0.1GB      0.420s
zstd,16      0.1GB      14.915s
zstd,22      0.1GB      17.677s
zlib,0       0.1GB      0.290s
zlib,6       0.1GB      3.530s
zlib,9       0.1GB      3.514s
lzma,0       0.1GB      25.238s
lzma,6       0.1GB      40.365s
lzma,9       0.1GB      34.627s
msgpack ========================================================
Local Exception

Error:

ValueError: path '/foo/bar/baz' is not sanitized

If reporting bugs, please include the following:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/borg/archiver/__init__.py", line 630, in main
    exit_code = archiver.run(args)
  File "/usr/local/lib/python3.10/site-packages/borg/archiver/__init__.py", line 536, in run
    return set_ec(func(args))
  File "/usr/local/lib/python3.10/site-packages/borg/archiver/benchmark_cmd.py", line 207, in do_benchmark_cpu
    item = Item(path="/foo/bar/baz", mode=660, mtime=1234567)
  File "src/borg/item.pyx", line 158, in borg.item.PropDict.__cinit__
  File "src/borg/item.pyx", line 164, in borg.item.PropDict.update
  File "src/borg/item.pyx", line 232, in borg.item.PropDictProperty.__set__
  File "/usr/local/lib/python3.10/site-packages/borg/helpers/fs.py", line 263, in assert_sanitized_path
    raise ValueError(f"path {path!r} is not sanitized")
ValueError: path '/foo/bar/baz' is not sanitized

Platform: OpenBSD zeus.lan 7.3 GENERIC.MP#1227 amd64
Borg: 2.0.0b6  Python: CPython 3.10.11 msgpack: 1.0.5 fuse: None [pyfuse3,llfuse]
PID: 28960  CWD: /home/bket
sys.argv: ['/usr/local/bin/borg', 'benchmark', 'cpu']
SSH_ORIGINAL_COMMAND: None
```
This issue does not occur with 2.0.0b5.



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
@@ -204,7 +204,7 @@ def chunkit(chunker_name, *args, **kwargs):
             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)
+        item = Item(path="foo/bar/baz", mode=660, mtime=1234567)
         items = [item.as_dict()] * 1000
         size = "100k Items"
         spec = "msgpack"


Test patch: