Re: pgsql: Add basic TAP tests for psql's tab-completion logic.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Christoph Berg <myon(at)debian(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgsql: Add basic TAP tests for psql's tab-completion logic.
Date: 2020-01-04 05:30:09
Message-ID: 3055.1578115809@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Peter Geoghegan <pg(at)bowt(dot)ie> writes:
> On Fri, Jan 3, 2020 at 7:06 PM Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
>> No. Also tried setting PG_COLOR="off" and CLICOLOR=0 -- that also
>> didn't help. (This was based on possibly-relevant vars that "env"
>> showed were set).

Yeah, that's not terribly surprising, because if I'm reading those
escape sequences correctly they're not about color. They seem to be
just cursor movement and line clearing, according to [1].

What I'm mystified by is why your copy of libreadline is choosing to
do that, rather than just space over to where the word should be printed
which is what every other copy seems to be doing. I have a fresh new
Debian installation at hand, with

$ dpkg -l | grep readline
ii libreadline-dev:amd64 7.0-5 amd64 GNU readline and history libraries, development files
ii libreadline5:amd64 5.2+dfsg-3+b13 amd64 GNU readline and history libraries, run-time libraries
ii libreadline7:amd64 7.0-5 amd64 GNU readline and history libraries, run-time libraries
ii readline-common 7.0-5 all GNU readline and history libraries, common files

and I'm not seeing the failure on it, either with TERM=xterm
or with TERM=xterm-256color. So what's the missing ingredient?

> Removing the single check_completion() test from 010_tab_completion.pl
> that actually fails on my system ("offer multiple table choices")
> fixes the problem for me -- everything else passes.
> I suppose that this means that the problem is in "offer multiple table
> choices" specifically.

I'd hate to conclude that we can't test any completion behavior that
involves offering a list.

If we can't coerce libreadline into being less avant-garde in its
screen management, I suppose we could write a regex to recognize
xterm escape sequences and ignore those. But I'd be happier about
this if I could reproduce the behavior. I don't like the feeling
that there's something going on here that I don't understand.

BTW, it seems somewhat likely that this is less about libreadline
than about its dependency libtinfo. On my machine that's from

ii libtinfo6:amd64 6.1+20181013-2+deb10u2 amd64 shared low-level terminfo library for terminal handling

what about yours?

regards, tom lane

[1] https://www.xfree86.org/current/ctlseqs.html

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2020-01-04 05:38:25 Re: pgsql: Add basic TAP tests for psql's tab-completion logic.
Previous Message Peter Geoghegan 2020-01-04 03:28:55 Re: pgsql: Add basic TAP tests for psql's tab-completion logic.

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2020-01-04 05:38:25 Re: pgsql: Add basic TAP tests for psql's tab-completion logic.
Previous Message Paul A Jungwirth 2020-01-04 05:29:33 Re: range_agg