Re: 001_password.pl fails with --without-readline

Поиск
Список
Период
Сортировка
От Oleg Tselebrovskiy
Тема Re: 001_password.pl fails with --without-readline
Дата
Msg-id d45671ce55b7b0434c620cebf7373d84@postgrespro.ru
обсуждение исходный текст
Ответ на Re: 001_password.pl fails with --without-readline  (Soumya S Murali <soumyamurali.work@gmail.com>)
Ответы Re: 001_password.pl fails with --without-readline
Список pgsql-hackers
Thanks for your patch!

I like your behaviour-based approach more, but I have some questions
about the patch itself

1) There is a comment in query() function:
# We need to match for the newline, because we try to remove it below, 
and
# it's possible to consume just the input *without* the newline. In
# interactive psql we emit \r\n, so we need to allow for that. Also need
# to be careful that we don't e.g. match the echoed \echo command, 
rather
# than its output.

So, originally, checking that the banner is on it's own line is needed
to distiguish \echo $banner and \warn $banner from their output.

It seems that your patch does not distingush them all the time

(taken from query() function with your patch applied)
    my $banner_detect_stdout = qr/\Q$banner\E/;
    my $banner_detect_stderr = qr/(^|\n)\Q$banner\E\r?\n/;

Why do you check stderr for newline but not the stdout?

2) Why did you add /Q/E around the $banner variable? It doesn't
contain any regex metacharacters (in query() function there is
$query_cnt inside of $banner, but it should be substituted by Perl).
Maybe it is really necessary and I just don't get it

-----

While testing and checking, I've made a new patch. It's very
simple and it just checks that there is banner in a string, but
the string doesn't start with \echo or \warn

Maybe it needs some additional comments, but lets decide on which
approach to use

-----

There is also a problem of test src/bin/psql/t/030_pager.pl - it
just doesn't work with --without-readline, all regexes seem to be right
and debug output shows correct data. None of our patches
currently solve it, I'll look into it

-----

Regards,
Oleg
Вложения

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