Discussion:
Bug#1096005: borgmatic borg does not correctly pass return code
Add Reply
Lee Garrett
2025-02-15 01:50:01 UTC
Reply
Permalink
Package: borgmatic
Version: 1.9.10-1
Severity: normal
X-Debbugs-Cc: ***@rocketjump.eu

Hello,

# borgmatic -c /etc/borgmatic.d/complete_system.yaml borg upgrade --show-rc --check-archives-tam
[...]
Archive TAM missing: batou_2022-10-19T16:28+02:00 Wed, 2022-10-19 18:30:22 [<<hash>>]
Archive TAM present: batou_2023-02-16T16:20+0100 Thu, 2023-02-16 16:21:08 [<<hash>>]
[...]
Found 20 archives with TAM issues!
terminating with warning status, rc 1
# echo $?

0

It seems as though `borgmatic borg ...` calls don't correctly pass the return
code of borg to the shell. Would be sensible to have for scripting purposes.

Greetings,
Lee

-- System Information:
Debian Release: trixie/sid
APT prefers testing
APT policy: (990, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 6.12.12-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages borgmatic depends on:
ii borgbackup 1.4.0-4+b1
ii python3 3.13.1-2
ii python3-jsonschema 4.19.2-6
ii python3-packaging 24.2-1
ii python3-requests 2.32.3+dfsg-1
ii python3-ruamel.yaml 0.18.10+ds-1

borgmatic recommends no packages.

Versions of packages borgmatic suggests:
pn apprise <none>

-- no debconf information
Dan Helfman
2025-03-02 17:20:01 UTC
Reply
Permalink
This is actually intentional. borgmatic is a wrapper for many
executables besides just Borg; it calls out to database clients,
filesystem snapshot software, and even arbitrary commands (in the form
of before_* and after_* hooks). So IMO it doesn't make sense to adopt
the return codes for only one of those executables. But what borgmatic
does offer is the ability to configure how different Borg exit codes are
interpreted as either warnings or errors. See
https://torsion.org/borgmatic/docs/how-to/customize-warnings-and-errors/
for more information.

Dan

Loading...