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 1iilo5-0007Rn-Eg for pgsql-bugs@arkaria.postgresql.org; Sat, 21 Dec 2019 20:57:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iilo4-0007OJ-73 for pgsql-bugs@arkaria.postgresql.org; Sat, 21 Dec 2019 20:57:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iilPs-00075R-T6 for pgsql-bugs@lists.postgresql.org; Sat, 21 Dec 2019 20:32:01 +0000 Received: from mpv2-2015.cwru.edu ([129.22.103.227] helo=mpv1-2015.case.edu) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iilPk-0005XV-KE for pgsql-bugs@lists.postgresql.org; Sat, 21 Dec 2019 20:31:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1576960312; bh=V7cc+6QXrVnec2qv1RouEbZzNgbcnkvgsVMXdv8cXHI=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=HawQ6mjE5/oNsJH4C6cz3Dk0bft2FiuFtZ1rU0w8f7ojRb/KNnJasQORyt5+36q5UO DF8F7i0j5nX2OlDi5DPGQEelXQmSMrt/zdxVFFraKGFMNeTXkbfzMBpy7slIhNoUpLu ECF2/mG0EQyBw4FDJSLOuhte3o100tcjhyAnXrrpsHgS9uszJBFFhUS/8crGAQ2luz8 FanGh64biBTGKJqefskDW0cSt/fqjBn6aPDLX8zVe2epzX+dVOYlJechg475W1Eun0P VPS78r9L/zajqXqoPdyIWQAVfkLRK28/Z/dho9JZTHwpqGCqFr5yCoNOezafGGR5b85 ini9oIwg== Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202]) by mpv2-2015.case.edu (MOS 4.4.8-GA FastPath queued) with ESMTP id BDG61718; Sat, 21 Dec 2019 15:31:50 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1576960310; bh=RWMb9aOsLRwQU9I81Szau5zp538hwv2MBzcZB9NqW7E=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=VY9IUHoXYl4RL2gKnz6WHTXdxFfpPqrmuWE/vL58y3oFyHIccf/ggX0LWBWid4ViaB TxgUlQ13e1MINyOYpoBG/JeyOjEgog44ATMdrDiRy6j3xuEllnCFn6L+kzjXrOtSXrA MdpTQJxxmHKiYjA6TIRojPMRXf15B/ve/fmonjoRytb7fD6xU8waIZwXUnxxrWShGrH FjJAzQ1AE4FmnUzY4GEOpn2/ZLxFT7SofV8rBynOfQk+0V1uqS96dZ99LbmpKacCxwT Z2AjyqiHJ2vK0IMkGxZbkFmNEaajFmxNyk5nIm31lSZnWsJMQDR9YuyC9a6Tv/oSP28 vSlxrjpg== Received: from mail-yw1-f70.google.com (EHLO mail-yw1-f70.google.com) ([209.85.161.70]) by mpv6-2015.case.edu (MOS 4.4.8-GA FastPath queued) with ESMTP id DDF20887; Sat, 21 Dec 2019 15:31:50 -0500 (EST) Received: by mail-yw1-f70.google.com with SMTP id v126so9807044ywf.7 for ; Sat, 21 Dec 2019 12:31:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=g-case; h=reply-to:cc:subject:to:references:from:autocrypt:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=RWMb9aOsLRwQU9I81Szau5zp538hwv2MBzcZB9NqW7E=; b=BDxRVa10ypnRDNq9asOu6mRCPNJJlPcoALOAVU4cpmaes0qEpsY3sd8LavWGhXXirJ /2a6kFpXJGieDIc4ON1wtGG4b0vE1GmohytPpM/tljPJymkj9jZpcElsQN8LlQqvJo2Y WXnbcFQ4B5B0Q6Dd2LeVykw8tygDAVuG9AnT/nbks0exLhmM8w+ob/huvVzz5/mjwZiQ LHfo72yBwm6LuJKXbr2h1NK9jnanNLvBxSeBotNqTZji1td4OV0Eydqe9Dqf9zcgdg8C UOb9u9I572Ni5ttlHQLd5mHHjKJ+ftNyEiM4+6u7BYWO8cY0Vor5w6Z7Fc8sV4IaANIX yaQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:cc:subject:to:references:from:autocrypt :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=RWMb9aOsLRwQU9I81Szau5zp538hwv2MBzcZB9NqW7E=; b=tg7e10CO9c/EDlywYRWcs86L4hJXGsE/cb340ksNU00ND3MOCOfVQtg+3JukHByY/e tJeWieXSXC7YMed7xJZ3UPYu+KfOpxp1RYqkXWuBFFHf3IXmXxxAhcC2Fdk+XMndjCe2 4G6NS1/NAMp0i/RHE9uvG7hSTR19/B2M0ptMF/o3dXsYyVm3S9SbKGnfJDlpeUnr0UV3 bHvakGKtOe466qjW64fUpLpLuJO74TxZntARyjY6/5eJbQUDinSf+PAjv2yk3O5QYmZZ oMQNpGnSKrUVFscJ4zVY2ITwXgcmE8hgk/JY3AHZESP36RTqjC+Sp3MOQ9dby5JJIHwD /tlw== X-Gm-Message-State: APjAAAWiCVbLCbzJX5CUXkwpvSJQaamf7ZqmtUe1z2lA9bW0CE7d09nH sfiQP2gs5US2tZS9NjnUYGGWBsHaK4j9cOAZIUQrI24pgOnwH+oKr1a9oHc1x51z65zUyWUu8yJ 5XhjConmZnUWoHYZWywmS9FRHp05oqi4= X-Received: by 2002:a81:2e01:: with SMTP id u1mr16000820ywu.512.1576960309575; Sat, 21 Dec 2019 12:31:49 -0800 (PST) X-Google-Smtp-Source: APXvYqxNVLWCFbrCTiEKFZuMcAAfVbY5+jE5wT6xbbceJIxdO8ZyGDzDeE9aiGszoj+JqnNglY74zA== X-Received: by 2002:a81:2e01:: with SMTP id u1mr16000796ywu.512.1576960309186; Sat, 21 Dec 2019 12:31:49 -0800 (PST) Received: from ?IPv6:2605:a000:1223:c4ad:d49a:a3a5:6c7f:5415? ([2605:a000:1223:c4ad:d49a:a3a5:6c7f:5415]) by smtp.gmail.com with ESMTPSA id h68sm5603671ywe.21.2019.12.21.12.31.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 21 Dec 2019 12:31:48 -0800 (PST) Reply-To: chet.ramey@case.edu Cc: chet.ramey@case.edu, pgsql-bugs@lists.postgresql.org Subject: Re: psql: Buggy interactions with wraparound in maximized gnome terminals. To: Tomas Zubiri , bug-readline@gnu.org References: <10264.1576876915@sss.pgh.pa.us> From: Chet Ramey Autocrypt: addr=chet.ramey@case.edu; prefer-encrypt=mutual; keydata= mQGiBEEOsGwRBACFa0A1oa71HSZLWxAx0svXzhOZNQZOzqHmSuGOG92jIpQpr8DpvgRh40Yp AwdcXb8QG1J5yGAKeevNE1zCFaA725vGSdHUyypHouV0xoWwukYO6qlyyX+2BZU+okBUqoWQ koWxiYaCSfzB2Ln7pmdys1fJhcgBKf3VjWCjd2XJTwCgoFJOwyBFJdugjfwjSoRSwDOIMf0D /iQKqlWhIO1LGpMrGX0il0/x4zj0NAcSwAk7LaPZbN4UPjn5pqGEHBlf1+xDDQCkAoZ/VqES GZragl4VqJfxBr29Ag0UDvNbUbXoxQsARdero1M8GiAIRc50hj7HXFoERwenbNDJL86GPLAQ OTGOCa4W2o29nFfFjQrsrrYHzVtyA/9oyKvTeEMJ7NA3VJdWcmn7gOu0FxEmSNhSoV1T4vP2 1Wf7f5niCCRKQLNyUy0wEApQi4tSysdz+AbgAc0b/bHYVzIf2uO2lIEZQNNt+3g2bmXgloWm W5fsm/di50Gm1l1Na63d3RZ00SeFQos6WEwLUHEB0yp6KXluXLLIZitEJLQwQ2hldCBSYW1l eSAoQ2FzZSBzdGFuZGFyZCkgPGNoZXQucmFtZXlAY2FzZS5lZHU+iF8EExECAB8FAkPi19EC GwMHCwkIBwMCAQMVAgMDFgIBAh4BAheAAAoJELtYafBk6nSrelkAn31Gsuib7GcCZHbv5L5t VKYR9LklAJ4hzUHKA49Z0QXR+qCb80osIcmPSbkBDQRBDrBvEAQAkK6TAOKBEM+EC4j6V/7o /riVZqcgU5cid2qG9TXdwNtD9a3kvA/ObZBO93sX59wc6Bnwo4VJxsOmMlpGrAjJsxNwg3QH akEtf8LXRbVpj5xStdmBdQZUhIQyalo/2/TZq5OijtddUQcL5cs70hTv/FpT3wUvr2Xr8rjF 41IFEz8AAwcD/A0CZEGlzIrT5WCBnl6xBog/8vKiUCbarByat3d1mL6DbizvKNXQRTC9E/vE dENAWCQCjr75Bu55xT8n3SXGtWdDC5xmZ/P3OBYORP8yl8H8I1FIosWOFirbIeYdZPq8SPD1 HL+EXo9zSiHVrrZRJ19ooCKKbSdXHFCY+aJG+0KZiEkEGBECAAkFAkEOsG8CGwwACgkQu1hp 8GTqdKvjcACfZlkVCDwaz/NTO9cy3t69oWpVPNwAnRwe0qk/WL/gfhH346xh5B3HFbFN Organization: ITS, Case Western Reserve University Message-ID: Date: Sat, 21 Dec 2019 15:31:46 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Junkmail-Status: score=8/90, host=mpv2-2015.case.edu X-Junkmail-PrAS-Raw: score=8/90, refid=2.7.2:2019.12.21.200916:17:8.317, ip=, rules=__YOUTUBE_RCVD, DKIM_SIGNATURE, __X_GOOGLE_DKIM_SIGNATURE, __HAS_REPLYTO, __HAS_CC_HDR, __MULTIPLE_RCPTS_CC_X2, __SUBJ_REPLY, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC, __HAS_REFERENCES, __REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA, __USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN, __DKIM_ALIGNS_1, __DKIM_ALIGNS_2, __ANY_URI, __URI_MAILTO, __HTTPS_URI, __URI_WITH_PATH, __URI_NO_WWW, __CP_MEDIA_BODY, ECARD_KNOWN_DOMAINS, __CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE, __MULTIPLE_URI_TEXT, __URI_IN_BODY, __URI_NOT_IMG, __MAIL_CHAIN, __FORWARDED_MSG, __BODY_NO_MAILTO, __NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS, [TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/20/19 4:48 PM, Tomas Zubiri wrote: > Ok, makes sense. Since psql depends on readline, I'm adding their bug > mailing list to the loop, and reposting the original bug report: > > 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). I'll look at little more at something that doesn't modify the readline signal handling defaults and see if I can reproduce it. > > I'm using ubuntu 18.04, the terminal is Gnome Terminal 3.28.2 > > Below is a short video showcasing the issue. I thought I had muted my > mic, but apparently I didn't, please enjoy my nation's anthem while > observing said bug. I did enjoy it. :-) > > https://drive.google.com/file/d/1Xdj96v2StfM9E7HuM5NOsnOVssjw5fcg/view?usp=drive_web > > Additionally, while researching this bug, I found a reproducible > variation of this bug: > > 1- Open a terminal at a normal size. > 2- Write enough characters so that they correctly wrap around into a new line. > 3- Maximize the window > 4- Minimize it again > > You will find that the command is visibly duplicated. Again this is > aesthetic, the command is not duplicated when it's sent to the server. This one's easy to explain. By the time readline's SIGWINCH handler is called, the terminal has already wrapped and redisplayed the text, leaving the cursor at the end of the text on the second line. Readline has no way of knowing this, and performs a full redisplay. This involves moving to column 0 of what it thinks is the first screen line of the current line being entered (it thinks that is line 0, since it doesn't know what the terminal has done and, as far as it knows, the line isn't wrapped), clearing the line, and performing a full redisplay including reprinting the prompt. That obviously leaves the other lines, the ones the terminal wrapped before sending SIGWINCH, visible on the screen. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/