[Bug 276443] databases/postgresql14-server: rc.conf setting postgresql_env is ignored

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 18 Jan 2024 21:07:43 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276443

            Bug ID: 276443
           Summary: databases/postgresql14-server: rc.conf setting
                    postgresql_env is ignored
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: pgsql@FreeBSD.org
          Reporter: wollman@FreeBSD.org
          Assignee: pgsql@FreeBSD.org
             Flags: maintainer-feedback?(pgsql@FreeBSD.org)

It is documented in rc.subr(8) that setting ${name}_env will supply the
indicated values to the environment of the command being run by the rc scripts.
The port-supplied rc script, however, starts the postmaster with `su -l`, which
discards the environment variables set by rc.subr. This is the right thing, but
it prevents the administrator's settings from being passed through to the
postmaster.

One possible fix is to change the postgresql_command function to simply pass
postgresql_env into the command being run under `su`, although this does not
help if postgresql_env_file is being used instead. It would be sufficient for
my use case, however. This looks like:

    ${su_cmd} -l ${postgresql_user} -c "${postgresql_env} exec ${command}
${command_args} ${rc_arg}"

and I have confirmed (with `ps e`) that the right values are being passed into
the environment.

-- 
You are receiving this mail because:
You are the assignee for the bug.