pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Geoghegan <pg@bowt.ie>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Christoph Berg <myon@debian.org>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: pgsql: Add basic TAP tests for psql's tab-completion logic.
Date: Sat, 04 Jan 2020 15:56:41 -0500
Message-ID: <4659.1578171401@sss.pgh.pa.us> (raw)
In-Reply-To: <CAH2-Wz=4U_qKeLjN2FnLmSON8B5DgpMNXRdR4mLzgZjdpaMfUg@mail.gmail.com>
References: <20200103170226.GB32629@msg.df7cb.de>
	<26339.1578072930@sss.pgh.pa.us>
	<20200103174839.GD32629@msg.df7cb.de>
	<CA+TgmoZsPe_G1ssO6KVPqbMQHDEz=vHPQH1jxaSjpG_QxM7wUg@mail.gmail.com>
	<CAH2-WznPzfWHu8PQwv1Qjpf4wQVPaaWpoO5NunFz9zsYKB4uJA@mail.gmail.com>
	<22669.1578104202@sss.pgh.pa.us>
	<CAH2-WznyU3QxzRr12W_tJAzjwM9qd6bh_ZGx3Xupk3RqE1t72A@mail.gmail.com>
	<25298.1578106280@sss.pgh.pa.us>
	<CAH2-Wzkq4OELzn3yZvuqsPuso5JfSXdaD+yW=1VMz2YpXTBYxA@mail.gmail.com>
	<CAH2-Wzk3xfc53A0KZRe4Xu9TALRU=HSfSVZqx3jBuws08mG-ew@mail.gmail.com>
	<3055.1578115809@sss.pgh.pa.us>
	<CAH2-Wz=CtOruqXPd3naWXNiQ0WvLSFnCDYmSDWy0hKiLrppXDQ@mail.gmail.com>
	<8038.1578119995@sss.pgh.pa.us>
	<CAH2-Wz=f4B9+Ob-51-5z9G8a9LmztNpgo0YbKuTjxus3kFjpCg@mail.gmail.com>
	<9256.1578121229@sss.pgh.pa.us>
	<25739.1578161968@sss.pgh.pa.us>
	<CAH2-WzkHftVLq1BzbJyXtSD0nf7HC8pAa8UYZwvL4nkSOv1x1A@mail.gmail.com>
	<22817.1578167447@sss.pgh.pa.us>
	<CAH2-Wz=4U_qKeLjN2FnLmSON8B5DgpMNXRdR4mLzgZjdpaMfUg@mail.gmail.com>

Peter Geoghegan <pg@bowt.ie> writes:
> FWIW, I find it very surprising that it was possible for the test to
> fail on my workstation/server, without it failing on any buildfarm
> animals.

Yeah, there is still something unexplained about that.  We've so far
failed to pin the blame on either readline version or environment
settings ... but what else could be causing you to get different
results?

For the record, I'm currently running around and trying the attached
(on top of latest HEAD, 60ab7c80b) on the various configurations
I have here.  Could you confirm that it works, or doesn't, in your
environment --- and if it doesn't, what's the output?

			regards, tom lane

Attachments:

  [text/x-diff] unset-TERM-in-tab-completion-test.patch (1.6K, ../4659.1578171401@sss.pgh.pa.us/2-unset-TERM-in-tab-completion-test.patch)
  download | inline diff:
diff --git a/src/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl
index 1dc87b5..ebf603f 100644
--- a/src/bin/psql/t/010_tab_completion.pl
+++ b/src/bin/psql/t/010_tab_completion.pl
@@ -38,14 +38,12 @@ $node->safe_psql('postgres',
 my $historyfile = "${TestLib::log_path}/010_psql_history.txt";
 $ENV{PSQL_HISTORY} = $historyfile;
 
-# Debug investigation
-note "TERM is set to '" . ($ENV{TERM} || "<undef>") . "'";
-
-# Ensure that readline/libedit puts out xterm escapes, not something else.
-$ENV{TERM} = 'xterm';
-
-# regexp to match one xterm escape sequence (CSI style only, for now)
-my $escseq = "(\e\\[[0-9;]*[A-Za-z])";
+# Unset $TERM so that readline/libedit won't use any terminal-dependent
+# escape sequences; that leads to way too many cross-version variations
+# in the output.
+delete $ENV{TERM};
+# Some versions of readline inspect LS_COLORS, so for luck unset that too.
+delete $ENV{LS_COLORS};
 
 # fire up an interactive psql session
 my $in  = '';
@@ -110,12 +108,8 @@ check_completion(
 	"select \\* from my\a?tab",
 	"complete my<tab> to mytab when there are multiple choices");
 
-# some versions of readline/libedit require two tabs here, some only need one.
-# also, some might issue escape sequences to reposition the cursor, clear the
-# line, etc, instead of just printing some spaces.
-check_completion(
-	"\t\t",
-	"mytab$escseq*123( |$escseq)+mytab$escseq*246",
+# some versions of readline/libedit require two tabs here, some only need one
+check_completion("\t\t", "mytab123 +mytab246",
 	"offer multiple table choices");
 
 check_completion("2\t", "246 ",

view thread (64+ messages)  latest in thread

Message-ID: <4659.1578171401@sss.pgh.pa.us>
Permalink:  ../4659.1578171401@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4659.1578171401@sss.pgh.pa.us

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pg@bowt.ie, robertmhaas@gmail.com, myon@debian.org, pgsql-hackers@postgresql.org
  Subject: Re: pgsql: Add basic TAP tests for psql's tab-completion logic.
  In-Reply-To: <4659.1578171401@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox