initdb fails to initialize data directory

From: Nikhil Sontakke <nikhils(at)2ndquadrant(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: initdb fails to initialize data directory
Date: 2018-04-19 08:52:33
Message-ID: CAMGcDxfLfpYU_Jru++L6ARPCOyxr0W+2O3Q54TDi5XdYeU36ow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Encountered the following behavior with initdb on one of our test
builds while using latest master head:

initdb -D $DATADIR

The program "postgres" was found by "/Users/nikhils/install/bin/initdb"
but was not the same version as initdb.
Check your installation.

Intrigued, on digging down further, this is happening because we are
not using a long enough buffer to accept the output of "postgres -V"
in the find_other_exec() function. In our case, we had used
--with-extra-version option with configure which caused the output of
"postgres -V" to go a little beyond the current "line" variable size.
This caused the strcmp to fail leading to initdb refusing to
initialize any data directories at all.

PFA, a patch which uses MAXPGPATH for the variable size.

Regards,
Nikhils
--
Nikhil Sontakke http://www.2ndQuadrant.com/
PostgreSQL/Postgres-XL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
initdb_path_variable.patch application/octet-stream 381 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Darafei Komяpa Praliaskouski 2018-04-19 09:11:12 Re: Is a modern build system acceptable for older platforms
Previous Message Amit Langote 2018-04-19 08:27:54 Re: Boolean partitions syntax