Re: Use HostsFileName everywhere
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: surya poondla <suryapoondla4@gmail.com>
Cc: Zsolt Parragi <zsolt.parragi@percona.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Daniel Gustafsson <daniel@yesql.se>
Date: 2026-07-07T06:36:09Z
Lists: pgsql-hackers
On Mon, Jul 06, 2026 at 04:43:53PM -0700, surya poondla wrote: > Hi Zsolt, > Thanks for reporting the bug and the patch. If an operator changes the > hosts_file GUC, without the patch those three messages don't get updated > and it makes debugging a lot harder. The fix is clearly right. Looks like an oversight of 4f433025f666. This is not critical, still a nice life improvement if setting a custom file value for these error messages. > A couple of observations: > 1. Small typo in the commit message "harcoded" → "hardcoded". > 2. While reviewing I noticed a related NULL-safety question. This isn't > caused by your patch, I was just digging to see whether it could turn into > a crash or segfault after the change. SetConfigOption() is called for hosts_file at an early startup stage, as of SelectConfigFiles(). init_host_context() and be_tls_init() require the GUCs to be loaded, meaning that a NULL value would not be an issue because it will be either the default of pg_hosts.conf or the custom value set in postgresql.conf. HBA and ident files work the same way: we need them loaded before any authentication would kick in, including direct SSL requests. In short, I think that the patch should be OK. Purely cosmetic, still OK. Daniel? -- Michael