Skip to content

Warn about unreadable postgresql.conf in pg_lsclusters

If postgresql.confis not world-readable, regular users (i.e. not root or postgres) get an unhelpful error message currently:

mbanck@tomcat:~$ pg_lsclusters 
Use of uninitialized value $data_directory in concatenation (.) or string at /usr/share/perl5/PgCommon.pm line 284.
Ver Cluster  Port      Status Owner     Data directory                  Log file
15  main     <unknown> down   <unknown> <unknown>                       <unknown>
17  main     5433      online postgres  /var/lib/postgresql/17/main     /var/log/postgresql/postgresql-17-main.log

This MR changes this to

mbanck@tomcat:~$ pg_lsclusters
Warning: configfile /etc/postgresql/15/main/postgresql.conf not readable
Ver Cluster  Port      Status Owner     Data directory                  Log file
15  main     <unknown> down   <unknown> <unknown>                       <unknown>
17  main     5433      online postgres  /var/lib/postgresql/17/main     /var/log/postgresql/postgresql-17-main.log
``

Merge request reports

Loading