Обсуждение: psql + libedit command history truncation (was: psql history vs. dearmor (pgcrypto))

Поиск
Список
Период
Сортировка

psql + libedit command history truncation (was: psql history vs. dearmor (pgcrypto))

От
Josh Kupershmidt
Дата:
On Mon, Nov 14, 2011 at 1:01 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> It looks like the problem is that the original has a blank line after
> the line that says "Version: GnuPG v2.0.17 (GNU/Linux)", but when you
> recall it from the query buffer, that extra blank line gets elided.
>
> The attached patch fixes it for me.  I'm a little worried it might
> cause a problem in some case I'm not thinking about, but I can't think
> of any such case right this minute.

(FYI, the patch does seem to fix the problem Tomas was complaining about.)

But it reminded me of another issue. With OS X 10.6.8, and otool -L
reporting that psql depends on libedit version 2.11.0, the up-arrow
recall of Tomas' query gets truncated around here: 5I0/NTm+fFkB0McY9E2fAA [rest of the line missing]

i.e. it's keeping roughly 1021 characters. I was about to just chalk
that up to some limit in libedit's readline() implementation, but I
can see in my ~/.psql_history file that the entire query is logged.
Plus \e recalls the full query correctly. And if I up-arrow to recall
the query, then do anything to modify that recalled query (such as
typing a few characters at the end, then moving back or forth through
the history), then subsequent recalls of the query work fine.

So I'm not sure if this is a bug purely in libedit, or if there's
something amiss in psql. I saw a possibly-related complaint about
psql+libedit on Debian[1]. Anyone have a better guess about what's
going on?
Josh

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=603922


Re: psql + libedit command history truncation (was: psql history vs. dearmor (pgcrypto))

От
Josh Kupershmidt
Дата:
On Mon, Nov 14, 2011 at 7:04 PM, Josh Kupershmidt <schmiddy@gmail.com> wrote:
> But it reminded me of another issue. With OS X 10.6.8, and otool -L
> reporting that psql depends on libedit version 2.11.0, the up-arrow
> recall of Tomas' query gets truncated around here:
>  5I0/NTm+fFkB0McY9E2fAA [rest of the line missing]

For the curious, this does appear to be a hardcoded limit in libedit.
A bit of digging through a tarball of libedit-20110802-3.0 turned up
this line in el.h:

#define EL_BUFSIZ       ((size_t)1024)  /* Maximum line size            */

which you can bump up as a work-around.

Josh