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,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 22726 invoked from network); 14 Jan 2021 04:04:39 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 14 Jan 2021 04:04:39 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1610597079; b=AZF6RvCBnbmeAOjrb9b+KCno7ojr/5eMpQAGXpNXqx+GV0GmpkrbYGovuF6ZdorZiSMKZp0XCs X/g74J0+4qtDc2JvP+QsBxIyM+FjldeIS/WSmyo1zdlF2lI11sHTSawqmTdcHczjumDOpsRJjd 09R/pRvMH61e7RImiv0075OsEY5nl3oCLGlUg2+mC/5CpftI9zcbEjA1ftf1jwSUFO14U48YgQ uvBGVjkSBQMz17/s6Y+/7FlWE8Iz07aNF/+jlU7IMFteaBw61KRB+6eHe9iwI1GrNzQgqkM/hd uqdyp59Zf0pZeSXdOt/r42resWA3I6LvmWxvSEF19B5IYA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ot1-f47.google.com) smtp.remote-ip=209.85.210.47; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1610597079; bh=Q0zYMadR7qUFsocEe0fYPLpRNtI5sznixY7+r22ns4E=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=EaA8/U4ui4Xl1Ymzk/dXvk9zHsGAykNFTsxn77UFxUi7u1Vqx+bdSdR9xjLVZOMjyvQoL85wDV tunoOtjZnmfD1UFn5tgflE5RTf2DPvd5PGfxTymrsUqVJaLz5/Uub/E4ECj5quBOIQdno4wXU/ nKeBTHsMZIsuwfKtSe0UW/HHbNpQAhTyDfC5w5l5hzs3lHaraQcFhomLVCzxO9qEs4XAM7oxFF 0K55YlCUxLcMjgy21A62lBEpF2g6+PCxJzwBJBO9+zSR5VBLOguISgXnxW6189wYc8lsffMb6k yLetNZ6eaD6NbWeOx8gttc7SNT3t3jtnc9KvVRhhDLrfMQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=6KDNXsXnvBWOmyZ9cuI+WnFsrzMI9xcozVPxnKmdWrk=; b=WV6Eau84A7pNgEyVqcaMADpmUa 0jLvB4IZ6RVR6rWjhFG+B+Ulx8YEGiOgLrHCGvLFj3nPMpH9ti+1ipIvu/hr2om+4BLNOMUPR82f3 v2ri3G3cRXHKTeN+9FTi4+lvZY9WNgb5/uY5349FamXWHyNUqnbA25n/IOGMV5Ztr2lCYFw1/bX+z XleZk5iAH6i4b4RLYGbVVW7MWYDsVLLKIQghTnvMSyjqP9BkH/OA59r9mfW+fEENz3jHqta5oB9xT QSSuTzZKN1bwbxm7hhVHjzbm4w+MC89wYGx68P000blODLAsOCRwQT3AvwwHrpuyc8mWKuHRDo04Z mDqyujMA==; Received: from authenticated user by zero.zsh.org with local id 1kztsC-00053h-DF; Thu, 14 Jan 2021 04:04:36 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ot1-f47.google.com) smtp.remote-ip=209.85.210.47; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ot1-f47.google.com ([209.85.210.47]:33770) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kztrv-0004v4-8R; Thu, 14 Jan 2021 04:04:20 +0000 Received: by mail-ot1-f47.google.com with SMTP id b24so4118445otj.0 for ; Wed, 13 Jan 2021 20:04:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6KDNXsXnvBWOmyZ9cuI+WnFsrzMI9xcozVPxnKmdWrk=; b=sd40jc2FsYOABzdkb9D2ocQJDgjYFXP2A2cj5mAEv1aiHzH/R93InnAQNeDhsJrbJN q94kYrEskQ/zsDpT5XHhgFr/px3zS8bTqFcgkT13/9kSKCUHDC/n5ZSPNeBm/tKtf/Ca rXFOQyy3FT0p/zImfjvj0qKZ8cApc9WkgavAfH1PzRGow5EwdmLPF16yTsKqIHDgESdn XrjAhA1Uo/sINCIMFWNEdlV+1Lfe0Lk7lOKzA77IqdcG6MKsuK8h9fsCE/fmfE3h5a9d UXV3gDr6ZLjWZrhhYM69szq0MYfohVL9OEl7eR7Ni4rQD1ge0e1PTFR5pqAIaOzkkQ85 VEiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6KDNXsXnvBWOmyZ9cuI+WnFsrzMI9xcozVPxnKmdWrk=; b=rHIZPJozk18WoIiMhCtSQcJAwGBiyL7SOW6EguzsaSSjSn+BV1BZaWA42xtM68Ks9h MX6XjakwwANR1fkSAGu3sZz6wYZP7KSdb4LP7pejnW1bzbi071Zo0facFMmUC7iXO8KH q1LP88cPhY5HbxlB1V/fXGipv71kmqbY6feFPSdMLqXwRPDPipzLwMO1/I74FhUeaX4I L4EzNIic4iOAYcua5A0fbs/bjdEnDob4Kvho0WyW6XYAqk+b6IFGKIX8cIq0TUciwpe8 IHQWbrwS37SCgcAUuGNUHx+Nl2HSXYhq34X85LOB3BJ6KUOtCmevFY0CidTUsEgB+ZjW /eYQ== X-Gm-Message-State: AOAM5305/zj/1jymP6BjnU+3NMxntyH2KnDqKkezV3uZ2znC6wqfHhDj oG/Wb80PeTzRckIDc3NmvRaaQp5c2KH7WaqS24etZQ== X-Google-Smtp-Source: ABdhPJwaH6MXn3f5lnqu7RvzJKRRi1TMQ3vS33dANwy4QH6bHUhi4B4nQLPB0v4Q7imVbXQyCvvr9Ro6NuGtJS/X6xc= X-Received: by 2002:a9d:208a:: with SMTP id x10mr3349063ota.260.1610597057888; Wed, 13 Jan 2021 20:04:17 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Wed, 13 Jan 2021 20:04:06 -0800 Message-ID: Subject: Re: [PATCH] Allow globbing with unreadable parent directories To: Devin Hussey Cc: "zsh-workers@zsh.org" Content-Type: text/plain; charset="UTF-8" X-Seq: 47828 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: Archived-At: On Wed, Jan 13, 2021 at 4:28 PM Devin Hussey wrote: > > On Wed, Jan 13, 2021, 5:28 PM Bart Schaefer wrote: >> >> On Tue, Jan 12, 2021 at 7:04 PM Devin Hussey wrote: >> > >> > POSIX specifies that when globbing, parent directories only have to be >> > searchable, not readable. >> >> Lack of search permission only means that you can't tell what kind of >> file "somefile" is (you can't read its inode data, e.g., stat() it), >> not that you can't see the name itself. > > This matches the behavior of the "pure" globber, POSIX, and literally every other shell. I tried the same test cases with "bash" and it behaved like (unpatched) zsh. Again, can you show me a counter-example? > Case insensitivity should not change the output due to file permissions. If that were a property of the filesystem, as for example on MacOS, then I agree with you. It's less clear when the filesystem is case-sensitive. Why should (#i)file not be the same as [Ff][Ii][Ll][Ee] ? > opendir(fn) will also fail if the "folder" is a file. Sure, but so might access(R_OK) ... and access(X_OK) might succeed on a file. >> As far as I can tell, the patch >> would only cause globbing to fail in more cases, not succeed where it >> previously did not. > > No, that is definitely not the case. > > opendir() would fail if either R_OK or X_OK was false, causing unreadable folders to be a false negative. I don't think that's true. opendir() is fine with only R_OK. Again, try "ls" on a directory having mode 444. What you cannot do is "ls -l parent/child" when parent is not searchable. The actual problem is that PAT_PURES is never true when NO_CASE_GLOB is set. That means scanner() always passes through the branch that attempts zreaddir()+pattry(), which fails when there is an unreadable directory. I'm not immediately sure how to fix that without introducing a bug/vulnerability where a filename could be constructed such that it literally matches the internal representation of a glob pattern.