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,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1916 invoked from network); 12 Jan 2021 22:22:32 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 12 Jan 2021 22:22:32 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1610490152; b=HJKZ7YO+R10c2iqkX2t/Wi65sRAfBN1Zpgm4mOl14ibxWK9ZDC3fIipzfOaedZA2jzJxxiVpji n6qTLaEEOyRRV3nLEozhVYELWPguq6s7xBda1QQ5s2lpzgHOeH4JTlmmiUpwxlEvJzbX3mpFlb jHjFh4gKwHT1GfxSpLX7HdZUIWe92i+hSFrVBDe4tdOJQrNqqjxWckh1xJrypETY/BAyUUkVjG eSkQT/bXxsyL8835n2TgdtarjbdaW9O4IR0Ep6jp8DxhaNaFTfoow0qck2FzKyTD+zCFpZs+0l 0nRsyqJH4u2xMLCoPK8DLz3bNKx4z5U9x/OeWXunGBHG8Q==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-vk1-f172.google.com) smtp.remote-ip=209.85.221.172; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1610490152; bh=Vxyf2Rn3Vhzp0o/9AbFPoF6N/TE3oYVU9YRBBrkz6Q8=; 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:References: In-Reply-To:MIME-Version:DKIM-Signature:DKIM-Signature; b=svprTzlAYZGaxEqcc1jsc900d9BXkaSvVPoagE1Vcx25VpWj5mpYuMmf/5INXtJDTd3O+Wxz1C bklr1QsMSl6TYhPDl3lmdaKkfukZgcrvJuyEtbQXVx+X75hE8MKnkJHYBy4Ddlu38x7sXhFRxK mxqmCUEwLUkvVZjl0gpL5EqoriSl+hpguPn7Mv7YEx9R6vmnmGZ301xkc9YMSYXn620N47P6ue Oe7gVyO4KfkVweFuA+D0/pYd38iB0FVIAPxeSRd18RzXEt7q2wLPDiDz5f1hh/91mpNmFwMatF zBzeNgODgx6WIaQYkgCwSK/091mUKX+8/zwg/3a65oGUXA==; 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:References:In-Reply-To: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=pGI9x4LfbfuHv8hz+naJeL1hYnAibSTQf8grQU6CXMA=; b=xs1nWPS8Xvz333jyV5dH4mXK6k HZUhayiLv+2HxFjURHH3RFp5vhJiubFQakI3Ipit/Foxh4OcdAxpNJENE6pJgvRLjmT2PsQ4i9lDf RZ4u2dKdIdtjdxmP0nawHsdrFXwzuEriI+gQYuACg2aEFBQdcEjR4v86NZDaa9kDXDEqRntwmOi3C Ho6tF4L76Foe5tZr+XyS/XJcxkQ61N+SON6Fq0pS7KrdK2JbRrHUmEijgpk13ikqbprZW+pnuOV/x rOPiW71Qy4SxbV9aTdGrCysUHvjPBp6ZR44Z988Dd8heoXLRNs7s5j2pjnkIV/D61uFi/ybLXoPjL PiuGOJ9Q==; Received: from authenticated user by zero.zsh.org with local id 1kzS3Y-000Nal-Vs; Tue, 12 Jan 2021 22:22:29 +0000 Authentication-Results: zsh.org; iprev=pass (mail-vk1-f172.google.com) smtp.remote-ip=209.85.221.172; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-vk1-f172.google.com ([209.85.221.172]:41257) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kzS3H-000N5n-Bc; Tue, 12 Jan 2021 22:22:11 +0000 Received: by mail-vk1-f172.google.com with SMTP id a6so67019vkb.8 for ; Tue, 12 Jan 2021 14:22:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pGI9x4LfbfuHv8hz+naJeL1hYnAibSTQf8grQU6CXMA=; b=ZwfOcXzIlRXspOYPJIGwGzdEKE5/7rvC4zW6ikLb70gDwK59t64qGNcU9ty0JwuSMb aPBEZrmAEB00mBuL/oGAEUuwhWLD5D9DiljUcIPk1NukdPOxoqfU/JPTgYJv2pQ4HJPp RgYsb+uQFI/i2Xo7utjRYdDAWXyhdVZC9cM3TL/azprOWuza65CCYRlY8VDxHvhvaDHH 8ASCaTzSVnO7rPtjzXOM3PPSvP48LGiRyAP4Me0HRs1h5U1RrbuqP8NaZUhFWt0rChd/ lv8NRGRcGx6NupTyLnQYq89m41pe9FKY8Q1z13RJN0PJQCc3Y1H2d6bG/od3mUk0jtA7 kOkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pGI9x4LfbfuHv8hz+naJeL1hYnAibSTQf8grQU6CXMA=; b=he8x5KR3vucPfr62nbTXwUy8Fl9RJrJoS9W05OhPzahFVxPMzowETU8pZvDv8eId6I jcm3bVy2UrseB9eK0Cz6MX/CCVROjW4liCmSDoee0L/VseEvfHUbJlafZ9D0Qm6VNesr 8iUFuaxXAmJlt/m37T7QIbYPlht5AZG7y90CxzFZW0w9MPDn2SDn49zLXP0B5xFNDRGo wmNnFcJzcBnMsAHL2h2xvkSW2btr4g0OLXoBYIybQ6F2HGVS086pfgcKzvSnMfapsn9m QZYSOPILtO213iiBeygeCOh2qqprMEt8ND4/aFqRv9hC7BxDlgUnlxEamrjbq040QNfS 4SPA== X-Gm-Message-State: AOAM532X18ryoQWk9/0oNnW9wn/NYg9fSC/7ZjqjCOaMK0jPagNy4irE 29xrohTU/3z9Ym+u6CtTnR3GFBV5Sph3PAlwfZg= X-Google-Smtp-Source: ABdhPJwhGZvDndpCE1AY3TM+QBmopKY5P73MGp9dfPaGNa/2h/wwoNq7xruVxGqtyehfCnHqFGS3iSKKDrtdncpCnHk= X-Received: by 2002:a1f:9409:: with SMTP id w9mr2160286vkd.8.1610490129838; Tue, 12 Jan 2021 14:22:09 -0800 (PST) MIME-Version: 1.0 Received: by 2002:ab0:2306:0:0:0:0:0 with HTTP; Tue, 12 Jan 2021 14:22:08 -0800 (PST) In-Reply-To: References: From: Devin Hussey Date: Tue, 12 Jan 2021 17:22:08 -0500 Message-ID: Subject: Re: Issue with permissions and case-insensitive globbing To: Mikael Magnusson Cc: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" X-Seq: 47812 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: Actually, I think I found the fix. We can simply continue recursing (skipping the readdir() loop) if we hit EACCES. EACCES seems to have lower priority than ENOENT/ENOTDIR, so it won't end up in an infinite loop or any of that. I have a patch to change this, although it has only gone through preliminary testing. On 1/12/21, Mikael Magnusson wrote: > On 1/12/21, Devin Hussey wrote: >> Case insensitive globbing will not work at all if any of the parent >> directories of the target folder are inaccessible. >> >> This bug makes zsh very unstable on Termux (a Linux environment for >> Android), as scripts which use "~/..." will immediately show no >> results. >> >> Android's directory structure makes it so apps can only access their >> /data/data subfolder, blocking access to /data/data itself (it will >> return EACCES). >> >> Termux's $HOME is /data/data/com.termux/files/home. >> >> The simplified folder setup is this: >> >> root root 0700 / >> root root 0700 /data >> root root 0700 /data/data >> termux termux 0700 /data/data/com.termux >> >> A (possible) fix for this issue would be to start in the "base" >> directory before any opendir() calls instead of starting from the root >> directory, and checking for errno. >> >> See: >> >> - https://github.com/sorin-ionescu/prezto/issues/1560 >> - https://github.com/termux/termux-packages/issues/1894 > > I can only reproduce this with absolute paths, which will obviously > not work (there's no way it ever could, as the kernel will not let you > open the directory). It seems to be completely independent of case > sensitivity as well. Using a relative path should work fine. > > To expound a bit, > % mkdir inaccessible; cd inaccessible > % mkdir a; cd a > % chmod 000 .. # make inaccessible inaccessible > % touch a b c; echo * > a b c > % echo $PWD/* > zsh: no matches found: /tmp/inaccessible/a/* > > (you will get the same result in any other shell (some may echo the > path with the * unexpanded)). > > -- > Mikael Magnusson >