Re: [HACKERS] Re: initdb.sh fixed7

From: Keith Parks <emkxp01(at)mtcc(dot)demon(dot)co(dot)uk>
To: peter_e(at)gmx(dot)net, pgman(at)candle(dot)pha(dot)pa(dot)us
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Re: initdb.sh fixed7
Date: 1999-12-20 16:32:31
Message-ID: 199912201632.QAA15589@mtcc.demon.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
>
>> > > 'insert ( data data data )' bootstrap commands are containing gaps. On
the
>> > > other hand, this was one of the key things that were supposed to be
>> > > improved because relying on $USER was not su-safe. Maybe $UID would work,
>> > > since initdb isn't supposed to be setuid anyway.
>> >
>> > Again, a bash-ism. Let's face, it, the postgres binary is going to
>> > croak on root anyway, so we are just doing an extra check in initdb.
>>
>> But the point was to initialize to superuser id in Postgres as that
>> number, but we might as well start them out at 0, like it is now.
>
>I am now using:
>
> POSTGRES_SUPERUSERID="`id -u 2>/dev/null || echo 0`"
>
>Let's see how portable that is?

OOps,

"id -u" is a no-no on Solaris unless /usr/xpg4/bin is before /bin in
your path so we default to a userid of 0.

And in miscinit we assert that UserID must not equal 0 which
causes an Abort().

bash-2.03$ bin/postgres -O template1
DEBUG: Data Base System is starting up at Mon Dec 20 15:52:59 1999
DEBUG: Data Base System was shutdowned at Mon Dec 20 15:52:52 1999
DEBUG: CheckPoint record at (0, 152)
DEBUG: Redo record at (0, 152); Undo record at (0, 0)
DEBUG: NextTransactionId: 4621; NextOid: 0
DEBUG: Invalid NextTransactionId/NextOid
DEBUG: Data Base System is in production state at Mon Dec 20 15:52:59 1999

POSTGRES backend interactive interface
$Revision: 1.137 $ $Date: 1999/11/16 06:13:35 $

backend> CREATE VIEW pg_user AS SELECT usename, usesysid, usecreatedb, usetrace,
usesuper, usecatupd, '****
****'::text as passwd, valuntil FROM pg_shadow
TRAP: Failed Assertion("!(((bool) ((UserId) != 0))):", File: "miscinit.c", Line:
433)

!(((bool) ((UserId) != 0))) (0) [No such file or directory]
Abort (core dumped)
bash-2.03$

Unless I'm out of step with CVS.

Keith.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Lamar Owen 1999-12-20 17:11:04 Re: [HACKERS] Cc: lamar.owen@wgcr.org
Previous Message Tom Lane 1999-12-20 15:47:19 Re: [HACKERS] Re: [COMMITTERS] pgsql/src/interfaces/libpgeasy (libpgeasy.c)