From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 18448 invoked from network); 3 Jan 2024 10:04:03 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 3 Jan 2024 10:04:03 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1704276243; b=qVOtwo/HL/OJH4yuVgI/rcwhG0NFbSmY414dDsKUd94xNAF93ta5/D9z/j2HJRKkcmWfOCQD6b FXvcmTDtfCTnWmig4GosllUyIGyD/Gvi8jPfKvP4SIpT9vPCud6JnLx2U7MQNh9m+JXBLXxFzW wVDXTZSog5tW0jRLIgbdHwT7soy3MRpVQLWdNn2gK2ugczMI9qKyjixlFJOOK9wwX6XD65B8i7 FH6uVITzvKUbhVKJ/98vHuYUx7HgjfXM37MHKz311muHroZubjzXofs7PfSvguM37heidGnCqh Z5LL2dSrZVAFprqWBgSu0fKWxd7MV9erkblwzGjzTcdmVg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (csmtpq2-prd-nl1-vmo.edge.unified.services) smtp.remote-ip=84.116.50.37; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1704276243; bh=cbkiIEf6qRHIsgL9L9HfTfXZzHb3uykwKc6mcK8sfqA=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject: References:In-Reply-To:Message-ID:To:From:Date:DKIM-Signature: DKIM-Signature; b=mO+zZZAjj/TCxLSGMu4YEhHKP+D1SvsQhmZWfOetc4PpC/LU66AqN/koOBlCde/n8ta36FnOYf rSlGyfGuwbmgLI24YWbkYTIcEJohPVVIx0aYh4LaanQjCocYxm4U8c6ayzdyL2YHx615CmIGAU JIMy3ApSkg8YVtT9kI78TMbCAi18gjMFj14/qR4HiBllx9LH+zDUhdQmgftg2DniQ6utCkxCb3 Dp9gI56gEEcWUtMds825UUk2O8WgZ9EIvZgGMMPhoSjmPSrZ2ITzZBr3IOB2hjn/Jl5J0uVNR4 mo9gVmg5SNqT0TfDtwymoSIgstPuPY2+ryOHACK3e9I0CA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:References:In-Reply-To:Message-ID:To:From: Date:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=ejdNp1IZ/T9E848d944w0AU4Q0gRlgDlxFG25p8ZHq0=; b=it6ElHWCHZgATsMCKtpwMbLf6W pVcoscgr6arGKQa6XYwhzjRSCHrZsAi9ol4Yjj/CRKjuE0VsGIUF6wDtRcwIoyi3NEj9ue2c/5tfy ErYDWc2z0qUuF8H8cTYQtxthRtPk7qr3GBsISCWsIiSxvsg+kLhMt7go+g1zHvG+nqsFgrfWm/p7A 6d97EnHe+HfYy1gwAW0TJSQrVxqXduJk99BkOoyjH3GxmJKa0It0jb+FOGu4SMCHQqhp30cqPvLP4 F8R9EeNwKfjEK30hFUoWPsYLH9eAvPaEGWfnGKdiTWWTAZYget+fukKcaO/OObtzDTyeTc0qVkbEw kvWFhnmQ==; Received: by zero.zsh.org with local id 1rKy6V-000BdB-0g; Wed, 03 Jan 2024 10:04:03 +0000 Authentication-Results: zsh.org; iprev=pass (csmtpq2-prd-nl1-vmo.edge.unified.services) smtp.remote-ip=84.116.50.37; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none Received: from csmtpq2-prd-nl1-vmo.edge.unified.services ([84.116.50.37]:13701) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1rKy6D-000BJk-9Z; Wed, 03 Jan 2024 10:03:46 +0000 Received: from oxsmtp1-prd-nl1-vmo.nl1.unified.services ([100.107.83.138]) by csmtpq2-prd-nl1-vmo.edge.unified.services with esmtp (Exim 4.93) (envelope-from ) id 1rKy6C-006p22-K0 for zsh-workers@zsh.org; Wed, 03 Jan 2024 11:03:44 +0100 Received: from oxbe20-prd-nl1-vmo.nl1.unified.services ([100.107.83.148]) by oxsmtp1-prd-nl1-vmo.nl1.unified.services with ESMTP id Ky6CrPgXGAJLeKy6CrJaEu; Wed, 03 Jan 2024 11:03:44 +0100 X-Env-Mailfrom: p.w.stephenson@ntlworld.com X-Env-Rcptto: zsh-workers@zsh.org X-SourceIP: 100.107.83.148 X-CNFS-Analysis: v=2.4 cv=Y9r+sAeN c=1 sm=1 tr=0 ts=65953100 cx=a_exe a=lPMsK0r267pD4NSZ8pve9w==:117 a=IvlwODmuRu4A:10 a=IkcTkHD0fZMA:10 a=q2GGsy2AAAAA:8 a=NLZqzBF-AAAA:8 a=q34bkTyjAAAA:8 a=drtJZRh4V3uW6L3SHucA:9 a=QEXdDO2ut3YA:10 a=HbQOABYz3jhqdZF7JfnK:22 a=z9dJwno5l634igLiVhy-:22 a=c10cvU6awwLw48PoI_dg:22 X-Authenticated-Sender: p.w.stephenson@ntlworld.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ntlworld.com; s=meg.feb2017; t=1704276224; bh=cbkiIEf6qRHIsgL9L9HfTfXZzHb3uykwKc6mcK8sfqA=; h=Date:From:To:In-Reply-To:References:Subject; b=FGLZ7BFUsJSR9kIR0ZdUwsQVNYxT5MK9vTcsNyMEQfi3BeiKltwGPDy7feoMikQuD X7xfaa8XFuNhkSH0TfuLUJcxAaREYxxfsBjPz849l/c5Xn8LWDEL2f1bP4rXALSQJP v/CIK8RbnAuGEQRW4FrdOTcVie+9zXSoRTZIjTbWrghJp33xAGzKoL6WHfbc0Oq24h er7wDOKMTGrmIm9wUVv1yr8pS5X1BhZHjPpi6ozxxdUrUJUgZtIbWdgoluT1Z1MXJB O6NOT+jNaz8JfTqSfyWxYp79bsp3FZpksK1BDM9WHvLz5JfTizzHo7TW9JVyzhQ225 9ZkeJKxAfeFOg== Date: Wed, 3 Jan 2024 10:03:44 +0000 (GMT) From: Peter Stephenson To: zsh-workers@zsh.org Message-ID: <76537568.1773778.1704276224582@mail.virginmedia.com> In-Reply-To: References: <817638116.1728541.1704215102364@mail.virginmedia.com> Subject: Re: Regression: 'read -s' does not disable echo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer X-Originating-IP: 147.161.224.196 X-Originating-Client: open-xchange-appsuite X-CMAE-Envelope: MS4xfCvu/smFUNahL243bvpfKfK2VYaP4vp7splUHTPmGw9Wcs3n7rayOjFOGX92oY8g8p8ejP8thvryuBJbC9lBJhTXf8iQ2xW1maMFAH9cJNbwG1LRmSS4 XWa1BPZeIOZy6ZWsL7q/BSgW6EaR3UNkw1csm97Il7B7Fi7LiZVBYgAleIiMg2YceV5WwzEOCeJNhaRAm1qP05QZa823lx/beYYt5LOVE0GuP2vzeE6BnWfO X-Seq: 52463 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: > On 02/01/2024 19:32 GMT Bart Schaefer wrote: >=20 > =20 > On Tue, Jan 2, 2024 at 9:05=E2=80=AFAM Peter Stephenson > wrote: > > > > > On 02/01/2024 15:25 GMT Phil Pennock wrote: > > > > > > Folks, there's a regression on git mainline such that `read -s` does = not > > > suppress terminal echo. > > > > That's not very friendly. I guess it's to do with the way > > readfd is handled. Something like this, or more general? >=20 > This dates from workers/51969 (commit aa85564), which means this may > have affected the -d option as well. At the time I said "would > appreciate another eyeball" but never got one ... Looks like -s and -d are parallel, yes. > > - if (OPT_ISSET(ops,'s') && SHTTY =3D=3D readfd) { > > + if (OPT_ISSET(ops,'s') && > > + (SHTTY =3D=3D readfd || (readfd =3D=3D 0 && isatty(0)))) { >=20 > Previous tests here were for (SHTTY !=3D -1) which was causing incorrect > calls to gettyinfo() when shell input was not closed but stdin was > redirected. I'm now unsure whether (SHTTY =3D=3D readfd) is ever true > here? I expect the original code was trying to avoid the overhead of > isatty(). It looks like there are a few cases that deal with key input, so they are relevant. I tried read -ks and that does work. > However, there may be a deeper problem: gettyinfo() always reads the > state of the controlling TTY, but it's possible that "read -s" has > been called with input and output redirected from a different tty > device. I suggest we just document "don't do that". That's definitely not something I think we ought to be playing with. pws diff --git a/Src/builtin.c b/Src/builtin.c index 9e08a1dbc..441a71c45 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -6506,7 +6506,8 @@ bin_read(char *name, char **args, Options ops, UNUSED= (int func)) } else =09readfd =3D izle =3D 0; =20 - if (OPT_ISSET(ops,'s') && SHTTY =3D=3D readfd) { + if (OPT_ISSET(ops,'s') && +=09(SHTTY =3D=3D readfd || (readfd =3D=3D 0 && isatty(0)))) { =09struct ttyinfo ti; =09memset(&ti, 0, sizeof(struct ttyinfo)); =09gettyinfo(&ti); @@ -6555,7 +6556,7 @@ bin_read(char *name, char **args, Options ops, UNUSED= (int func)) delim =3D (unsigned char) ((delimstr[0] =3D=3D Meta) ? =09=09=09delimstr[1] ^ 32 : delimstr[0]); #endif -=09if (SHTTY =3D=3D readfd) { +=09if (SHTTY =3D=3D readfd || (readfd =3D=3D 0 && isatty(0))) { =09 struct ttyinfo ti; =09 gettyinfo(&ti); =09 if (! resettty) {