Re: libedit memory stomp is apparently fixed in OS X Lion - Mailing list pgsql-hackers

From Tom Lane
Subject Re: libedit memory stomp is apparently fixed in OS X Lion
Date
Msg-id 25305.1312053957@sss.pgh.pa.us
Whole thread Raw
In response to Re: libedit memory stomp is apparently fixed in OS X Lion  (Dave Page <dpage@pgadmin.org>)
Responses Re: libedit memory stomp is apparently fixed in OS X Lion
List pgsql-hackers
[ ... having now installed OS X Lion ... ]

Dave Page <dpage@pgadmin.org> writes:
> On Fri, Jul 22, 2011 at 5:16 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> and if so does it crash when you try
>> to tab-complete a case with exactly 9 completions?

> Tab complete doesn't seem to work at all (nor does it in my builds
> with libedit). No crashes or anything - it just spews a blank line and
> returns to the prompt.

Same here.  Investigation discloses that Apple took a snapshot of
libedit at a time when rl_line_buffer was absolutely, utterly,
completely broken: it doesn't get updated when the current-line
buffer is realloc'd, meaning it's generally pointing at garbage,
meaning we cannot see any of the words on the current line before
the current word, meaning that any aspect of tab completion that
requires preceding context does not work.  So for example you can
get it to tab-complete "sel" to "SELECT", but no case where a table
name needs to be completed will work, because all of those depend on
seeing some previous words that cue us to think a table name is needed.

This appears to have been fixed in netbsd libedit in christo's commit
of Sat Aug 28 15:44:59 2010 UTC (readline.c v1.91 and other files of
even date).  However, Lion's copy of libedit is at least a month
older than that (readline.c is v1.89, for instance).

I'm off to file a bug report with Apple, and anybody else who cares
about this should do likewise.  But I would not hold my breath for
a fix appearing before OS X 10.8 :-(.

I think you had better plan on incorporating GNU readline into installer
builds for Lion.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: pgbench internal contention
Next
From: Dave Page
Date:
Subject: Re: libedit memory stomp is apparently fixed in OS X Lion