Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iimWI-00018G-RA for pgsql-bugs@arkaria.postgresql.org; Sat, 21 Dec 2019 21:42:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iimVJ-0004wr-8R for pgsql-bugs@arkaria.postgresql.org; Sat, 21 Dec 2019 21:41:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iimVJ-0004wk-0N for pgsql-bugs@lists.postgresql.org; Sat, 21 Dec 2019 21:41:41 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iimVC-0002Xr-Hx for pgsql-bugs@lists.postgresql.org; Sat, 21 Dec 2019 21:41:40 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xBLLeTC5026176; Sat, 21 Dec 2019 16:40:29 -0500 From: Tom Lane To: chet.ramey@case.edu cc: Tomas Zubiri , bug-readline@gnu.org, pgsql-bugs@lists.postgresql.org Subject: Re: psql: Buggy interactions with wraparound in maximized gnome terminals. In-reply-to: References: <10264.1576876915@sss.pgh.pa.us> Comments: In-reply-to Chet Ramey message dated "Sat, 21 Dec 2019 15:31:46 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26174.1576964429.1@sss.pgh.pa.us> Date: Sat, 21 Dec 2019 16:40:29 -0500 Message-ID: <26175.1576964429@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Chet Ramey writes: > On 12/20/19 4:48 PM, Tomas Zubiri wrote: >> This is probably hard to reproduce, but I entered a state where the >> command I was writing was wrapping around at the 81st character while >> in full screen, and the 1st character was being overwritten.This did >> not affect the command sent to the server, but I would not have a way >> to see what command I just entered. > It seems like the readline SIGWINCH handler, which causes it to update its > idea of the screen dimensions, isn't being called. I can't reproduce this > using readline and bash, and I don't know what postgres does with its > signal handling, or how it configures readline's signal handling (I assume > it doesn't do anything special). We don't touch SIGWINCH at all, so if readline sets up a handler for that, it ought to behave as expected. I notice though that we do this just before each readline() call: /* * Some versions of readline don't notice SIGWINCH signals that arrive * when not actively reading input. The simplest fix is to always * re-read the terminal size. This leaves a window for SIGWINCH to be * missed between here and where readline() enables libreadline's * signal handler, but that's probably short enough to be ignored. */ #ifdef HAVE_RL_RESET_SCREEN_SIZE rl_reset_screen_size(); #endif Is it conceivable that that bollixes things somehow, on some builds? (I don't think the OP specified which readline and/or Postgres version he was using.) regards, tom lane