Bug 236060 - databases/postgresql11-server: pkg-message-server.in is wrong about login classes
Summary: databases/postgresql11-server: pkg-message-server.in is wrong about login cla...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Palle Girgensohn
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-26 17:02 UTC by Michael Osipov
Modified: 2021-05-17 08:11 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (pgsql)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Osipov 2019-02-26 17:02:16 UTC
The file says:

> Then add 'postgresql_class="postgres"' to /etc/rc.conf.

I believe that this is wrong because the manpage of rc.subr(8) says:

> ${name}_login_class
>	Login class to use with ${name}_limits.  Defaults
> 	to ``daemon''.

So I expect it to be 'postgresql_login_class="postgres"'.

This issue seems to exist multiple times:

> [mosipov@mika-ion /usr/ports/databases]$ grep -r postgresql_class .
> ./postgresql10-server/files/postgresql.in:#  postgresql_class="default"
> ./postgresql10-server/files/postgresql.in:postgresql_class=${postgresql_class:-"default"}
> ./postgresql10-server/files/postgresql.in:    ${su_cmd} -l -c ${postgresql_class} ${postgresql_user} -c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}"
> ./postgresql10-server/files/pkg-message-server.in:Then add 'postgresql_class="postgres"' to /etc/rc.conf.
> ./postgresql94-server/files/pkg-message-server.in:Then add 'postgresql_class="postgres"' to /etc/rc.conf.
> ./postgresql94-server/files/postgresql.in:#  postgresql_class="default"
> ./postgresql94-server/files/postgresql.in:postgresql_class=${postgresql_class:-"default"}
> ./postgresql94-server/files/postgresql.in:    ${su_cmd} -l -c ${postgresql_class} ${postgresql_user} -c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}"
> ./postgresql95-server/files/postgresql.in:#  postgresql_class="default"
> ./postgresql95-server/files/postgresql.in:postgresql_class=${postgresql_class:-"default"}
> ./postgresql95-server/files/postgresql.in:    ${su_cmd} -l -c ${postgresql_class} ${postgresql_user} -c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}"
> ./postgresql95-server/files/pkg-message-server.in:Then add 'postgresql_class="postgres"' to /etc/rc.conf.
> ./postgresql96-server/files/postgresql.in:#  postgresql_class="default"
> ./postgresql96-server/files/postgresql.in:postgresql_class=${postgresql_class:-"default"}
> ./postgresql96-server/files/postgresql.in:    ${su_cmd} -l -c ${postgresql_class} ${postgresql_user} -c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}"
> ./postgresql96-server/files/pkg-message-server.in:Then add 'postgresql_class="postgres"' to /etc/rc.conf.
> ./postgresql11-server/files/pkg-message-server.in:Then add 'postgresql_class="postgres"' to /etc/rc.conf.
> ./postgresql11-server/files/postgresql.in:#  postgresql_class="default"
> ./postgresql11-server/files/postgresql.in:postgresql_class=${postgresql_class:-"default"}
> ./postgresql11-server/files/postgresql.in:    ${su_cmd} -l -c ${postgresql_class} ${postgresql_user} -c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}"
>
Comment 1 Palle Girgensohn freebsd_committer freebsd_triage 2019-02-26 21:52:23 UTC
Hi,

Hmm, yes, although just by looking at the rc script, I'm not sure it actually honors the class at all, either way you configure it. I have to look into this. The rc script could do with some refactoring anyway...
Comment 2 Michael Osipov 2019-02-27 08:39:37 UTC
Something still seems fishy about it:

postgres:\
        :lang=C.UTF-8:\
        :setenv=LC_COLLATE=C:\
        :tc=default:

# PostgreSQL database
postgresql_enable="YES"
postgresql_data="/usr/local/pgsql/data"
postgresql_class="postgres"

2063 # procstat -e 96452
  PID COMM             ENVIRONMENT
96452 postgres         LSCOLORS=gxfxcxdxbxegedabagacad HTTP_PROXY=http://194.145.60.1:9400 LANG=de_DE.UTF-8 NO_PROXY="localhost .siemens.net .siemens.com .siemens.de" MAIL=/var/mail/postgres PGLOCALEDIR=/usr/local/share/locale PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/var/db/postgres/bin PGDATA=/usr/local/pgsql/data PWD=/var/db/postgres PGSYSCONFDIR=/usr/local/etc/postgresql TERM=xterm HOME=/var/db/postgres USER=postgres SHELL=/bin/sh PG_GRANDPARENT_PID=96450 MM_CHARSET=UTF-8 HTTPS_PROXY=https://194.145.60.1:9400 FTP_PROXY=ftp://194.145.60.1:9400 BLOCKSIZE=K

