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 1inpS1-0005lo-FX for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jan 2020 19:51:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1inpRy-0001Nc-U7 for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jan 2020 19:51:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1inpRy-0001NV-LG for pgsql-hackers@lists.postgresql.org; Sat, 04 Jan 2020 19:51:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1inpRs-0000Mo-2K for pgsql-hackers@postgresql.org; Sat, 04 Jan 2020 19:51:05 +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 004JolVp022818; Sat, 4 Jan 2020 14:50:47 -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> Comments: In-reply-to Peter Geoghegan message dated "Sat, 04 Jan 2020 10:38:49 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <22816.1578167447.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 04 Jan 2020 14:50:47 -0500 Message-ID: <22817.1578167447@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter Geoghegan writes: > On Sat, Jan 4, 2020 at 10:19 AM Tom Lane wrote: >> Looking closer, I see that your actual output included *both* >> spaces and escape sequences between the table names, so it >> needs to be more like the attached. > This patch makes the tests pass. Thanks! Ah, good. Pushed. >> So now I'm thinking again that there must be something about >> your colorized setup that triggers use of at least the first one. >> But why didn't clearing the relevant environment variables >> change anything? > I don't know. It also failed with bash, which doesn't have any of that s= tuff. I got another data point just now. I was experimenting with a proposed fix for the current libedit problem [1], so I needed to build libedit from source, and the path of least resistance was to do so on my RHEL6 workstation. I find that that conglomeration fails the current 010_tab_completion.pl tests, even with this patch, with symptoms like not ok 2 - complete SEL to SELECT # Failed test 'complete SEL to SELECT' # at t/010_tab_completion.pl line 91. # Actual output was "postgres=3D# SEL\a\r\e[15GECT " and similarly in a couple other tests. I know where the bell (\a) is coming from: there's a different logic bug in libedit that causes it to do el_beep() even when there's a unique completion. But why the unnecessary cursor repositioning? Looking closer, I realize that libedit on this software stack is depending on libtinfo.so.5 =3D> /lib64/libtinfo.so.5 (0x00007fa39a5e2000) which is from $ rpm -qf /lib64/libtinfo.so.5 ncurses-libs-5.7-4.20090207.el6.x86_64 Seeing that you're also having issues with a stack involving libtinfo.so.5, here's my theory: libtinfo version 5 is brain-dead about whether it needs to issue cursor repositioning commands, and tends to do so even when the cursor is in the right place already. Version 6 fixed that, which is why we're not seeing these escape sequences on any of the libedit-using buildfarm critters. So we're going to have to make some decisions about what range of libedit builds we want to cater for in the tab-completion tests. Given that the plan is to considerably increase the coverage of those tests, I'm hesitant to promise that we'll keep passing with anything that isn't explicitly tested in the buildfarm, or by active developers such as yourself. Maybe that's fine given that end users probably don't run the TAP tests. It would likely help if we could constrain the behavior to avoid variations such as colorization, which is why I'm concerned that we don't seem to have figured out how to turn that off in your setup. I think that bears more investigation, even though we've managed to work around it for the moment. regards, tom lane [1] http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=3D54510