Обсуждение: Re: [HACKERS] Re: initdb.sh fixed7
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.
> >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$
Oh, this is bad news. I see what you are saying. In 6.5.*, we had
pg_id, which was used to do this. We still have pg_id, but I assume the
attempt was to remove reliance ont that in the new initdb.sh. Right
Peter?
If so, can you suggest a solution under Solaris for getting the user id
value?
-- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610)
853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill,
Pennsylvania19026