Thread: Still not able to initdb

Still not able to initdb

From
Michael Meskes
Date:
Hi,

I just tried the latest Debian packages for beta4 and I still cannot
initdb. It's the same old problem. Once I add a "\." to sql_features.txt
it works well, but without it it errors out. 

Needless to say that the 'echo "\."' is there in initdb, but it still
doesn't work without the additional entry in sql_features.txt. No idea
why.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!


Re: Still not able to initdb

From
Michael Meskes
Date:
On Mon, Oct 13, 2003 at 02:38:26AM +0100, Oliver Elphick wrote:
> On Sun, 2003-10-12 at 13:27, Michael Meskes wrote:
> > I just tried the latest Debian packages for beta4 and I still cannot
> > initdb. It's the same old problem. Once I add a "\." to sql_features.txt
> > it works well, but without it it errors out. 
> > 
> > Needless to say that the 'echo "\."' is there in initdb, but it still
> > doesn't work without the additional entry in sql_features.txt. No idea
> > why.
> 
> There must be some difference between our systems.
> [...]
> One other possibility: initdb uses /bin/sh.  On my system, that is
> provided by bash

That's it! I'm using ash as sh.

I have no idea why, but the reason is that the last CR is not read by
the postgres process as proved by an strace run. After adding an
additional 'echo' after the 'echo "\."' makes initdb run just fine with
ash.

But when I try simulating this and run

(
echo "COPY information_schema.sql_features (feature_id, feature_name, sub_feature_id, sub_feature_name, is_supported,
comments)FROM STDIN;"
 
cat /usr/share/postgresql/sql_features.txt
echo "\."
) | tail -2|od -xc

both shells reveal the same output.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!


Re: Still not able to initdb

From
Tom Lane
Date:
Michael Meskes <meskes@postgresql.org> writes:
>>> I just tried the latest Debian packages for beta4 and I still cannot
>>> initdb. It's the same old problem. Once I add a "\." to sql_features.txt
>>> it works well, but without it it errors out. 

I have fixed this (I hope) using the approach Peter suggested: read
sql_features.txt using COPY FROM 'filename' instead of COPY FROM STDIN.
This avoids needing to make any assumptions about what sort of newlines
will be produced in a shell script.
        regards, tom lane


Re: Still not able to initdb

From
Peter Eisentraut
Date:
Michael Meskes writes:

> That's it! I'm using ash as sh.

I tried it with ash 0.2 and initdb works fine.

-- 
Peter Eisentraut   peter_e@gmx.net