No trap cleanup on mktemp — temp files leak on Ctrl+C #1

Open
opened 2026-06-19 06:22:17 -07:00 by drjones · 0 comments
Owner

mktemp is called in ollama-brain.sh (6x) and vectors/15-file-upload.sh (1x) without any trap cleanup.

If the user hits Ctrl+C mid-run, temp files accumulate in /tmp/.

Fix: Add trap 'rm -f "$sys_file" "$usr_file"' EXIT INT TERM after each mktemp call.

Files:

  • engine/ollama-brain.sh (lines 34-35, 92-93, 117-118)
  • vectors/15-file-upload.sh (line 24)
`mktemp` is called in `ollama-brain.sh` (6x) and `vectors/15-file-upload.sh` (1x) without any `trap` cleanup. If the user hits Ctrl+C mid-run, temp files accumulate in /tmp/. **Fix:** Add `trap 'rm -f "$sys_file" "$usr_file"' EXIT INT TERM` after each mktemp call. **Files:** - engine/ollama-brain.sh (lines 34-35, 92-93, 117-118) - vectors/15-file-upload.sh (line 24)
drjones added the bug label 2026-06-19 06:22:17 -07:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: drjones/th-analyzer#1