aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-01-04 21:33:34 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2020-01-04 21:33:34 -0500
commit48e03583cd373ce67827f4d8a99dcef8242364b0 (patch)
treeb8e2af368fceedf4da59955688ca4d32f8f86be4 /src
parent7e42478186aa8b41a8706f3f53b44e25a427bde9 (diff)
downloadpostgresql-48e03583cd373ce67827f4d8a99dcef8242364b0.tar.gz
postgresql-48e03583cd373ce67827f4d8a99dcef8242364b0.zip
Avoid reading ~/.inputrc in tab-completion test, and revert other changes.
The true explanation for Peter Geoghegan's trouble report turns out to be that he has a ~/.inputrc that affects readline's behavior enough to break this test. Prevent readline from reading that file. Also, the best way to prevent TERM from affecting the results seems to be to unset it altogether, not to set it to "xterm". The latter choice licenses readline to emit xterm escape sequences, and there's a lot of variation in exactly what it will emit. Revert changes that attempted to account exactly for xterm escape sequences. We shouldn't need that with TERM unset, and it was not looking like a maintainable solution anyway. Discussion: https://postgr.es/m/23181.1578167938@sss.pgh.pa.us
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/t/010_tab_completion.pl24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl
index 0f1d596b2bf..9cfd7ec79c7 100644
--- a/src/bin/psql/t/010_tab_completion.pl
+++ b/src/bin/psql/t/010_tab_completion.pl
@@ -38,11 +38,17 @@ $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>") . "'";
-
-# regexp to match one xterm escape sequence (CSI style only, for now)
-my $escseq = "(\e\\[[0-9;]*[A-Za-z])";
+# Another pitfall for developers is that they might have a ~/.inputrc
+# file that changes readline's behavior enough to affect this test.
+# So ignore any such file.
+$ENV{INPUTRC} = '/dev/null';
+
+# 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 = '';
@@ -107,12 +113,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 ",