Re: POLA violation with \c service=

From: David Fetter <david(at)fetter(dot)org>
To: Erik Rijkers <er(at)xs4all(dot)nl>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: POLA violation with \c service=
Date: 2015-01-11 00:41:16
Message-ID: 20150111004116.GA12233@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jan 10, 2015 at 09:30:57AM +0100, Erik Rijkers wrote:
> On Fri, January 9, 2015 20:15, David Fetter wrote:
> > [psql_fix_uri_service_003.patch]
>
> Applies on master; the feature (switching services) works well but a \c without any parameters produces a segfault:
>
> (centos 6.6, 4.9.2, 64-bit)
>
>
> $ echo -en "$PGSERVICEFILE\n$PGSERVICE\n$PGPORT\n"
> /home/aardvark/.pg_service
> service_pola
> 6968
>
> $ psql
> Timing is on.
> psql (9.5devel_service_pola_20150109_2340_ac7009abd228)
> Type "help" for help.
>
> testdb=# \c service=HEAD
> You are now connected to database "testdb" as user "aardvark" via socket in "/tmp" at port "6545".
> testdb=# \c service=service_pola
> You are now connected to database "testdb" as user "aardvark" via socket in "/tmp" at port "6968".
> testdb=# \c
> Segmentation fault (core dumped)

Fixed by running that function only if the argument exists.

More C cleanups, too.

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Attachment Content-Type Size
psql_fix_uri_service_004.patch text/plain 8.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2015-01-11 00:57:47 Re: libpq 9.4 requires /etc/passwd?
Previous Message Andreas Karlsson 2015-01-11 00:36:29 Re: BRIN range operator class