Misleading/inaccurate error message from pg_basebackup

From: c(at)osss(dot)net
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Misleading/inaccurate error message from pg_basebackup
Date: 2024-01-22 16:47:09
Message-ID: 8C23AFD9-4FCA-4FFD-8611-1B81BACCD25A@osss.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

pg_basebackup can throw an error which is inaccurate and misleading:

$ mkdir /var/lib/postgresql/14
$ ls -ld /var/lib/postgresql/14
drwxr-x--- 2 postgres postgres 6 Jan 22 16:08 /var/lib/postgresql/14
$ pg_basebackup --version
Error: /var/lib/postgresql/14/main is not accessible; please fix the directory permissions (/var/lib/postgresql/14/ should be world readable)

Reading that error suggests that I need to make the directory /var/lib/postgresql/14 world-readable, but doing so does not fix the problem, as the actual problem is that the main subdirectory does not exist:

$ chmod a+rx /var/lib/postgresql/14
$ ls -ld /var/lib/postgresql/14
drwxr-xr-x 2 postgres postgres 6 Jan 22 16:08 /var/lib/postgresql/14
$ pg_basebackup --version
Error: /var/lib/postgresql/14/main is not accessible; please fix the directory permissions (/var/lib/postgresql/14/ should be world readable)

In fact it does not need to be world readable at all - the subdirectory just needs to be created:

$ chmod o-rx /var/lib/postgresql/14
$ mkdir /var/lib/postgresql/14/main
$ ls -ld /var/lib/postgresql/14{,/main}
drwxr-x--- 3 postgres postgres 19 Jan 22 16:14 /var/lib/postgresql/14
drwxr-x--- 2 postgres postgres 6 Jan 22 16:14 /var/lib/postgresql/14/main
$ pg_basebackup --version
pg_basebackup (PostgreSQL) 14.10 (Ubuntu 14.10-1.pgdg20.04+1)

This check is being done in cases where it's unnecessary, as it shouldn't matter at all when running a simple --version or --help, anyways.

--
Regards,
Casey

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alexander Lakhin 2024-01-22 17:00:01 Re: BUG #18297: Error when adding a column to a parent table with complex inheritance
Previous Message feichanghong 2024-01-22 16:21:58 Re: MarkBufferDirty Assert held LW_EXCLUSIVE lock fail when ginFinishSplit