PostgreSQL 7.3rc1: initdb fais with '-W' switch given in the command line. - Mailing list pgsql-bugs

From Adam Buraczewski
Subject PostgreSQL 7.3rc1: initdb fais with '-W' switch given in the command line.
Date
Msg-id 20021124173709.GB20243@localhost.localdomain
Whole thread Raw
Responses Re: PostgreSQL 7.3rc1: initdb fais with '-W' switch given in the command line.
List pgsql-bugs
Name        : Adam Buraczewski
Email address    : adamb@polbox.pl

System Configuration
---------------------
  Architecture      : Intel Pentium II

  Operating System    : Linux 2.4.19, glibc 3.2.1 (i686-pc-linux-gnu)

  PostgreSQL version    : PostgreSQL 7.3 RC1

  Compiler used        : GCC 3.2.1

Description of the problem
--------------------------

Initdb fais with '-W' switch given in the command line.

This option enables DBA to set initial password for the superuser
account created during database cluster creation (usually this account
is named "postgres", "pgsql" or similar).  This is done inside initdb
script by issuing ALTER USER command and setting the password.  After
this, initdb checks if all necessary files (pg_pwd and pg_group) were
created.

This worked well under PostgreSQL 7.2.  However, PostgreSQL 7.3beta
and 7.3rc1 do not create "pg_group" file during this stage.  When
initdb checks for existance of this file, the test fails and initdb
gives up.

A way to repeat the problem
---------------------------

First compile PostgreSQL 7.3 RC1:

$ env CFLAGS='-O2 -march=i686' CXXFLAGS='-O2 -march=i686' LDFLAGS='-s' \
    ./configure --prefix=/usr/lib/pgsql7.3 --with-gnu-ld --enable-nls \
        --with-java --with-pgport=54321
$ make
$ make check
$ su -c make install

and then:

$ mkdir /var/pgsql
$ chown postgres.postgres /var/pgsql
$ cd /var/pgsql
$ su postgres
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/pgsql7.3/lib
$ export PATH=$PATH:/usr/lib/pgsql7.3/bin
$ export PGDATA=/var/pgsql
$ export PGLIB=/usr/lib/pgsql7.3/lib
$ initdb -W
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale C.

Fixing permissions on existing directory /var/pgsql... ok
creating directory /var/pgsql7.3rc1/base... ok
creating directory /var/pgsql7.3rc1/global... ok
creating directory /var/pgsql7.3rc1/pg_xlog... ok
creating directory /var/pgsql7.3rc1/pg_clog... ok
creating template1 database in /var/pgsql/base/1... ok
creating configuration files... ok
initializing pg_shadow... ok
Enter new superuser password: *******
Enter it again: ********
setting password...
The group file wasn't generated. Please report this problem.

initdb failed.

$ ls -l global/
total 108
-rw-------    1 postgres postgres     8192 Nov 24 18:26 1260
-rw-------    1 postgres postgres        0 Nov 24 18:25 1261
-rw-------    1 postgres postgres     8192 Nov 24 18:25 1262
-rw-------    1 postgres postgres    16384 Nov 24 18:25 16620
-rw-------    1 postgres postgres    16384 Nov 24 18:25 16621
-rw-------    1 postgres postgres     8192 Nov 24 18:25 16625
-rw-------    1 postgres postgres     8192 Nov 24 18:25 16626
-rw-------    1 postgres postgres    16384 Nov 24 18:26 16643
-rw-------    1 postgres postgres    16384 Nov 24 18:26 16644
-rw-------    1 postgres postgres     8192 Nov 24 18:26 pg_control
-rw-------    1 postgres postgres       52 Nov 24 18:26 pg_pwd

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

This problem could be easily fixed by removing the part of initdb
script which checks for "pg_group" file existance.  However, I don't
think if this is a good solution, since someone added this check on
purpose.

--
Adam Buraczewski <adamb@polbox.pl> * Linux registered user #165585
GCS/TW d- s-:+>+:- a- C+++(++++) UL++++$ P++ L++++ E++ W+ N++ o? K? w--
O M- V- PS+ !PE Y PGP+ t+ 5 X+ R tv- b+ DI? D G++ e+++>++++ h r+>++ y?

pgsql-bugs by date:

Previous
From: "Colin Stearman"
Date:
Subject: pg_dump/pg_restore
Next
From: Adam Buraczewski
Date:
Subject: PostgreSQL 7.3rc1: initdb fais with '-W' switch given in the command line.