Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1inqTZ-0007Ns-SW for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jan 2020 20:56:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1inqTY-0003nR-7x for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jan 2020 20:56:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1inqTX-0003nK-Rf for pgsql-hackers@lists.postgresql.org; Sat, 04 Jan 2020 20:56:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1inqTV-0003YC-9z for pgsql-hackers@postgresql.org; Sat, 04 Jan 2020 20:56:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 004KufKU004660; Sat, 4 Jan 2020 15:56:41 -0500 From: Tom Lane To: Peter Geoghegan cc: Robert Haas , Christoph Berg , PostgreSQL Hackers Subject: Re: pgsql: Add basic TAP tests for psql's tab-completion logic. In-reply-to: References: <20200103170226.GB32629@msg.df7cb.de> <26339.1578072930@sss.pgh.pa.us> <20200103174839.GD32629@msg.df7cb.de> <22669.1578104202@sss.pgh.pa.us> <25298.1578106280@sss.pgh.pa.us> <3055.1578115809@sss.pgh.pa.us> <8038.1578119995@sss.pgh.pa.us> <9256.1578121229@sss.pgh.pa.us> <25739.1578161968@sss.pgh.pa.us> <22817.1578167447@sss.pgh.pa.us> Comments: In-reply-to Peter Geoghegan message dated "Sat, 04 Jan 2020 12:46:30 -0800" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <4600.1578171372.0@sss.pgh.pa.us> Date: Sat, 04 Jan 2020 15:56:41 -0500 Message-ID: <4659.1578171401@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4600.1578171372.1@sss.pgh.pa.us> Peter Geoghegan 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 ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="unset-TERM-in-tab-completion-test.patch"; charset="us-ascii" Content-ID: <4600.1578171372.2@sss.pgh.pa.us> Content-Description: unset-TERM-in-tab-completion-test.patch Content-Transfer-Encoding: quoted-printable 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 =3D "${TestLib::log_path}/010_psql_history.txt"; $ENV{PSQL_HISTORY} =3D $historyfile; = -# Debug investigation -note "TERM is set to '" . ($ENV{TERM} || "") . "'"; - -# Ensure that readline/libedit puts out xterm escapes, not something else= . -$ENV{TERM} =3D 'xterm'; - -# regexp to match one xterm escape sequence (CSI style only, for now) -my $escseq =3D "(\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 =3D ''; @@ -110,12 +108,8 @@ check_completion( "select \\* from my\a?tab", "complete my 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 ", ------- =_aaaaaaaaaa0--