It isn't passed to the process..
Comment 3 Palle Girgensohn freebsd_committer freebsd_triage 2019-02-27 10:27:11 UTC
(In reply to Michael Osipov from comment #2)

Indeed, it looks plain wrong. I'm lookin into it.

Palle
Comment 4 Michael Osipov 2019-02-27 10:33:53 UTC
(In reply to Michael Osipov from comment #2)

The rc.conf section was supposed to read:

# PostgreSQL database
postgresql_enable="YES"
postgresql_data="/usr/local/pgsql/data"
postgresql_class="postgres"
postgresql_login_class="postgres"
Comment 5 Michael Osipov 2019-02-27 16:23:52 UTC
Just wanted to add that I have tried to ally the very same for the nexus2 port. Does not work either. I have ended up with _env="LANG=C.UTF-8", but this should be necessary.
Comment 6 Walter Schwarzenfeld freebsd_triage 2019-08-17 13:37:55 UTC
ping!
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-05-15 09:13:26 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ab83f2b4bb78a718efa5c43247ba1e1d207f99b6

commit ab83f2b4bb78a718efa5c43247ba1e1d207f99b6
Author:     Palle Girgensohn <girgen@FreeBSD.org>
AuthorDate: 2021-05-15 09:11:12 +0000
Commit:     Palle Girgensohn <girgen@FreeBSD.org>
CommitDate: 2021-05-15 09:12:17 +0000

    databases/postgresql??-*: Upgrade to latest version

    PostgreSQL 13.3, 12.7, 11.12, 10.17, and 9.6.22 Released!

    The PostgreSQL Global Development Group has released an update to all supported
    versions of our database system, including 13.3, 12.7, 11.12, 10.17, and
    9.6.22. This release closes three security vulnerabilities and fixes over 45
    bugs reported over the last three months.

    Security fixes in this release:

    CVE-2021-32027: Buffer overrun from integer overflow in array subscripting
                    calculations

    CVE-2021-32028: Memory disclosure in INSERT ... ON CONFLICT ... DO UPDATE

    CVE-2021-32029: Memory disclosure in partitioned-table UPDATE ... RETURNING

    Also plenty of bug fixes. See the release note for details.

    Changes to the port:

    Make sure we use the matching version of llvm. This fixes a problem with the
    llvm version string not being monotonically increasing with the version
    number. [1]

    Better pkg message about checksums for postgresql 12+. [2] [4]

    Adjust login class parameter to adhere to the documentation in rc.subr(8) [3]:
      The rc.conf parameter for the login class of the postgresql daemon has
      changed name from postgresql_class to postgresql_login_class, since
      rc.subr(8) states that the parameter should be named ${name}_login_class.

    Allow parallel builds. [5]

    Correct the directory name for the user postgres in pkg message. [6]

    PR:             250824 [1], 253558 [2], 236060 [3], 233106 [4],  230656 [5]
    PR:             226674 [6]
    Submitted by:   Michael Zhilin [2], Michael Zhilin [3], Dmitry Chestnykh [4]
    Submitted by:   Steve Wills [5], knezour [6]

    Security:       76e0bb86-b4cb-11eb-b9c9-6cc21735f730
    Security:       62da9702-b4cc-11eb-b9c9-6cc21735f730

    Release notes:  https://www.postgresql.org/docs/release/

 UPDATING                                           |  8 ++++++
 databases/postgresql10-server/Makefile             |  4 +--
 databases/postgresql10-server/distinfo             |  6 ++---
 .../files/pkg-message-server.in                    |  8 +++---
 databases/postgresql10-server/files/postgresql.in  |  8 +++---
 databases/postgresql11-server/Makefile             |  4 +--
 databases/postgresql11-server/distinfo             |  6 ++---
 .../files/pkg-message-server.in                    |  8 +++---
 databases/postgresql11-server/files/postgresql.in  |  8 +++---
 databases/postgresql12-server/Makefile             |  4 +--
 databases/postgresql12-server/distinfo             |  6 ++---
 .../files/pkg-message-server.in                    | 14 +++++-----
 databases/postgresql12-server/files/postgresql.in  |  8 +++---
 databases/postgresql13-server/Makefile             | 31 +++++++++++++++-------
 databases/postgresql13-server/distinfo             |  6 ++---
 .../files/pkg-message-server.in                    | 14 +++++-----
 databases/postgresql13-server/files/postgresql.in  |  8 +++---
 databases/postgresql13-server/pkg-plist-client     |  1 +
 databases/postgresql13-server/pkg-plist-server     |  8 ++++++
 .../files/pkg-message-server.in                    |  8 +++---
 databases/postgresql96-server/Makefile             |  4 +--
 databases/postgresql96-server/distinfo             |  6 ++---
 .../files/pkg-message-server.in                    |  8 +++---
 databases/postgresql96-server/files/postgresql.in  |  8 +++---
 24 files changed, 112 insertions(+), 82 deletions(-)
Comment 8 Palle Girgensohn freebsd_committer freebsd_triage 2021-05-15 09:16:25 UTC
Committed. Thanks!
Comment 9 Michael Osipov 2021-05-15 09:17:23 UTC
(In reply to Palle Girgensohn from comment #8)

Awesome, thanks!
Comment 10 commit-hook freebsd_committer freebsd_triage 2021-05-17 08:11:19 UTC
A commit in branch 2021Q2 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4ac52e0c203ea1ac3cd4dd51dd6dcc89678fe4ac

commit 4ac52e0c203ea1ac3cd4dd51dd6dcc89678fe4ac
Author:     Palle Girgensohn <girgen@FreeBSD.org>
AuthorDate: 2021-05-15 09:11:12 +0000
Commit:     Palle Girgensohn <girgen@FreeBSD.org>
CommitDate: 2021-05-17 08:06:59 +0000

    databases/postgresql??-*: Upgrade to latest version

    PostgreSQL 13.3, 12.7, 11.12, 10.17, and 9.6.22 Released!

    The PostgreSQL Global Development Group has released an update to all supported
    versions of our database system, including 13.3, 12.7, 11.12, 10.17, and
    9.6.22. This release closes three security vulnerabilities and fixes over 45
    bugs reported over the last three months.

    Security fixes in this release:

    CVE-2021-32027: Buffer overrun from integer overflow in array subscripting
                    calculations

    CVE-2021-32028: Memory disclosure in INSERT ... ON CONFLICT ... DO UPDATE

    CVE-2021-32029: Memory disclosure in partitioned-table UPDATE ... RETURNING

    Also plenty of bug fixes. See the release note for details.

    Changes to the port:

    Make sure we use the matching version of llvm. This fixes a problem with the
    llvm version string not being monotonically increasing with the version
    number. [1]

    Better pkg message about checksums for postgresql 12+. [2] [4]

    Adjust login class parameter to adhere to the documentation in rc.subr(8) [3]:
      The rc.conf parameter for the login class of the postgresql daemon has
      changed name from postgresql_class to postgresql_login_class, since
      rc.subr(8) states that the parameter should be named ${name}_login_class.

    Allow parallel builds. [5]

    Correct the directory name for the user postgres in pkg message. [6]

    PR:             250824 [1], 253558 [2], 236060 [3], 233106 [4],  230656 [5]
    PR:             226674 [6]
    Submitted by:   Michael Zhilin [2], Michael Zhilin [3], Dmitry Chestnykh [4]
    Submitted by:   Steve Wills [5], knezour [6]

    Security:       76e0bb86-b4cb-11eb-b9c9-6cc21735f730
    Security:       62da9702-b4cc-11eb-b9c9-6cc21735f730

    Release notes:  https://www.postgresql.org/docs/release/

    (cherry picked from commit ab83f2b4bb78a718efa5c43247ba1e1d207f99b6)

 UPDATING                                           |  8 ++++++
 databases/postgresql10-server/Makefile             |  2 +-
 databases/postgresql10-server/distinfo             |  6 ++---
 .../files/pkg-message-server.in                    |  8 +++---
 databases/postgresql10-server/files/postgresql.in  |  8 +++---
 databases/postgresql11-server/Makefile             |  2 +-
 databases/postgresql11-server/distinfo             |  6 ++---
 .../files/pkg-message-server.in                    |  8 +++---
 databases/postgresql11-server/files/postgresql.in  |  8 +++---
 databases/postgresql12-server/Makefile             |  2 +-
 databases/postgresql12-server/distinfo             |  6 ++---
 .../files/pkg-message-server.in                    | 14 +++++------
 databases/postgresql12-server/files/postgresql.in  |  8 +++---
 databases/postgresql13-server/Makefile             | 29 ++++++++++++++++------
 databases/postgresql13-server/distinfo             |  6 ++---
 .../files/pkg-message-server.in                    | 14 +++++------
 databases/postgresql13-server/files/postgresql.in  |  8 +++---
 databases/postgresql13-server/pkg-plist-client     |  1 +
 databases/postgresql13-server/pkg-plist-server     |  8 ++++++
 .../files/pkg-message-server.in                    |  8 +++---
 databases/postgresql96-server/Makefile             |  2 +-
 databases/postgresql96-server/distinfo             |  6 ++---
 .../files/pkg-message-server.in                    |  8 +++---
 databases/postgresql96-server/files/postgresql.in  |  8 +++---
 24 files changed, 107 insertions(+), 77 deletions(-)