From 3126688464e4a7862ddf68c99cbefd76b68751b9 Mon Sep 17 00:00:00 2001 From: Stefan Mayr Date: Mon, 11 May 2026 22:38:42 +0200 Subject: [PATCH] Prepare for changes of su in util-linux 2.42 With util-linux 2.42 su gets more strict about it's command line. From the release notes: "pass arguments after to shell (by cgoesche)" It is also recommended to use "--login" instead of "-". Could fix https://forum.checkmk.com/t/postgresql-services-disappear-after-updating-util-linux-to-2-42/58816 --- cmk/plugins/postgres/agents/mk_postgres.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmk/plugins/postgres/agents/mk_postgres.py b/cmk/plugins/postgres/agents/mk_postgres.py index 149a8811816..d64a02ba915 100755 --- a/cmk/plugins/postgres/agents/mk_postgres.py +++ b/cmk/plugins/postgres/agents/mk_postgres.py @@ -793,10 +793,10 @@ def _run_sql_as_db_user( # type: (str, str, str, bool, bool) -> str base_cmd_list = [ "su", - "-", - self.db_user, "-c", r"""PGPASSFILE=%s %s -X %s -A0 -F'%s' -f %s""", + "--login", + self.db_user, ] extra_args += " -U %s" % self.pg_user extra_args += " -d %s" % self.pg_database @@ -809,7 +809,7 @@ def _run_sql_as_db_user( if rows_only: extra_args += " -t" - base_cmd_list[-1] = base_cmd_list[-1] % ( + base_cmd_list[-3] = base_cmd_list[-3] % ( self.pg_passfile, self.psql_binary_path, extra_args,