Skip to content

handle_service_envfiles: fix sed pattern and quoting for multiple entries#58

Merged
fila43 merged 1 commit intodevexp-db:masterfrom
fila43:fix-handle-service-envfiles
Apr 24, 2026
Merged

handle_service_envfiles: fix sed pattern and quoting for multiple entries#58
fila43 merged 1 commit intodevexp-db:masterfrom
fila43:fix-handle-service-envfiles

Conversation

@fila43
Copy link
Copy Markdown
Contributor

@fila43 fila43 commented Apr 21, 2026

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.

Fixes: #54

Copy link
Copy Markdown
Contributor

@pkhartsk pkhartsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also separate local envfiles=... into two lines as per https://github.com/koalaman/shellcheck/wiki/SC2155 ? I don't think that || return there actually does anything

…ries

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: devexp-db#54
Made-with: Cursor
@fila43 fila43 force-pushed the fix-handle-service-envfiles branch from 2e7b9c0 to fa9e5a5 Compare April 24, 2026 07:53
Copy link
Copy Markdown
Contributor

@pkhartsk pkhartsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fila43 fila43 merged commit 15088de into devexp-db:master Apr 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ERROR: Can not read EnvironmentFile No such file or directory

2 participants