From f0429afb3312016b4bec4edfcca2f6e6c8073896 Mon Sep 17 00:00:00 2001 From: Mihovil Ilakovac Date: Wed, 5 Nov 2025 15:35:22 +0100 Subject: [PATCH] Fix dope.sh handling of empty lines in deletions file (#536) --- tools/dope.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/dope.sh b/tools/dope.sh index cf394b11..e43c5478 100755 --- a/tools/dope.sh +++ b/tools/dope.sh @@ -149,9 +149,18 @@ recreate_derived_dir() { # TODO: also allow deletion of dirs. if [ -f "${DIFF_DIR_DELETIONS}" ]; then while IFS= read -r filepath; do + # Skip empty lines + [[ -z "$filepath" ]] && continue + local derived_dir_filepath local rm_exit_code derived_dir_filepath="${DERIVED_DIR}/${filepath}" + + # Only delete if it exists and is a file + if [[ ! -f "$derived_dir_filepath" ]]; then + continue + fi + rm "${derived_dir_filepath}" rm_exit_code=$? if [ ${rm_exit_code} -eq 0 ]; then