authentication/t/001_password.pl trashes ~/.psql_history

Поиск
Список
Период
Сортировка
От Tom Lane
Тема authentication/t/001_password.pl trashes ~/.psql_history
Дата
Msg-id 794610.1703182896@sss.pgh.pa.us
обсуждение исходный текст
Ответы Re: authentication/t/001_password.pl trashes ~/.psql_history  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I happened to notice this stuff getting added to my .psql_history:

\echo background_psql: ready
SET password_encryption='scram-sha-256';
;
\echo background_psql: QUERY_SEPARATOR
SET scram_iterations=42;
;
\echo background_psql: QUERY_SEPARATOR
\password scram_role_iter
\q

After grepping for these strings, this is evidently the fault of
src/test/authentication/t/001_password.pl by way of BackgroundPsql.pm,
which fires up an interactive psql run that is not given the -n switch.

Currently the only other user of interactive_psql() seems to be
psql/t/010_tab_completion.pl, which avoids this problem by
explicitly redirecting the history file.  We could have 001_password.pl
do likewise, or we could have it pass the -n switch, but I think we're
going to have this problem resurface repeatedly if we leave it to the
outer test script to remember to do it.

My first idea was that BackgroundPsql.pm should take responsibility for
preventing this, by explicitly setting $ENV{PSQL_HISTORY} to "/dev/null"
if the calling script hasn't set some other value.  However, that could
fail if the user who runs the test habitually sets PSQL_HISTORY.

A messier but safer alternative would be to supply the -n switch by
default, with some way for 010_tab_completion.pl to override that.

Thoughts?

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Functions to return random numbers in a given range
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Avoid computing ORDER BY junk columns unnecessarily