> I think the ordering of checks in main() and setup() is the culprit > here. main() calls adjust_data_dir() first, which does this: > >> snprintf(cmd, sizeof(cmd), "\"%s/postgres\" -D \"%s\" -C data_directory", >> cluster->bindir, cluster->pgconfig); > > to get the path to the data directory from the config. But > cluster->bindir isn't initialized yet.
Agreed on the ordering. The main() should first call check_bin_dirs() to resolve the default new binary directory first and then call adjust_data_dir() to find the actual data directory when a configuration-only directory is specified, and then check_data_dir(). Best regards, Bohyun On Wed, Oct 14, 2026 at 9:17 AM Heikki Linnakangas <[email protected]> wrote: > On 14/10/2026 04:39, Chao Li wrote: > > However, the updated test in 002_pg_upgrade.pl doesn’t seem to cover > the bug being fixed. I tried to ran the updated test against master, and it > still passed. Is that intentional? > > Yes, I didn't include a test for the bug being fixed. The test change > was just to reflect that the behavior with a bogus --old-bindir changed > slightly -- the error on that now occurs earlier, before the > pg_upgrade_output.d directory is created. > > - Heikki > >
