pg_basebackup fails with Could not stat file or directory "./.pg_hba.conf.un~"

From: "Stephens, Gary" <Gary(dot)Stephens(at)ehi(dot)com>
To: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: pg_basebackup fails with Could not stat file or directory "./.pg_hba.conf.un~"
Date: 2023-03-07 20:14:07
Message-ID: DM4PR11MB5328327445FFA1FE28426198F0B79@DM4PR11MB5328.namprd11.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

I'm writing to report a bug with pg_basebackup. It fails with this error:

pg_basebackup: error: could not initiate base backup: ERROR: could not stat file or directory "./.pg_hba.conf.un~": Permission denied

The file in question is a temporary file created by vim, and has the same permissions and security context as the file that it was editing (pg_hba.conf).

It's unclear to me why pg_basebackup is trying to read this file. It's also unclear why it's failing when it does try to read it, since the file has the same permissions and security context that should allow the instance to read it (even though the backup really shouldn't need to read it).

The directory where it resides is /var/lib/pgsql/data (this is where pg_hba.conf resides as well).

Please note: After I removed the file, the backup ran normally. I have not tested to see whether other temp files in the same directory would cause a similar failure.

Database version:
postgres=# select version();
version
-------------------------------------------------------------------------------------------------------------
PostgreSQL 13.7 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10), 64-bit

Thanks,

Gary Stephens
Enterprise Holdings, Incorporated

________________________________

CONFIDENTIALITY NOTICE: This e-mail and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed and may contain confidential and privileged information protected by law. If you received this e-mail in error, any review, use, dissemination, distribution, or copying of the e-mail is strictly prohibited. Please notify the sender immediately by return e-mail and delete all copies from your system.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2023-03-07 21:32:14 Re: pg_basebackup fails with Could not stat file or directory "./.pg_hba.conf.un~"
Previous Message Tom Lane 2023-03-07 18:43:05 Re: BUG #17811: Replacing an underlying view breaks OLD/NEW tuple when accessing it via upper-level view