Re: pgsql: Add basic TAP tests for psql's tab-completion logic.
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Christoph Berg <myon@debian.org>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2020-01-03T13:52:57Z
Lists: pgsql-hackers
Christoph Berg <myon@debian.org> writes: > Re: Tom Lane 2020-01-02 <E1in6ft-0004zR-6l@gemulon.postgresql.org> >> Add basic TAP tests for psql's tab-completion logic. > The \DRD test fails on Debian/unstable: Indeed. It appears that recent libedit breaks tab-completion for words involving a backslash, which is the fault of this upstream commit: http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit/filecomplete.c.diff?r1=1.52&r2=1.53 Basically what that's doing is applying de-backslashing to EVERY word that completion is attempted on, whether it might be a filename or not. So what psql_complete sees in this test case is just "DRD" which of course it does not recognize as a possible psql backslash command. I found out while investigating this that the libedit version shipping with buster (3.1-20181209) is differently broken for the same case: instead of inapproriate forced de-escaping of the input of the application-specific completion function, it applies inapproriate forced escaping to the output of said function, so that when we see "\DRD" and return "\drds", what comes out to the user is "\\drds". libedit apparently needs a regression test suite even worse than we do. I was kind of despairing of fixing this last night, but in the light of morning it occurs to me that there's a possible workaround for the de-escape bug: we could make psql_completion ignore the passed "text" string and look at the original input buffer, as get_previous_words() is already doing. I don't see any way to dodge buster's bug, though. regards, tom lane
Commits
-
Skip tab-completion tests if envar SKIP_READLINE_TESTS is defined.
- e7ee433137b6 13.0 landed
-
Minor style improvements for tab-completion test.
- 8c081a2f4e8e 13.0 landed
-
Avoid reading ~/.inputrc in tab-completion test, and revert other changes.
- 48e03583cd37 13.0 landed
-
Don't try to force TERM to a fixed value in tab-completion test.
- 7e42478186aa 13.0 landed
-
In tab-completion test, print out the value of TERM before changing it.
- 60ab7c80b4de 13.0 landed
-
Make tab-completion tests more robust.
- fac1c04feca6 13.0 landed
-
Further fixes for tab-completion TAP tests.
- 56a3921a2f51 13.0 landed
-
Add an ugly workaround for a bug in some recent libedit versions.
- ddd87d564508 13.0 landed
-
Add basic TAP tests for psql's tab-completion logic.
- 7c015045b914 13.0 cited
-
Fix running out of file descriptors for spill files.
- d20703805383 13.0 cited