From 0765a21cbaf62ee7ca5215b7010a74089af3ac0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Saparelli?= Date: Mon, 6 Jul 2026 03:57:33 +1200 Subject: [PATCH] fix(restore): ensure trailing newline before appending to postgresql.conf If a snapshot's postgresql.conf had no trailing newline, the first appended setting (log_destination) merged onto the last existing line, corrupting the config and breaking the restore. Append a blank line first; Postgres ignores it and the config is throwaway anyway. --- src/controllers/restore/builders.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/controllers/restore/builders.rs b/src/controllers/restore/builders.rs index 1e57154..882dd0b 100644 --- a/src/controllers/restore/builders.rs +++ b/src/controllers/restore/builders.rs @@ -1181,6 +1181,8 @@ sed -i \ "$PGDATA/postgresql.conf" echo "Configuring stderr logging..." +# prepend a newline so the first appended setting can't merge onto a last line that lacks a trailing newline +echo >> "$PGDATA/postgresql.conf" echo "log_destination = 'stderr'" >> "$PGDATA/postgresql.conf" echo "password_encryption = 'scram-sha-256'" >> "$PGDATA/postgresql.conf" echo "logging_collector = off" >> "$PGDATA/postgresql.conf"