Re: BUG #5418: psql exits after using tab-completion with error message - Mailing list pgsql-bugs

From Ben Madin
Subject Re: BUG #5418: psql exits after using tab-completion with error message
Date
Msg-id D500103B-E461-4213-974E-2E70F5DD817F@ausvet.com.au
Whole thread Raw
In response to Re: BUG #5418: psql exits after using tab-completion with error message  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Thanks Tom,

I also reported it to Apple, but without this information, so I hope they g=
et the sense that it might be important enough to look at, especially if th=
ere is already a fix known.

I also contacted William Kyngesbury, and he was sympathetic (but had never =
had the problem himself, but neither does he use the tab-completion), but w=
ould rather Apple fixed it because his GIS software suite is very based on =
using Apple OSX frameworks where they exist.

cheers

Ben




On 15/04/2010, at 12:13 , Tom Lane wrote:

> I wrote:
>> It's fairly easy to reproduce in the regression database:
>> type "\d ten<TAB>".  I'm not sure what the triggering condition
>> is exactly, because some seemingly-similar cases don't fail,
>> for instance "\d test<TAB>" works as expected, ditto "\d t<TAB>".
>=20
> It turns out that the problem occurs when there are exactly 9 + 10*N
> possible completions, for any N>=3D0.  There's an off-by-one logic bug
> in libedit that results in a memory stomp because it forgets to enlarge
> an array before storing a terminating null pointer in it.
>=20
> The upstream netbsd sources incorporated a fix some time ago:
> http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit/readline.c.diff?r1=3D=
1.82&r2=3D1.83&sortby=3Ddate&f=3Dh
> with credit to Caleb Welton at Greenplum --- I wonder if he found it
> because of psql failing?  Apple hasn't incorporated this fix as of
> OS X 10.6.3, however.
>=20
> What's slightly more distressing is that the same source file
> (readline.c) appears to have at least two other occurrences of the same
> broken array-enlargement coding pattern, which were *not* fixed.
>=20
> I've reported this to Apple but I'm not real sure where to file NetBSD
> bugs.  Anybody want to yank the BSD guys' chain about the other errors?
>=20
>             regards, tom lane


--=20

Ben Madin
AusVet Animal Health Services
P.O. Box 5467
Broome   WA   6725
Australia

t : +61 8 9192 5455
f : +61 8 9192 5535
m : 0448 887 220
e : ben@ausvet.com.au

AusVet's website:  http://www.ausvet.com.au

This transmission is for the intended addressee only and is confidential in=
formation. If you have received this transmission in error, please delete i=
t and notify the sender. The contents of this email are the opinion of the =
writer only and are not endorsed by AusVet Animal Health Services unless ex=
pressly stated otherwise. Although AusVet uses virus scanning software we d=
o not accept liability for viruses or similar in any attachments.

pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: BUG #5422: problems installing postgresql-8.4 deleted folder / .s.PGSQL.lock not initinot initiate the connecti
Next
From: "suresh adapa"
Date:
Subject: Dump and Restore in postgresql-8.3.6-1PGDG