From c1062bce6ad73d25122b2d9b804ee92a9cfcb0eb Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 12 Jul 2026 14:41:18 +0300 Subject: =?UTF-8?q?scripts:=20stabilize-video=20=E2=80=94=20fix=20EXIT=20t?= =?UTF-8?q?rap=20unbound=20var=20under=20set=20-u?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit trf_dir was declared local in main(), so the EXIT trap referencing it fired after main returned — under set -u that became an unbound variable error and the script exited non-zero even though stabilization succeeded. Hoist trf_dir to script scope and guard the trap. --- scripts/stabilize-video | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/stabilize-video b/scripts/stabilize-video index 0647a36..4490ec8 100755 --- a/scripts/stabilize-video +++ b/scripts/stabilize-video @@ -14,6 +14,7 @@ set -euo pipefail VADEVICE="/dev/dri/renderD128" +trf_dir="" # set by main; cleaned up by EXIT trap QUALITY="${QUALITY:-34}" # HEVC CQP quality (higher = smaller) SHAKINESS="${SHAKINESS:-5}" # vidstab shakiness 1..10 ACCURACY="${ACCURACY:-15}" # vidstab accuracy 1..15 @@ -92,9 +93,8 @@ main() { # Build the work list, skipping clips whose output already exists. local -a todo=() - local trf_dir trf_dir=$(mktemp -d -t stabilize-video.XXXXXX) - trap 'rm -rf "$trf_dir"' EXIT + trap '[[ -n "$trf_dir" ]] && rm -rf "$trf_dir"' EXIT for src in "${_mov_files[@]}"; do local out -- cgit v1.2.3