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,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 32421 invoked from network); 31 Aug 2021 01:39:34 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 31 Aug 2021 01:39:34 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630373974; b=M7fDXTDCgfBMVCvof8iiySqgNVRffTEeWTRpQdHQesu1O6NmI7wQLwCzaIZp0deoVVtQx0/rP/ Sk5HVibZQbB8w7VM9rpmnpfTu1mSxBjkxwsPSEGMPO9C7IEJo0tnrrsnnnqaD1nfMj7uUUmG0j 8syLmGGkh5nxG8XFMxkDZ7BBcUGzrk77KDF33jfXXWOcCxgIsDb9H9K1Um6kcplGgiZ0UFezpU flI9FKqF4hXTssS7H45cXJPX6Y9eu3DsgYm5WpeMQHpV0kFLunmnJZeX2r5KbA8IE8ZgmcLkIm IiPZSNqdrLUWOxErCKAYttFxRwgI2tn4J6gKlM4BbgYwwQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mx.spodhuis.org) smtp.remote-ip=94.142.241.89; dkim=pass header.d=spodhuis.org header.s=d202107e2 header.a=ed25519-sha256; dkim=pass header.d=spodhuis.org header.s=d202107 header.a=rsa-sha256; dmarc=pass header.from=spodhuis.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1630373974; bh=CRLzEor62RfnXuBbjgIS5oQDe7Kn+ZhA/lKcup1ZP7k=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature:DKIM-Signature:DKIM-Signature; b=grLAPC+jI2oegC6xSnxdv616Rb4RXqxY5/RyZtBRCPFNFsr756ur/x7FW49S7769YccbQg0lDp aXiMLDRXd1lZ51BlQtGlHMZdftAt8/diGHv9gHUyqneIBhanIKDS7Rp1C/JbuPnNh9syJ8fjNI dnHEm7Dgv8FJZQbk7JY3LX604aPWYiZShLcUE8eTVny82ojE9K5FneQxjXtoku3AHXN6lH6O1K 58V/dz5jixSfimY0YtuBdP03fK5RYhZH5CqYKYCOJstRpzbLOD9dy4fSX8ybQ1SeOjbmAOcV0S u/AS/3Yoq65Ag4CpQNKPUDmDFoD13iQPYh99HabzVNFy2w==; 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:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=igfqAHTMA0tTN2yc+c+XPh6JREPfAD3pyg332fYvZh4=; b=bDu/oMkwT8+fgePmRhdNEkc7le VC+KQJz+xYp3aKOHw4uiMGRp9oAPS4gng0TE4ERh3OrgO+I+/BYLrGBGaIlAGB2mL4ihHiuaqrole TEQegKVrSTXOEyx8XjLw5wuCmbMXsb25qKkER4VX1lW9FnLPxR1D2pCYl5suMoez8Fm10wKLglMoL y7THI/U0izviIg70v9yVvY7lBSCcLGKYcmFwk6JKwVihYjYjUJgmUfac6l9WWLGwJpagX3q7clHRb TP8YalYhiBwbi9qrfOvEk3AnBteEAeb8tyHmQ8HCCtCgnqNrhTkGwYVujpz0Fa3aQ3Q0nA9g+rUcY ykziK95g==; Received: from authenticated user by zero.zsh.org with local id 1mKskO-0000EU-1h; Tue, 31 Aug 2021 01:39:32 +0000 Authentication-Results: zsh.org; iprev=pass (mx.spodhuis.org) smtp.remote-ip=94.142.241.89; dkim=pass header.d=spodhuis.org header.s=d202107e2 header.a=ed25519-sha256; dkim=pass header.d=spodhuis.org header.s=d202107 header.a=rsa-sha256; dmarc=pass header.from=spodhuis.org; arc=none Received: from mx.spodhuis.org ([94.142.241.89]:44767) (DNSSEC AD) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mKskA-000PvN-Go; Tue, 31 Aug 2021 01:39:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d202107; h=OpenPGP:In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Reply-To:Subject:Date:To: Cc:Content-Transfer-Encoding:Content-ID:Content-Description:OpenPGP: Organization:Auto-Submitted; bh=igfqAHTMA0tTN2yc+c+XPh6JREPfAD3pyg332fYvZh4=; t=1630373958; x=1631583558; b=XztXcYHwHTLc58UFgzK0xk3HbZXSCfK/FZ1uCs8QxuTtR3C 8fewAgViBf8OVjvc6+v7QQ4+OJCgEMck/qqZnpdATo3VNWhByUcrPfzv5zFTCvFMd4bslUnFtQ2Ok JRJz0F8jpKimSVei1VyAE81uXDZmJbqz3LMNx0HNDhz9+MO1dNBUn//ASulGsLS/hki/67ab+O/hY DcrV04UU19NXD4MroUqumVqqHEYvBi0YJGIv7uCkObBvMkwz7+AYpse6LiFQGcTCAbo2U4FI10jUY 4HPfOjDJlvOi15fn6Wd7oztw52BP9zVdwSUxGYVWoOd3zvI6/eZwMz2k7ZGz3UcA==; DKIM-Signature: v=1; a=ed25519-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d202107e2; h=OpenPGP:In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Reply-To:Subject:Date:To: Cc:Content-Transfer-Encoding:Content-ID:Content-Description:OpenPGP: Organization:Auto-Submitted; bh=igfqAHTMA0tTN2yc+c+XPh6JREPfAD3pyg332fYvZh4=; t=1630373958; x=1631583558; b=GG7F5uIiHdnQ1PX8UqIwOmm6/Gc0d3oyRtwTUBTP0sIlR2v TH4QcmPUGzfnm1V9NNRVpABllQyCHmSUdDUB5Cw==; Received: from authenticated user by smtp.spodhuis.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mKsk9-000PvF-5v; Tue, 31 Aug 2021 01:39:17 +0000 Date: Mon, 30 Aug 2021 21:39:15 -0400 From: Phil Pennock To: Shineru Cc: zsh-workers@zsh.org Subject: Re: tr [:lower:] Message-ID: Mail-Followup-To: Shineru , zsh-workers@zsh.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: OpenPGP: url=https://www.security.spodhuis.org/PGP/keys/keys-2013rsa-2020cv25519.asc X-Seq: 49336 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 2021-08-31 at 11:04 +1000, Shineru wrote: > zsh 5.8.1. Arch GNU/Linux > > zsh: echo "hello" | tr [:lower:] [:upper:] > zsh: no matches found: [:lower:] setopt nonomatch or: unsetopt nomatch but: both of these are dangerous, because there's a real quoting issue here. % touch l p % echo "hello" | tr [:lower:] [:upper:] heppo bash$ echo "hello" | tr [:lower:] [:upper:] heppo Without quoting, [:lower:] matches any of: l o w e r : [:upper:] matches any of: u p e r : so the globbing turns the pipeline into: echo "hello" | tr "l" "p" By default, zsh complains about unmatched patterns, rather than letting them fall through silently. Falling through leads to this sort of "foot-gun" construct, where shells encourage you to do something which "only works as long as X is not true", instead of having reliable code. So you want, for safety, in any shell which resembles POSIX at all: echo 'hello' | tr '[:lower:]' '[:upper:]' (This probably belongs on zsh-users.) -Phil