Re: createuser ignores stdin in 8.1.0?

Lists: pgsql-general
From: Gary Horton <Gary(dot)Horton(at)Sun(dot)COM>
To: pgsql-general(at)postgresql(dot)org
Subject: createuser ignores stdin in 8.1.0?
Date: 2005-12-02 18:08:40
Message-ID: 43908DA8.5050708@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

We're migrating from 7.3.4 to 8.1.0, and I'm seeing different behavior
with the createuser command. What we are wanting is to streamline our
product installs, to require minimal user interaction, so we basically
embed the password like this in our bourne-shell wrapper script:

$POSTGRESQL_HOME/bin/createuser -d -P $PGUSER <<END
$PGPASSWORD
$PGPASSWORD
END

...and in 7.3.4, this works just fine, with the shell consuming the
stdin and redirecting it to the createuser command, which subsequently
doesn't bother the user with the prompt (i.e. the prompts are responded
to automatically). However, this doesn't work at all in 8.1.0 --
regardless of the stdin redirection, the createuser program appears to
ignore the stdin information and insists on prompting for the input
instead.

Is this a known expected behavior? Do we have a workaround to get this
to behave automatically like it did for 7.3.4?

Thanks so much for anyone's insights. And, if you would be so kind,
please cc me at my email since I'm not signed up to receive
interest-list messages...

-Gary Horton


From: Richard Huxton <dev(at)archonet(dot)com>
To: Gary Horton <Gary(dot)Horton(at)Sun(dot)COM>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: createuser ignores stdin in 8.1.0?
Date: 2005-12-02 18:36:37
Message-ID: 43909435.40206@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Gary Horton wrote:
> ...and in 7.3.4, this works just fine, with the shell consuming the
> stdin and redirecting it to the createuser command, which subsequently
> doesn't bother the user with the prompt (i.e. the prompts are responded
> to automatically). However, this doesn't work at all in 8.1.0 --
> regardless of the stdin redirection, the createuser program appears to
> ignore the stdin information and insists on prompting for the input
> instead.

Don't know what's changed, but it could be something that happened when
roles were introduced. A way to work around it would be to issue the SQL
"CREATE USER... PASSWORD 'foo'" via psql.

Oh - anything else you come across in the upgrade would be of interest
to many here, myself included ;-)

--
Richard Huxton
Archonet Ltd


From: Gary Horton <Gary(dot)Horton(at)Sun(dot)COM>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: createuser ignores stdin in 8.1.0?
Date: 2005-12-02 20:02:22
Message-ID: 4390A84E.7060700@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Richard Huxton wrote:

> Gary Horton wrote:
>
>> ...and in 7.3.4, this works just fine, with the shell consuming the
>> stdin and redirecting it to the createuser command, which
>> subsequently doesn't bother the user with the prompt (i.e. the
>> prompts are responded to automatically). However, this doesn't work
>> at all in 8.1.0 -- regardless of the stdin redirection, the
>> createuser program appears to ignore the stdin information and
>> insists on prompting for the input instead.
>
>
> Don't know what's changed, but it could be something that happened
> when roles were introduced. A way to work around it would be to issue
> the SQL "CREATE USER... PASSWORD 'foo'" via psql.

That's a great idea, Richard - thanks, I'll give this a shot --

>
> Oh - anything else you come across in the upgrade would be of interest
> to many here, myself included ;-)

So far, so good in general -- I was unable to execute the regression
tests (installcheck) - the C compilation fails. But I'm successfully
executing all of our own app-level tests, so I'm optimistic...other than
that, I did send out a list of questions around configure options, but
haven't gotten any responses; but I will post to the list about anything
else I come across!

-gh


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gary Horton <Gary(dot)Horton(at)Sun(dot)COM>
Cc: Richard Huxton <dev(at)archonet(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: createuser ignores stdin in 8.1.0?
Date: 2005-12-02 20:52:48
Message-ID: 200512022052.jB2Kqml19096@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Gary Horton wrote:
>
>
> Richard Huxton wrote:
>
> > Gary Horton wrote:
> >
> >> ...and in 7.3.4, this works just fine, with the shell consuming the
> >> stdin and redirecting it to the createuser command, which
> >> subsequently doesn't bother the user with the prompt (i.e. the
> >> prompts are responded to automatically). However, this doesn't work
> >> at all in 8.1.0 -- regardless of the stdin redirection, the
> >> createuser program appears to ignore the stdin information and
> >> insists on prompting for the input instead.
> >
> >
> > Don't know what's changed, but it could be something that happened
> > when roles were introduced. A way to work around it would be to issue
> > the SQL "CREATE USER... PASSWORD 'foo'" via psql.
>
> That's a great idea, Richard - thanks, I'll give this a shot --

createuser was converted from a shell script to a C program in 7.4, so I
guess something changed at that point.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gary Horton <Gary(dot)Horton(at)Sun(dot)COM>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: createuser ignores stdin in 8.1.0?
Date: 2005-12-02 21:06:31
Message-ID: 7121.1133557591@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Gary Horton <Gary(dot)Horton(at)Sun(dot)COM> writes:
> We're migrating from 7.3.4 to 8.1.0, and I'm seeing different behavior
> with the createuser command. What we are wanting is to streamline our
> product installs, to require minimal user interaction, so we basically
> embed the password like this in our bourne-shell wrapper script:

> $POSTGRESQL_HOME/bin/createuser -d -P $PGUSER <<END
> $PGPASSWORD

We changed all the clients some time ago to insist on getting passwords
from /dev/tty not stdin. There was a security argument for it, I think,
but I don't recall the reasoning exactly.

regards, tom lane


From: Gary Horton <Gary(dot)Horton(at)Sun(dot)COM>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: createuser ignores stdin in 8.1.0?
Date: 2005-12-02 23:49:47
Message-ID: 4390DD9B.5080605@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Thanks, Tom, that explains it. I'm using Richard Huxton's suggested
workaround and it's working just fine -
-gh

Tom Lane wrote:

>Gary Horton <Gary(dot)Horton(at)Sun(dot)COM> writes:
>
>
>>We're migrating from 7.3.4 to 8.1.0, and I'm seeing different behavior
>>with the createuser command. What we are wanting is to streamline our
>>product installs, to require minimal user interaction, so we basically
>>embed the password like this in our bourne-shell wrapper script:
>>
>>
>
>
>
>>$POSTGRESQL_HOME/bin/createuser -d -P $PGUSER <<END
>>$PGPASSWORD
>>
>>
>
>We changed all the clients some time ago to insist on getting passwords
>from /dev/tty not stdin. There was a security argument for it, I think,
>but I don't recall the reasoning exactly.
>
> regards, tom lane
>
>