]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
profile/systemd-osc-context: don't do arithmetic expansion on systemd_exitstatus
authorRasmus Villemoes <rv@rasmusvillemoes.dk>
Mon, 20 Jul 2026 13:37:34 +0000 (15:37 +0200)
committerRasmus Villemoes <rv@rasmusvillemoes.dk>
Tue, 21 Jul 2026 09:06:30 +0000 (11:06 +0200)
There's really no point in having bash do arithmetic expansion on the
systemd_exitstatus variable, i.e. have it convert the string to a number, do no
actual arithmetic, then convert it back to a string to be used as the argument to
the printf, which will again convert it to a number for the %d specifier, and
finally emit it as a decimal. Also, it deviates for no obvious reason from how
it is passed to printf in the "probably died by signal" case just above.

profile.d/80-systemd-osc-context.sh

index 6e6812ce4db188df4813453ddca3c89aaf002ab5..4cfecfed269270ff95be24bcc78a9844b2241e08 100644 (file)
@@ -63,7 +63,7 @@ __systemd_osc_context_precmdline() {
         if [ "$systemd_exitstatus" -gt 128 ] && systemd_signal=$(kill -l "$systemd_exitstatus" 2>&-); then
             printf "\033]3008;end=%.64s;exit=failure;status=%d;signal=SIG%s\033\\" "$systemd_osc_context_cmd_id" "$systemd_exitstatus" "$systemd_signal"
         elif [ "$systemd_exitstatus" -ne 0 ]; then
-            printf "\033]3008;end=%.64s;exit=failure;status=%d\033\\" "$systemd_osc_context_cmd_id" $((systemd_exitstatus))
+            printf "\033]3008;end=%.64s;exit=failure;status=%d\033\\" "$systemd_osc_context_cmd_id" "$systemd_exitstatus"
         else
             printf "\033]3008;end=%.64s;exit=success\033\\" "$systemd_osc_context_cmd_id"
         fi