Skip Menu |

This queue is for tickets about the Test-postgresql CPAN distribution.

Report information
The Basics
Id: 118500
Status: resolved
Priority: 0/
Queue: Test-postgresql

People
Owner: TJC [...] cpan.org
Requestors: NEWELLC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.20
Fixed in: 1.21_01



Subject: Test::PostgreSQL doesn't work out of the box as root any more
The releases this year don't appear to work when run as root. pg_ctl doesn't seem to like being run directly as root. If I set pg_ctl to '' when initialising Test::PostgreSQL it does work as it used to. t/00-base.t .......... ok t/01-raii.t .......... pg_ctl: cannot be run as root Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process. t/01-raii.t .......... skipped: /usr/lib/postgresql/9.4/bin/pg_ctl init -s -D /tmp/pgtest.L08S5/data -o -U postgres -A trust failed:256 at /root/.cpanm/work/1455369474.1300/Test-PostgreSQL-1.20/blib/lib/Test/PostgreSQL.pm line 451. t/02-multi.t ......... pg_ctl: cannot be run as root Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process. t/02-multi.t ......... skipped: /usr/lib/postgresql/9.4/bin/pg_ctl init -s -D /tmp/pgtest.TdkqV/data -o -U postgres -A trust failed:256 at /root/.cpanm/work/1455369474.1300/Test-PostgreSQL-1.20/blib/lib/Test/PostgreSQL.pm line 451. t/04-multiprocess.t .. pg_ctl: cannot be run as root Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process. t/04-multiprocess.t .. skipped: /usr/lib/postgresql/9.4/bin/pg_ctl init -s -D /tmp/pgtest.qu9me/data -o -U postgres -A trust failed:256 at /root/.cpanm/work/1455369474.1300/Test-PostgreSQL-1.20/blib/lib/Test/PostgreSQL.pm line 451. t/deadlock.t ......... pg_ctl: cannot be run as root Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process. t/deadlock.t ......... skipped: /usr/lib/postgresql/9.4/bin/pg_ctl init -s -D /tmp/pgtest.tY50R/data -o -U postgres -A trust failed:256 at /root/.cpanm/work/1455369474.1300/Test-PostgreSQL-1.20/blib/lib/Test/PostgreSQL.pm line 451. Note: this is a duplicate of the issue on github, I just wasn't sure which bug tracker you prefer to use.
I know this might be controversial, but.. can you just run the tests as a user other than root? It doesn't strike me as good practice to be running random unit tests from the internet as the root user on your systems. Although I recognise that with the advent of Docker, it's a lot more common to be running as a virtual-root user inside a Container. Unfortunately, the fact that pg_ctl refuses to run as root is a decision made upstream by the Postgresql devs. Yes, you can get things to work by setting pg_ctl to '' and entering the backwards-compatibility codepath in Test-Postgres but this is not recommended.
Hi, I'm hoping this has been fixed by 1.21_01 -- if you could test that version out (dev release on CPAN) and confirm, that would be great. Toby
New release 1.21 should fix this. Note that it should have worked as root previously, but only if $ENV{USER} was set -- which wasn't true in all cases. Now it gets for actual uid.