From fa9e5a583d81bea42d1d567a5128491a1621a129 Mon Sep 17 00:00:00 2001 From: Filip Janus Date: Tue, 21 Apr 2026 09:52:15 +0200 Subject: [PATCH] handle_service_envfiles: fix sed pattern and quoting for multiple entries systemctl show -p EnvironmentFiles outputs lines prefixed with 'EnvironmentFiles=' (plural). The sed command was using the singular 'EnvironmentFile=' which never matched, leaving paths un-stripped. Additionally, $envfiles was unquoted in the echo, causing the shell to collapse newlines between multiple entries into spaces. This broke the 'while read line' loop which relies on newline separation to iterate over each file path individually. Fix by quoting "$envfiles" to preserve newlines, and updating the sed pattern to match the plural 'EnvironmentFiles=' prefix. Separate 'local' declaration from the assignment so that '|| return' actually sees the systemctl exit code (SC2155). Fixes: https://github.com/devexp-db/postgresql-setup/issues/54 Made-with: Cursor --- bin/postgresql-setup.in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/postgresql-setup.in b/bin/postgresql-setup.in index 9d8d955..5fd4a3a 100644 --- a/bin/postgresql-setup.in +++ b/bin/postgresql-setup.in @@ -670,13 +670,14 @@ handle_service_envfiles() local mode="$1" local service="$2" - local envfiles="$(systemctl show -p EnvironmentFiles "${service}.service")"\ + local envfiles + envfiles="$(systemctl show -p EnvironmentFiles "${service}.service")" \ || return test -z "$envfiles" && return - envfiles=$(echo $envfiles | \ - sed -e 's/^EnvironmentFile=//' \ + envfiles=$(echo "$envfiles" | \ + sed -e 's/^EnvironmentFiles=//' \ -e 's| ([^)]*)$||' )