Re: libedit memory stomp is apparently fixed in OS X Lion

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Peter Geoghegan <peter(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: libedit memory stomp is apparently fixed in OS X Lion
Date: 2011-07-30 19:25:57
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

[ ... having now installed OS X Lion ... ]

Dave Page <dpage(at)pgadmin(dot)org> writes:
> On Fri, Jul 22, 2011 at 5:16 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2011-07-30 19:32:03 Re: libedit memory stomp is apparently fixed in OS X Lion
Previous Message Robert Haas 2011-07-30 14:02:02 Re: pgbench internal contention