rustic-rs / rustic

rustic - fast, encrypted, and deduplicated backups powered by Rust
https://rustic.cli.rs
Apache License 2.0
1.83k stars 69 forks source link

`rustic check` reports ERROR but returns 0 exit code #1236

Open kapitainsky opened 3 weeks ago

kapitainsky commented 3 weeks ago
$ rustic --version
rustic 0.8.1

$ rustic check
[INFO] using config ./rustic.toml
[INFO] repository rclone:OD01-ENC:rustic_kptsky_backup: password is correct.
[INFO] using cache at /Users/kptsky/Library/Caches/rustic/75d391929ae92a6d1f797a8725950e8ac8a59424dbbdb4df5db1f06a8d87f348
[00:00:00] checking Snapshot in cache...  ████████████████████████████████████████   3.10 KiB/3.10 KiB   1.30 MiB/s   (ETA -)
[00:00:00] checking Index in cache...     ████████████████████████████████████████  14.22 MiB/14.22 MiB  1.24 GiB/s   (ETA -)
[00:00:01] reading index...               ████████████████████████████████████████         10/10                                                                               [00:00:00] listing packs...               ⠁                                                                                                                                    
[ERROR] pack 8213a0ba: size computed by index: 36, actual size: 17074311. To repair: 'rustic repair index'.
[00:05:31] listing packs...
[00:00:00] cleaning up packs from cache...
[00:03:47] checking packs in cache...     ████████████████████████████████████████   1.30 GiB/1.30 GiB   5.85 MiB/s   (ETA -)
[00:00:02] reading snapshots...           ████████████████████████████████████████          5/5
[00:00:21] checking trees...              ████████████████████████████████████████          5/5

$ echo $?
0

so either it is not an ERROR but WARNING(?) or returned code is wrong. It makes very difficult to script rustic operations if returned error codes do not reflect reality and manual logs reading is required.

aawsome commented 2 weeks ago

Thanks @kapitainsky for opening this issue.

This is actually already known and there is https://github.com/rustic-rs/rustic_core/pull/224 on the run.. It just misses some general discussion of us maintainers how to handle all error situations in rustic_core/rustic