From 1fe40993506c7974b94473ed7d7d56360ce5968f Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Sun, 15 Feb 2026 03:31:41 +0100 Subject: [PATCH] toys fixes checkmissing: add missing read -d \0 cleandestinations: use NULL separator in find, use SQL placedholmder --- toys/checkmissing | 2 +- toys/cleandestinations | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/toys/checkmissing b/toys/checkmissing index dc9ee56..0d5d743 100755 --- a/toys/checkmissing +++ b/toys/checkmissing @@ -87,7 +87,7 @@ do destination_names[id]=${rest%%::AtOM:SQL:Sep::*} rest=${rest#*::AtOM:SQL:Sep::} files[id]=${rest} - read -u4 line + read -u4 -r -d $'\0' line done echo 'BEGIN TRANSACTION;' >&3 diff --git a/toys/cleandestinations b/toys/cleandestinations index e45ef59..4155624 100755 --- a/toys/cleandestinations +++ b/toys/cleandestinations @@ -72,18 +72,19 @@ checkwanted() { for destination in "${!destinationpath[@]}" do echo -ne "\rScanning destination $destination... \033[K" - while read -r filename + while read -r -d $'\0' filename do + sqlfile=${filename//$'\n'/::AtOM:NewLine:SQL:Inline::} if ! Select destination_files id \ >/dev/null \ - <<<"filename = ${filename#${destinationpath["$destination"]}/}" + <<<"filename = ${sqlfile#${destinationpath["$destination"]}/}" then echo -e $'\r'"$filename\033[K" - (( remove )) && rm -f "$filename" + (( remove )) && rm "$filename" echo -n "Scanning destination $destination... " fi progressSpin - done < <(find "${destinationpath["$destination"]}" -type f) + done < <(find "${destinationpath["$destination"]}" -type f -print0) done echo -en "\r\033[K"