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 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27396 invoked from network); 8 Jan 2023 19:48:11 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 8 Jan 2023 19:48:11 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1673207291; b=C6Glr1AD9mZQAW2mNWgsSWUxMLQVUtryJLv29nIA8LsOVuM0HlFFCYXO3wOMXbNflQm06UsCiz 7WhHWUq4f8dFd/yRwxSklXPdNjN0ZhVTgqkbtxoR76aCa2Zl27RCRd0TrlAHcHnVJ/wSkBQ5Qn 1YdK8mW4g7M6OrAwrqoII4oetz1b/LJw0mS8OIZhRmdeEJSoxE8QsrNvrypxhS5oGF2rZ4drIR hEcddXdKKlEaUK42aJ9vOhC8UQRDRJ+n5ijDykQOkfZv+nTAL7VRbl4EhqtthV0akvgVWU+7iC JgbjzP+g3KUWZmEN5fWxdRIAawvF/8gH5icnZyIk9QO9hg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97; 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=1673207291; bh=mJwVgGADxH7853fb0WwEKZW/a/U8s2+FilQBwSx7Ek8=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:MIME-Version:Content-Type: References:In-Reply-To:Date:To:From:Subject:Message-ID:DKIM-Signature: DKIM-Signature; b=MkXlVJegNzIjU9Ng3D+gJgGhqHnuW9H6joxdz/Wn6cz0MpG96IdgM4C6msFSMfDDMES1ZJtvjL /cGic+9EhY32YStK4TRRbIna3lqQPq9ENBzmqV9tuioWg2uiWdxgiyJiaVG2s1bSJoWXT2CrSg 8T1DFBgupJibjVX2kJGp3VZUu3KoEm6T++O5ZJjBMe2V0SM07jA9+9zUfLkJ4QiRsweuR8wd1i dQIgq+SBMVUoRnh12bnRzRVVr+4brmOVUDCfRpTIWBhlp/ONJdxcdsavtU+HWiYJgWzMCup3br AjjdwFe4v7wIG/2krEz9CgkW/Z2/t8chA0MtudFLlC/0jg==; 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: Mime-Version:Content-Type:References:In-Reply-To:Date:To:From:Subject: Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=6sZgNgKP0wvEocJwQaDlJXgikpgiTG2b1jsK0JGIs2s=; b=PvaIAXjFYjiQHyhQfW4neVVLTc nfJiDyIi8UkyLdbui0a503nzDnCk+pVi2M6DKNqPlNx2obGtjk//Z7sA4Oz+eV9+62kGe42o7KQrI NYit0Hi9Oav6bqdymA0mrzHWMmf+v5fqxPpd2Yi5YvUOXDm+Xw83mkCsKtz2yE5N+t8gZhhpo0znm HVbsrOlDccaEJayz9UfzzI757jr47x8SvYETh4xWSkXRUXEbbHm7qMq1OKooMEptspsp1UDq4hZnE DoXh1uuKcW4ZO4/NUOipIOG4zI5Hn54Te6WDb+Jr29lApc5v81+Za75eWYUwGQs14Ny38lib6Tymj zH/LdaUQ==; Received: by zero.zsh.org with local id 1pEbeL-000EQf-9c; Sun, 08 Jan 2023 19:48:09 +0000 Authentication-Results: zsh.org; iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none Received: from smtpq2.tb.ukmail.iss.as9143.net ([212.54.57.97]:34088) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1pEbdm-000E6o-44; Sun, 08 Jan 2023 19:47:34 +0000 Received: from [212.54.57.107] (helo=csmtp3.tb.ukmail.iss.as9143.net) by smtpq2.tb.ukmail.iss.as9143.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEbdl-0001nZ-B0 for zsh-workers@zsh.org; Sun, 08 Jan 2023 20:47:33 +0100 Received: from pws-Zeus ([82.1.229.179]) by cmsmtp with ESMTPA id EbdkpNW1viDF1Ebdkp8Cv2; Sun, 08 Jan 2023 20:47:33 +0100 X-SourceIP: 82.1.229.179 X-Authenticated-Sender: p.w.stephenson@ntlworld.com X-Spam: 0 X-Authority: v=2.4 cv=Mr6UqUWe c=1 sm=1 tr=0 ts=63bb1dd5 cx=a_exe a=W4rGJ7PGCSRRUvufKHO8Dg==:117 a=W4rGJ7PGCSRRUvufKHO8Dg==:17 a=IkcTkHD0fZMA:10 a=RvmDmJFTN0MA:10 a=NLZqzBF-AAAA:8 a=pGLkceISAAAA:8 a=1q_sMSj74taq1bGoid4A:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1673207253; bh=6sZgNgKP0wvEocJwQaDlJXgikpgiTG2b1jsK0JGIs2s=; h=Subject:From:To:Date:In-Reply-To:References; b=0TpYcVVVLOlVYEPAQpEH1y6pqa7/N9IdAI/Y/Vsv3XIfQJi5bizjluBiUQxegM0t8 Gi+jzM5TWHjUrYpBIxATy0Rmc41o6yzwCZEvIwVixQ/vUmKMrjcpGz2fmbZ/iGpKDE oA1KalrWNL0g8NdyfnH4k/Wxq7wblayBCuQqYFxNVNud4xHMRQqbDIT+YUOmrSjh88 R6sEUncEB+y4foA2OhmyT3tZiWiQBqC3FyKinWHOKMiGWe6xCtMKuwQcIeGyxkTZzM H+hCNdxoe9wBOns8BSTrroGeWTYBZ4PMjodZvbs6Q4Ou0ILkMjQKXmQjtojuJC1Le7 OUmTqfHMcuZAA== Message-ID: Subject: Re: Subscript flag (i) not working correctly on empty strings? From: Peter Stephenson To: zsh-workers@zsh.org Date: Sun, 08 Jan 2023 19:47:32 +0000 In-Reply-To: References: <361494476.8470860.1673025799682@mail.virginmedia.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4xfJnNVGxW2gcPAt7xKHzhI0tZNTJ8z4yA4lOyJSjSAh8LQPBQwjCvPwHBGBqbjnZ7y9b3iSYvO6hGO1n1/9syGLlI0pK87CmkA0p557mTCi9drU3/wPzB vQVM4xKLiuw/vK9j60rMof83knAckw8+tMkBR4OVLjRrIJtIMVtQi41Fw30QhKSvB/mIUFVyXOkV1A== X-Seq: 51288 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 Fri, 2023-01-06 at 10:12 -0800, Bart Schaefer wrote: > On Fri, Jan 6, 2023 at 9:24 AM Peter Stephenson > wrote: > > > > > On 06/01/2023 16:01 Philippe Altherr wrote: > > > > > > > s=; echo $s[(i)z]; > > > > 0 > > > > > > Why is the last line 0 and not 1? > > > > Certainly looks plain wrong. > > None of the existing tests fail with this change. > > I thought there was a discussion about this at some point in the past > ... but it may have been limited to array cases. I have the feeling > we concluded that (i) and (I) should produce the same result on empty > string for purposes of boolean tests, but I can't find such a > conversation in the archives. Can you think of any piece of shell code that might rely on this, in the absence of any historical corpus? As far as I can see this is a plain misuse of (i), which isn't there for boolean tests. This doesn't feel to me like a big issue anyway and in the absence of a clear cut reason I would think consistency should triumph. pws