Misleading/inaccurate error message from pg_basebackup - Mailing list pgsql-bugs

From c@osss.net
Subject Misleading/inaccurate error message from pg_basebackup
Date
Msg-id 8C23AFD9-4FCA-4FFD-8611-1B81BACCD25A@osss.net
Whole thread Raw
Responses Re: Misleading/inaccurate error message from pg_basebackup
Re: Misleading/inaccurate error message from pg_basebackup
List 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/
shouldbe world readable) 

Reading that error suggests that I need to make the directory /var/lib/postgresql/14 world-readable, but doing so does
notfix 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/
shouldbe 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


pgsql-bugs by date:

Previous
From: feichanghong
Date:
Subject: Re: MarkBufferDirty Assert held LW_EXCLUSIVE lock fail when ginFinishSplit
Next
From: Alexander Lakhin
Date:
Subject: Re: BUG #18297: Error when adding a column to a parent table with complex inheritance