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.94.2) (envelope-from ) id 1rH5FH-000xGp-Lh for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Dec 2023 16:53:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rH5FG-0030x6-D0 for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Dec 2023 16:53:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rH5FG-0030wy-3W for pgsql-hackers@lists.postgresql.org; Sat, 23 Dec 2023 16:53:02 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rH5FE-00DXKc-B6 for pgsql-hackers@lists.postgresql.org; Sat, 23 Dec 2023 16:53:01 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3BNGquKt1306175; Sat, 23 Dec 2023 11:52:56 -0500 From: Tom Lane To: Andrew Dunstan cc: pgsql-hackers@lists.postgresql.org, Daniel Gustafsson Subject: Re: authentication/t/001_password.pl trashes ~/.psql_history In-reply-to: References: <794610.1703182896@sss.pgh.pa.us> <1136842.1703283096@sss.pgh.pa.us> Comments: In-reply-to Andrew Dunstan message dated "Sat, 23 Dec 2023 08:20:07 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1306173.1703350376.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Sat, 23 Dec 2023 11:52:56 -0500 Message-ID: <1306174.1703350376@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrew Dunstan writes: > On 2023-12-22 Fr 17:11, Tom Lane wrote: >> After studying this some more, my conclusion is that BackgroundPsql.pm >> failed to borrow as much as it should have from 010_tab_completion.pl. >> Specifically, we want all the environment-variable changes that that >> script performed to be applied in any test using an interactive psql. >> Maybe ~/.inputrc and so forth would never affect any other test scripts, >> but that doesn't seem like a great bet. > Looks fine, after reading your original post I was thinking along the > same lines. Thanks for reviewing. > You could shorten this > +    my $history_file = $params{history_file}; > +    $history_file ||= '/dev/null'; > +    $ENV{PSQL_HISTORY} = $history_file; > to just >      $ENV{PSQL_HISTORY} = $params{history_file} || '/dev/null'; OK. I was unsure which way would be considered more readable, but based on your advice I shortened it. regards, tom lane