Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vfwIz-006GO6-37 for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Jan 2026 08:32:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vfwIz-008uhc-0Z for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Jan 2026 08:32:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vfwIy-008uhT-25 for pgsql-hackers@lists.postgresql.org; Wed, 14 Jan 2026 08:32:41 +0000 Received: from mail.postgrespro.ru ([93.174.132.70]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vfwIv-000LZx-08 for pgsql-hackers@postgresql.org; Wed, 14 Jan 2026 08:32:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1768379554; bh=l+oES3mJui1W4Ufxj7R6SWidpZpqDTzAW9pkwzjSnAU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:Message-ID:From; b=g/GJvz5RVX8bOq4aMQCOaLjEZwnvrgHkBr9n+K5jkuzaBpDtsR2llXoMk9vvjhCPk gLMYcmbg/i8h4EmgMhPTDXDM824BzgxJzHs046oIr0pN8fNcMWwbtSUX5ktP9gGx8u eBHR0SNvt70GAn7ep6DI5rkKQxYSsQL0f8JFr+M4hw09BYRaeeKRBpV6Oi8WP8ogFQ +7OkbEBnjN7+NVUyyRBQ/2q5KSyCOLJHVOmtucJpo7qhZ46pqIAt57FJWZL3l/+CZ3 qIB5W/Pv7JfNLL9Of/FrmdSyn+EPABx4uGDWQaXY3nCSxp8/WoDrB/b8zYfM48NNjR IQcZ32x8CrvPw== Received: from mail.postgrespro.ru (webmail-slave-mstn.l.postgrespro.ru [192.168.2.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: o.tselebrovskiy@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id AC5D060758; Wed, 14 Jan 2026 11:32:34 +0300 (MSK) MIME-Version: 1.0 Date: Wed, 14 Jan 2026 15:32:34 +0700 From: Oleg Tselebrovskiy To: Soumya S Murali Cc: pgsql-hackers@postgresql.org Subject: Re: 001_password.pl fails with --without-readline In-Reply-To: References: Message-ID: X-Sender: o.tselebrovskiy@postgrespro.ru Organization: Postgres Pro Content-Type: multipart/mixed; boundary="=_6fc6c62826e9920c856c3f12f05a91b9" X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2026/01/14 06:17:00 #28113283 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=_6fc6c62826e9920c856c3f12f05a91b9 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed 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 --=_6fc6c62826e9920c856c3f12f05a91b9 Content-Transfer-Encoding: base64 Content-Type: text/x-diff; name=v2-0001-background-psql-without-readline.patch Content-Disposition: attachment; filename=v2-0001-background-psql-without-readline.patch; size=1206 ZGlmZiAtLWdpdCBhL3NyYy90ZXN0L3BlcmwvUG9zdGdyZVNRTC9UZXN0L0JhY2tncm91bmRQc3Fs LnBtIGIvc3JjL3Rlc3QvcGVybC9Qb3N0Z3JlU1FML1Rlc3QvQmFja2dyb3VuZFBzcWwucG0KaW5k ZXggNWJkNDFhMjc4ZGQuLjFhNzdlYWU4ZDg0IDEwMDY0NAotLS0gYS9zcmMvdGVzdC9wZXJsL1Bv c3RncmVTUUwvVGVzdC9CYWNrZ3JvdW5kUHNxbC5wbQorKysgYi9zcmMvdGVzdC9wZXJsL1Bvc3Rn cmVTUUwvVGVzdC9CYWNrZ3JvdW5kUHNxbC5wbQpAQCAtMTU1LDExICsxNTUsMTEgQEAgc3ViIHdh aXRfY29ubmVjdAogCSMKIAkjIFNlZSBxdWVyeSgpIGZvciBkZXRhaWxzIGFib3V0IHdoeS9ob3cg dGhlIGJhbm5lciBpcyB1c2VkLgogCW15ICRiYW5uZXIgPSAiYmFja2dyb3VuZF9wc3FsOiByZWFk eSI7Ci0JbXkgJGJhbm5lcl9tYXRjaCA9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