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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31799 invoked from network); 22 Aug 2022 19:13:35 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 22 Aug 2022 19:13:35 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1661195615; b=PSSuE6iPMXxQkOnGE95jeSKAec0fW+MsavKzoHW2Q1x+iqRrHd8M41gHKs/a9flc35rOBz9q7b XVedbetQVeLWwbxcs6tM+BcUsbQSbY1JAIn/XCIP5S5BsMxd6LxlzzdI/u1kpXe3xBCAB0PtLC 30iTXtAtA4xT5T7zWyl7eRHgrFqWfQKOCzTpAFlOh8FY7UqMZh8c2hC/HAv7x6qHbe8uMHBDOY wvrsJNKQW4T9FH3+XoEp7OLQs5/rwpgaMdIP44Faby4yAyG1ugyBH3iuAWT/HCXdhLmIBCo1pI RBmjDSpGFQrRYp7xB1I3mMi1RYxFwY/nqSXUjBmW/MiqJw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out5-smtp.messagingengine.com) smtp.remote-ip=66.111.4.29; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1661195615; bh=SYMWMtOIPyvyiPPra3D/9Zhpg4ASTupVO+mDPeEpvp0=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Subject:To:From:Date: References:In-Reply-To:Message-ID:MIME-Version:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=H8sp9ZdUqrIHOREqKciHyKnDYjQpW9vzWj/RaLxoqZVDZ2nKHefLfa2GJBOiiAFYC3mdUS/gXp EsiRxyxgykkn+Y+iuPtn0XmTRMgEstRVqjorOTFxRuTOJyB3aJEIQaNN9Z21TNKsL6oM5x4aP4 0n/2MoSqwpMNut7vIXssxjdgtwdKNCzFXAYJQAO5+6KKbp1vquqG3aGRo4gcqhUtYrLXN1fnsd 5vSt1sJCdBWceYlAgZAtbV+cJctxSE1lWYfdsc4oYwb7+94L2VYOzW8yHoq10lo3j6Kznngp49 zBc+5msrqXOK9GEDTEVSvkaZ+AbYZ1O5bicdwj2lzeyv+Q==; 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:Subject:To:From:Date:References:In-Reply-To:Message-Id: Mime-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=fj/fVaFMhUToFSUTaHri02OuThIF4ozyLOERbiROHm4=; b=aiq1gQROv82lalS8/vcnpc0V8s fxX5bdcDba7itDzOSdgKt4Brk4zaA1o5q7aZS5M33aGdiogVh56V90sVJgaQdZ2gvFjoqE1CTeZGD YD+ltrzwzJTwLhPBt6MkoTCc4DpGWn/WS7VAGGJil3SHSeEYCtrO26hHWjHr4nBeP9Jbz3If6Hsmw Dv+0UCJEcyUpYFAs741hTgxRti65R4KZRmsiVfOreJ9dkJVCoBR63MFrqvwJ2ASGZx0EhvAT6VAVH QMXUftpieguPkVyAhedJcFbgXCvhUdi6uzRXo/DeRf2H7Gj0L0SPc03HWFLtHXZahwxXn/dD67EdU W47pIfHA==; Received: from authenticated user by zero.zsh.org with local id 1oQCrf-000OrO-3M; Mon, 22 Aug 2022 19:13:35 +0000 Authentication-Results: zsh.org; iprev=pass (out5-smtp.messagingengine.com) smtp.remote-ip=66.111.4.29; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from out5-smtp.messagingengine.com ([66.111.4.29]:58205) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1oQCl3-000O33-5v; Mon, 22 Aug 2022 19:06:46 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 3F6B65C00EB for ; Mon, 22 Aug 2022 15:06:44 -0400 (EDT) Received: from imap46 ([10.202.2.96]) by compute2.internal (MEProxy); Mon, 22 Aug 2022 15:06:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to; s=fm3; t=1661195204; x=1661281604; bh=fj/fVaFMhUToFSUTaHri02OuT hIF4ozyLOERbiROHm4=; b=Q77+aWyI2zLzkUhdDw9rwqsFsy9uP4zW2nbYLCU50 DFrNS0yJ7eHf4x5yTJCe8x4fL3cSCKtMM9wZCXo1D3ukT5gXyYhVd28YBab4zx0V iqqsJ5bWQdUYX44TPvVZfqMvfXZpr8vFRm+Fry31//J9K+iuB6lNl7REY5hC0i5Q Fhj+lVpQLSJ9spafFcMmeaPWUWe3HjX8HMyL7P2jB4EYwr/Y5Bg8MpBW7HpoIAvm +VR0zCP5K1H2QIXMzM+VtHOQK1xvF69GrG1Hoj86pmjhC0/ArVuP/PPGk9JED0NE 0R0LPHd/LwB9RYZtEBJ/Ue4vTleF3aCo3YhQ64yOYPynA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1661195204; x=1661281604; bh=f j/fVaFMhUToFSUTaHri02OuThIF4ozyLOERbiROHm4=; b=l5JRIrCvk68j3TORT ykwopFHV5Cc+MkZrL5d9L9Ft93siKs7KZeNZvdh/fsJ8VIUISGTLHUkwLfZVYzni VJKpVdEKjiBvkMjO5XVGEK1osOnPRxUMrJ2rjSItMVdZhwokA7jS3TJCdt6qTRCq LjeL65M27ObGAoeTcXnmctV2vqZqt9hAYHj45bAJAntMPDlom3LcyzczcUE4H0xr 8hItX8a3lif7Jnj0YDznU49qlpdCALKRduzWLH120wUZYb0vAo4DdbLsCA2PnPWK ah0pyHPxD4VXtcKyZYJu3ZRny9RaXpDZRQa6r6mb37ivE9U7YJKQCoMxKlYWhNQO TQ0YQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdeijedgudefhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgfgse htqhertderreejnecuhfhrohhmpedfffgrnhhivghlucfuhhgrhhgrfhdfuceougdrshes uggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeefhfekfe evieelleehiefftdekudejledvhfdtjedtgeegvdeuffefleehhfdvgfenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlh drshhhrghhrghfrdhnrghmvg X-ME-Proxy: Feedback-ID: i425e4195:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id ED3632A20075; Mon, 22 Aug 2022 15:06:43 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-841-g7899e99a45-fm-20220811.002-g7899e99a Mime-Version: 1.0 Message-Id: In-Reply-To: References: Date: Mon, 22 Aug 2022 19:05:17 +0000 From: "Daniel Shahaf" To: zsh-users@zsh.org Subject: Re: zsh expansion fails if nocaseglob and not all directory components are listable Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 27977 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Oliver Freyermuth wrote on Mon, 22 Aug 2022 18:02 +00:00: > 1) Prepare directory: > > mkdir foo > chmod 711 foo > mkdir foo/test > sudo chown root:root foo > cd foo/test =E2=8B=AE > setopt nocaseglob > echo $(pwd)(N) > > =3D> No output is returned. > If the (N) is changed to (|) [that's an empty alternation], one gets a "no matches found" error. > Of course, zsh can not exclude there are other directories directly=20 > inside "foo/" matching the given pattern (but with different case)=20 > since "foo/" can not be listed. However, at least the explicit match=20 > with case is known, > so I'm astonished zero matches are returned. > > Is this expected, or a bug? What would you have it do instead? Emit just one path? I don't think this would work, because if the glob expands at all, users may rely on what it _didn't_ expand to. It's perfectly within the API promise for a user to set NO_CASE_GLOB and then rely on something along the lines of the lines of =C2=ABif pr= int -l /etc(|) | grep -q /ETC; then =E2=80=A6=C2=BB (note that grep(1) is cas= e-sensitive in this case). For comparison, consider =C2=AB*(u.jrandom.)=C2=BB and assume a single= file in the directory returned -1 from stat(2) (so owner uid isn't known). Would it be okay to just elide that file from the glob's expansion? - Error out hard? NULL_GLOB is typically used to mean "Treat a glob with zero matches the same way as any other glob", and this case is rather "We couldn't determine the number of matches", so, maybe? - Enumerate all paths that compare case-insensitively equal to a different path and expand the glob as in the non-0711 case? Even assuming ASCII English this is O(2**N) in the length of the path (e.g., "test" is length 4 and has 2**4 possibilities), so, not tractab= le. Could be that I'm missing something, of course=E2=80=A6 Daniel