From e5fc9c7188c9fc00a2b0d3c7f7302181b264bdaa Mon Sep 17 00:00:00 2001 From: pbr Date: Thu, 1 Oct 2026 21:24:42 +0200 Subject: [PATCH] fix(journal): fail write/append when the temp copy can't be written pmx_write_file and pmx_append_file didn't check the first cat into the temp file, so a full /tmp returned 0 and left a truncated target. --- scripts/global/pmx_journal.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/global/pmx_journal.sh b/scripts/global/pmx_journal.sh index ca16cecf..d8decbd3 100644 --- a/scripts/global/pmx_journal.sh +++ b/scripts/global/pmx_journal.sh @@ -160,7 +160,7 @@ pmx_write_file() { local path="$1" local temp before="" after="" existed="false" temp="$(mktemp)" || { cat > "$path"; return $?; } - cat > "$temp" + cat > "$temp" || { rm -f "$temp"; return 1; } local kept="true" if [ -f "$path" ]; then @@ -247,7 +247,7 @@ pmx_append_file() { local path="$1" local temp before="" after="" existed="false" temp="$(mktemp)" || { cat >> "$path"; return $?; } - cat > "$temp" + cat > "$temp" || { rm -f "$temp"; return 1; } local kept="true" if [ -f "$path" ]; then