Re: 001_password.pl fails with --without-readline
Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>
From: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>
To: Soumya S Murali <soumyamurali.work@gmail.com>
Cc: pgsql-hackers@postgresql.org
Date: 2026-01-14T08:32:34Z
Lists: pgsql-hackers
Attachments
- v2-0001-background-psql-without-readline.patch (text/x-diff) patch v2-0001
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
Commits
-
Make psql/t/030_pager.pl more robust.
- 6918434a4acb 19 (unreleased) landed
-
Improve guards against false regex matches in BackgroundPsql.pm.
- fc84b3977e20 14.21 landed
- f356e2888cdb 17.8 landed
- bb6aedeca8d4 15.16 landed
- a1d7ae2b2e38 19 (unreleased) landed
- 92b3cc5a28f1 18.2 landed
- 6548e4a10d18 16.12 landed
-
Fix unsafe pushdown of quals referencing grouping Vars
- 34740b90bc12 19 (unreleased) cited
-
tests: BackgroundPsql: Fix potential for lost errors on windows
- 8b886a4e3488 18.0 cited