Re: [HACKERS] Re: initdb.sh fixed7 - Mailing list pgsql-hackers

From Keith Parks
Subject Re: [HACKERS] Re: initdb.sh fixed7
Date
Msg-id 199912201632.QAA15589@mtcc.demon.co.uk
Whole thread Raw
Responses Re: [HACKERS] Re: initdb.sh fixed7
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.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.



pgsql-hackers by date:

Previous
From: "NormanD"
Date:
Subject: New Catia 5 r 4 and other appz!!!
Next
From: Lamar Owen
Date:
Subject: Re: [HACKERS] Cc: lamar.owen@wgcr.org